03-03-2016 05:57 AM
Hi,
I am working on image processing and to find contour I used contour line.vi on a gray image. It is working perfectly and XY graph is displayed properly. But the index are not as per the image matrix index. these are real number with 4 digits after decimal point.
I want the indexs which are on actual image as I have to track back the contour position on real image. How to get it?
Hope someone will come up with some idea.
Thanks..
Sukhiray
03-03-2016 06:13 AM
03-03-2016 07:24 AM
@Hatef.fouladi wrote:
some things exist that you have to regard it
1 image matrix start from top and left
so most top left pixel is (0.0)
also if you want real data you have to calibrate your image first
algorithms that find contours could produce data with fractional value based on algorithms functions
Thank you for your response.
I know that graph and image matrix has different way of indexing and so display gets changed. But index of a pixel value remain unchainged.
My problem is different. Image matrix has index value all integer. But after ploting contour the returned indexes are real number like 370, 370.1423, 370.2435 (say y values) etc. where as in actual image there was only 370 as y value.
Is there any way to get rid of it?
Thanks.
03-03-2016 08:27 AM
could you send some image or vi?
also as i remember data from countour are not just y value
they are x0,y0,x1,y1,.....xn,yn
03-03-2016 03:31 PM
If you send that into some function where you need integer values, you can convert to the data type you need before passing it in, or just pass in the "double" type values and let it coerce them (indicated by the coercion dot).
Hatef correctly stated above that just because your indices are integers, does not mean that the algorithm has to spit out integers. What if you did a simple algorithm, like take the mean, of an array containing the values 1 and 2. Would you expect an integer result, or 1.5?
03-03-2016 08:23 PM - edited 03-03-2016 08:24 PM
@Gregory wrote:If you send that into some function where you need integer values, you can convert to the data type you need before passing it in, or just pass in the "double" type values and let it coerce them (indicated by the coercion dot).
Hatef correctly stated above that just because your indices are integers, does not mean that the algorithm has to spit out integers. What if you did a simple algorithm, like take the mean, of an array containing the values 1 and 2. Would you expect an integer result, or 1.5?
Thanks For your response.
Yes I can change datatype to get integer. But that is introducing some odd errors.
and yes, both of you are right. Though the array if of integer, the computation can return real number. But I am talking about the indixes of the computed pixels. If you calculate contour of an array of binary image and then return the indexes of pixels on contour line, you will see that those are not integer. But in the inpur array there was no fcational location was given. This is what is my confusion.
03-03-2016 08:34 PM
@Hatef.fouladi wrote:could you send some image or vi?
also as i remember data from countour are not just y value
they are x0,y0,x1,y1,.....xn,yn
Hi,
Yes. You are right. It is basically a 2D array of 2 rows and n number of columns.
and in both the rows, there are few indexes which are integer. And finally there is no columns where both indexes are integer.
See the attached file.
Thanks for your support.
03-03-2016 08:53 PM
You can check out "Interpolate 1D Array" if you want to put in a fractional index and get the corresponding (interpolated) value out.
03-05-2016 10:34 PM
Hi
Thank you all for your support.
I did a bit studdy on contour and as per my understanding it is not possible to get integer data from it anyway.
So, I have to think some otherway to gey actual location indexes.
Thanks all for their support and active participation.
03-06-2016 01:00 AM