Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Fit a line passing by every center of mass

Hello

 

I have a picture that I go to an array to work on each column of this image (indexes 0-1023).  

My goal is to find the center of mass of each column index 0-1023 then draw a line through all the centers of mass. Thus I want to retrieve points from 0-1023 abscissa and Y coordinates corresponding to each center of mass of each column.
 

 

I can actually do it when it's for a particular column but when I use my for loop to scan all the columns, I get an error. It seems like it does not want to work on the edges but I'm not sure.

 

If you need more I can send a VI


Thanks

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

Please attach a screen shot of your vi and also the image that you are reffereing .

0 Kudos
Message 2 of 6
(3,667 Views)

Hello

Please find enclosed the screenshot and the picture.

 

Thanks

Download All
0 Kudos
Message 3 of 6
(3,654 Views)

It's the for loop which doesn't work particularly the peak detector function which display an error message saying " You supplied an insufficient number of points to perform this operation." !

0 Kudos
Message 4 of 6
(3,653 Views)

Hello,

 

What do you have the Width input set to? From the help file, "Width specifies the number of consecutive data points to use in the quadratic least-squares fit. Width must be greater than or equal to 3 but should be no larger than one-fourth of the approximate width of the peaks or valleys. Large widths can reduce the apparent amplitude of peaks and shift the apparent location. The less noise your data has, the smaller the value you can choose." Therefore, if you have the width impropely set for your samples, you could get the error you describe.

 

-Zach

0 Kudos
Message 5 of 6
(3,623 Views)

 

Actually I have found a way to solve my problem.It was a problem of reference in an image and I fixed it.

 

Thanks

 

0 Kudos
Message 6 of 6
(3,620 Views)