Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I find a horizontal line?

Dear colleagues

 

I have an application where a horizontal straight line (slightly tilted) is to be found in a camera image. The line is somewhat blurred, but still quite sharp, and it covers the whole width of the image. As I haven't found any Machine Vision (8.2) functions in LabVIEW (8.2.1), I'm hoping that someone has already solved this problem before and is kind enough to share the solution.

0 Kudos
Message 1 of 10
(5,205 Views)

Post your image. Did you try thresholding and particle analysis.

 

Without seeing the actual image we can only guess.

0 Kudos
Message 2 of 10
(5,189 Views)

Dear muks

I've posted a kind of worst case line; it does not cover the full width of the image and the intensity shows variations along the line. Can you explain how you would use threasholding and particle analysis.

0 Kudos
Message 3 of 10
(5,166 Views)

First please dont renmae bmp to png. It takes just a second to open the image in paint and save it as png. The image is still trying load here.

0 Kudos
Message 4 of 10
(5,149 Views)

Wierd. When i try to download the file, I get a file not found message in firefox.

0 Kudos
Message 5 of 10
(5,146 Views)

Hi muks,

 

the file loads fine. Here's the real PNG version... (Converting the picture to grayscale would reduce file size even more...)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 10
(5,137 Views)

gerdW,

 

I am still not able to open the attachment posted by the op. I am able to download your attachment though...Smiley Wink

0 Kudos
Message 7 of 10
(5,132 Views)

Lefi,

 

I get 3 particles when i try thresholding (Background correction). And particle analysis. See the attached vi.

 

17529i2B14C447239D9B44

0 Kudos
Message 8 of 10
(5,129 Views)

Dear muks

 

Thank you for showing me your solution. This reminds me that I haven't explained why I want to find the line. In the next step, I want to rotate the line to get it horizontal and then calculate the vertical width of the line. Maybe it is possible to calculate the width without rotating the image, but I haven't found any solution.

 

Anyway, when looking around among the IMAQ functions, I found "IMAQ Detect Lines.vi", but I just got error -1074396080, "IMAQ Detect Shapes
  Invalid image type." The Reference Help doesn't give me much help (which I think is a common problem in LabVIEW), but I suspected that this function can't take I16 images (the help doesn't tell which image format that can be used), so after casting the image to U8, the function works fine. With the returned line coordinates and rotation, it is easy to rotate the line to horizontal and calculate the vertical profile.

0 Kudos
Message 9 of 10
(5,118 Views)

Yes U8 grey scale iamge should work just fine.

0 Kudos
Message 10 of 10
(5,110 Views)