Hi,
I have a need to subtract two images. Now I know this is a function in Vision, but I want to use plain old imaq. So, I grab two images from 2 seperate NI1405 framegrabber cards using
imgGrab (Sid, (void **)&ImaqBuffer, TRUE);
imgGrab (Sid1, (void **)&ImaqBuffer1, TRUE);and then call a function that I wrote: absSubtractImage(imaqBuffer, imaqBuffer1):
//pixel by pixel image subtraction
//absolute value
//assuming data is laid out as follows:
//pixel 0, pixel 1, pixel 2...
//00RRGGBB, 00RRGGBB, 00RRGGBB...
int absSubtractImage(Int8 *img1, Int8 *img2) //img1 << img2 - img1
{
int i;
unsigned int bufSize;
//make sure that the image sizes are the same
if(sizeof(img1) != sizeof(img2))
return -1;
bufSize = sizeof(img1)/sizeof(Int8);
for(i = 0; i < bufSize; i++)
{
*(img1+i) = abs(*(img2+i) - *(img1+i));
}
return 0;
}
Problem is
sizeof returns
4...; problem probably has to do with the fact that I am probably not dereferencing the pointers correctly. Could someone please guide me?
Thanks
Owais