Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

medium profile line

Hello. I have a small issue. The situation is: I have an image [a cylindrical shaft]. I made a picture to it using a digital camera using backlight. The problem is that when I apply a Threshold the profile of the part becomes jagged.

Now what i need is a way to perform a linear fit or some other function in order to obtain a profile line which i could use further to measure the dimensions of the part.

 

 

Andrei

0 Kudos
Message 1 of 6
(3,974 Views)

Hi Andrei:

 

Not really sure what the problem is.  Can you post the images you are using so we can see what you're talking about?  Also, are you doing the thresholding in LabVIEW?

Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 2 of 6
(3,947 Views)

Hi mr. Person

Thank you for the reply.

 

I forgot to attach some images, my bad 😞 . I use threshold function in vision assistant. I am also attaching the script.

My problem is that when I apply the threshold the profile of the line is not straight, it has some pixels in certain areas which make the line profile a little bit jagged. I have to measure the dimensions of the part. I used a 6Mpx DSLR camera to achieve a verry good precision.

The images are basically the same. I have five parts but the difference between them is small.

 

Andrei

 

 

Message Edited by Sajuuk on 05-11-2009 01:29 PM
Download All
0 Kudos
Message 3 of 6
(3,943 Views)

Hi Andrei:

 

I see what you're saying.  The first thing I would start with is to make sure your screen is clean in the background.  It looks like there are some spots there that are causing some unevenness on the edges.

 

 The next thing you can do is an erode and then a dilate function found under Gray Morphology.  You can then finish it off with an FFT Truncate filter.  This will smooth it out quite a bit more but also rounds the corners which may or may not work for your application.

 

 I guess my final question is how smooth does this need to be?  I think it's pretty unlikely that you'll get the edges perfectly smooth and you probably don't need them to be.  Try measuring it with a clamp function (or whatever) and see if it's accurate enough for your application.

Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 4 of 6
(3,933 Views)

Hello, mr Person

 

I need to measure the part within a +0.2 mm interval.

I tried the steps you indicated but when I try to use the algorithm on another image I get bad readings.

I was thinking to use a linear fit on the image by using the least squares [i hope i remembered correctly] to obtain the medium profile line. Is it possible to do so ? And if so do I need to separate each segment of the part profile and then reassemble it ?

 

Andrei

0 Kudos
Message 5 of 6
(3,924 Views)
Have you done the calculations on your setup as found here to ensure that you will be able to even get that resolution?  Keep in mind you will need one 10 pixels/mm to get that kind of measurement.
Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 6 of 6
(3,902 Views)