Showing results for 
Search instead for 
Did you mean: 

Add a white frame to an IMAQ image

Dear all,


While I was working with lines detection in LabVIEW, I observed that the algorithm has some difficulties to deal with lines touching the image boader. 

Simply by cutting a piece of the lines, and leaving a white gap between the line and the boarder, increased the accuracy of detection. I did manually, in an image editor.

I woul like to do it in LabVIEW by adding a small white frame to the  (IMAQ) image, so that any line will be touching the new boarder of the image. The new image I  expect is to be bigger, since it would consist of the original image plus the white frame. Does someone have idea how to do that?   


Best regards,


0 Kudos
Message 1 of 4
-I'm not sure what your application is and how you are detecting the lines? any sample images?
-If it's binary image you can try IMAQ RejectBorder.
-If you want to fill only the boundary with 255 use IMAQ SetRowCol.
Message 2 of 4

Hey udka, 


Thanks for your answer. I´m working with binary images. I´m using the IMAQ Dected Shapes for lines. 

Using IMAQ SETROWCol might work, but I would lose some pixels of the original image.

The Reject Boarder removes most of the lines in my image and keeps just the big objects. I tried with connectivity 8 and 4, but did not work.  However, it´s good to know about that function, I guess it will help me in other part of my code. Thanks for that. 

I partially solved the problem by creating an array of zeros (initialize array) with the desired new image size (original image + frame), converted it to image (ArrayToImage), and used the ImageToImage block to insert the original picture into the new (blank)one. That adds the white frame without altering the original image.

However, I noticed that adding the frame changes the detection results. Some lines which were detected before are not detected any more, even if they have almost perfect quality. In order to recognize them, I had to activate the Subpixel option, or change the RowSearch Step, Column Search Stem and Max Endpoint Gap. Even adding a frame of one pixel changes the result for some images. That strikes me a lot. It´s quite bad since I can´t be changing parameters for every image. Do you know why could be the reason of that behaviour? Could you give me more information about the  parameters within the dection function?


Thanks again, 



0 Kudos
Message 3 of 4

Sorry, I correct: I´m using grayscale images (U8). 

0 Kudos
Message 4 of 4