LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Edge Detections and/or select adjacent pixels

 I have a 24-bit image that I selected the color I wanted, ROI, and saved it as a 1-bit image and 2D array.

 

I wish to create a subset array of one line on the image. I can use the mouse and click on the image, selecting the line I wish to evaluate then however I would like the code to create an array of the adjacent pixels which create the line.  In essence if I was to write down all the X, Y locations that created the line in the image. 

 

I searched for various topics which may help but can't think of a proper keyword to search for, one of my search was "edge detection" on Feb 3, 2009 at 1013 Nighcrwlr wrote "... compare each pixel of an image to your desired threshold level, and if the pixel is greater, make it 0, if its less, make it 1. Or however you want to do it. It would just require nested for loops that are auto indexed for your pixels, and then compare each pixel."

 

This maybe an approach. Anybody have a suggestion.

 

See Example 1 image for an example of the selection. Ultimately I will insert the values in the array into the “general polynomial fit.vi” to determine a formula for that line.  So that I can compute other points which may extend beyond the drawn line and other things if needed.

Download All
0 Kudos
Message 1 of 4
(1,997 Views)

I had a thought and used a convolution matrix on the original image and successfully do an edge detection.  But sill I need it in an array of only the one line.  See Example 2 image attached.

0 Kudos
Message 2 of 4
(1,984 Views)

Hello Fro2,

 

I was wondering, do you happen to have the NI Vision Development Module? This module would provide some built-in functionalities that might be very helpful for the development of your program.

Additionally, in the resulting image from your edge-detection algorithm, you'll need to find a way to define a start pixel for each of the lines whose equation you'd like to calculate. Once a start pixel's position has been determined, you'd like to use 8-connectivity or a similar method to find the neighbor pixel's position. Finding a few neighboring pixels' position should be enough for you to find the line's equation using the polynomial fit function block. 

 

Here's an old Forum post that might provide you some ideas on how to do it, and it even has some example code that you could test: https://forums.ni.com/t5/LabVIEW/How-to-find-set-of-pixels-inside-each-blob-of-a-AVI/td-p/3751361

 

Regards 

 

0 Kudos
Message 3 of 4
(1,948 Views)

No I do not have NI Vision Development Module.  Far as finding the starting location I can use the mouse and click on the pixel that I wish to start with, I do understand how to do that and I do understands how to compute the 2nd order poly once I have the array of data.  Getting the array of data is where I am stuck.  I can't think of a Kernel Matrix to use if I wanted to use a convolution nor could I think of keywords to search for to detect neighboring pixels.  Thanks for the suggestion to use "8-connectivity or a similar method to find the neighbor pixel's positions" I will research that.  Also thanks for the link.

0 Kudos
Message 4 of 4
(1,942 Views)