From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect dark 'needle' on light background (360°)

Solved!
Go to solution

I have acces to the computer with LabVIEW and the pictures next monday, so I can upload some pictures then. It is the entire bar that rotates, I thought maybe it is possible to measure the position halfway the bar where he is straight, so the results will be almost the same at the different points. 

0 Kudos
Message 11 of 27
(4,138 Views)

(halfway the thick part (thats the important part)) You can't see it on this photo, but the end of the bar deviate if he rotates.

0 Kudos
Message 12 of 27
(4,138 Views)

So it is more like the needle on a dial?  That is much simpler than what you described before.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 13 of 27
(4,136 Views)
It isn't really an needle, but it looks like it, also, you have to add different 'needles' to measure, so the one time he's something crooked and maybe longer than other time. Per set pictures he is about the same. Its hard to explain, especially because i don't speak that good english:)(you probably noticed) I thought maybe I can make many rectangles in a circle, and if the red part is above one of the rectangles ,he detects it so you have an number, because I define every rectangle as a number. The main problem is that i only know a few basics of labview.
0 Kudos
Message 14 of 27
(4,134 Views)

This are the pictures of one set, before the treshold.

0 Kudos
Message 15 of 27
(4,121 Views)

Some more..

0 Kudos
Message 16 of 27
(4,121 Views)

I would recommend using the threshold the way you are now.  Use IMAQ Particle to find the center of the red object.  Subtract the center of rotation (select using mouse) to get the relative position of the center of the object.  Use atan2 to get the angle of the needle.

 

This isn't going to be exact, but it should work pretty well.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 17 of 27
(4,055 Views)
Thanks, i will give it a try next wednesday!
Message 18 of 27
(4,043 Views)
Solution
Accepted by topic author henk_kempen

It totally worked!!, many thanks, I did it with the combination edge detection and treshold, see the attached images.

Just one more question, is there an way to add a scale to the picture, so you can visually check the position of the 'needle'?

 

 

Message 19 of 27
(3,917 Views)

Anyone?

0 Kudos
Message 20 of 27
(3,862 Views)