Convert pixel to points in world coordinates
I have used color in range to mask my photo to pic out the colored stripes. I wish to find the position of the colored stripes in world coordinates. I know the approx height of the colored stripes above the camera, and I assume stripes are near horizontal. A = 2690 – mm distance to bottom stripe B = 4380 – mm distance to middle stripe C = 5670 – mm distance to top stripe I am new to image processing and OpenCV I wondered if there are any functions which can convert pixels to position?
I don't understand anything. What kind of image is it? Some kind of LIDAR? What is your data?
Anyway, if it's LIDAR or other depth camera, you'd rather use the raw point cloud instead of projecting it to an image and try something with OpenCV. Especially if you need the spatial information. For point cloud processing there is the PCL library.
If you are using a 2D photo, you need a precise camera position to be able to get the world coordinates.
Hi, Sorry for not being clear this is just a 2D photo and i do have relative precise camera position
Can you post orignal image?
Now attached
Ok, it's more clear now. Anyway, this is not an easy problem. Not because it's difficult to detect those stripes, but because from this shallow angle the slightest error will have important incidence on the result.
I would try a SIFT keypoint detection and matching between the captured image and the photo of the sail, then find the position and angle from the estimated homography matrix. The position still needs to be transformed in real life coordinates.
Anyway, as I said, probably the error will be too important for a precise positioning of the sail. You should also think about another solution.