Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

"Invalid image border" when running imaqConvolve() despite correct borders...

Hi!

In my application, I use imaqConvolve -or at least, I try to use it.

I get the error "Invalid image border", although I am certain that I have a border of half the size of the kernel used with imaqConvolve().

This is basically what I do (although in my application some of the steps are placed in different functions):

---------------------------------------
Image *srcImage;
srcImage = imaqCreateImage (IMAQ_IMAGE_U8, 3);

//Make a copy of the image
if(!imaqDuplicate (srcImage, theCartCamera->getFrame())){
printf("%s\n",imaqGetErrorText(imaqGetLastError()));
}

//Smooth the image
if(!imaqConvolve(srcImage,srcImage,imaqGetKernel(IMAQ_SMOOTHING_FAMILY,3,5),3,3,(float)(0.5)*3
,NULL)){
printf("ERROR: imaqConvolve(): '%s'\n",imaqGetErrorText(imaqGetLastError()));
return 1;//Error
}

-------------------------------------

theCartCamera->getFrame() returns a pointer to an image with 0 border. Since srcImage has border of 3, I guess that wouldn't be a problem? Anyway, I have tried altering the border of the image returned by theCartCamera->getFrame() to 3, but this did not help either.

What am I doing wrong?

Thanks!
0 Kudos
Message 1 of 2
(3,698 Views)
I tried calling:
imaqSetBorderSize(srcImage,3);

right before imaqConvolve(), and then everything went fine.

imaqDuplicate alters the borders of the image, so I guess that's the answer.

But the strange thing is that even when the image returned by theCartCamera->getFrame() contained a border of 3, I got the "Invalid image border"-error.

I have solved it - yes - but I still don't understand that the error appears when all images involved has a border size of 3.

Comments, anyone?

Torbjørn
0 Kudos
Message 2 of 2
(3,698 Views)