01-28-2026 05:05 PM
I have an image created using a 2D array of 0s and 255s to create the image. I am looking to find away to create the red line so that it is always so many indexes away from the object in any direction as shown. Basically I need to run an object around this vehicle while maintaining a specific distance away from it in any direction. 1 index in any direction is about 1". so to be 10" away from the object, I need to be 10 indexes away. Any Suggestion?
Solved! Go to Solution.
01-29-2026 01:00 AM
Hi John,
@john_joe wrote:
I am looking to find away to create the red line so that it is always so many indexes away from the object in any direction as shown.
Learn from image manipulation applications (like Photoshop or GIMP)!
There are tools like "grow" or "shrink", which do what you want to implement.
Both tools determine an outer border of an image part and grow/shrink the part…
01-29-2026 05:13 AM
I agree with Gerd, there are lots of image processing apps out there which might be easier to use.
transform the graysacle {0;255} image to a binary image {0;1},
you can caclulate the outline of the binary shape via a custom morphological filters
e.g. the structuring element of an inside-shape pixel will always have sum = 8 with 8-neighborhood, an outline pixel will have a sum between 1 and 7
once you caulated all outline pixels, you will have the original outline-coordinates
add a global offset with respect to the center of mass of the binary shape to this original outline to get an offset-ed outline.
01-29-2026 10:03 AM - edited 01-29-2026 10:07 AM
@john_joe wrote:
I have an image created using a 2D array of 0s and 255s to create the image. I am looking to find away to create the red line so that it is always so many indexes away from the object in any direction as shown. Basically I need to run an object around this vehicle while maintaining a specific distance away from it in any direction. 1 index in any direction is about 1". so to be 10" away from the object, I need to be 10 indexes away. Any Suggestion?
This should be trivially simple to implement in pain LabVIEW. What have you tried?. Simplest would be to just iterate over all points of the image and see how close the nearest black is.
If you want the red line in "any direction" (sic), why isn't there a red outline at the bottom? What should happen if a window is much larger than 10 pixels?
01-29-2026 11:32 AM
Assuming, you want a 10 pixel distance, here's one possible outcome.
(Of course any angled distance will have distances that are not quantized to pixels)
01-29-2026 01:56 PM
Thanks for the help! After messing around with Grok installed the vison module and used the IMAQ routines to give me what I needed!
01-29-2026 02:59 PM - edited 01-29-2026 03:01 PM
As an simple exercise, here's a convolution based solution that does not need any toolkit.
Pixel[0,0] is considered the background color, any other color is considered object.
It would be easy to modify, e.g. if you don't want the line below the car.
01-29-2026 03:09 PM
Wow that's amazing! That works well too! Thanks I might use your way!