pointstoworld() function error
Show older comments
I calibrated my camera then I wanted to measure the distance from the camera as given in the toolbox documentation which all went fine.
Now when I wanted to use the top left point in the image as a reference for further, I wanted to know its poistion in real world. How come I do not get an error when I set my imagePoints to [0 0] ? The image indexing starts with ones not zeros as far as I know ?
Or the imagePoints here do not refer to the coordinates of the point in the image ?
8 Comments
Florian Morsch
on 2 Jul 2018
Are you asking why you get or why you dont get an error?
"How come I do not get an error when I set my imagePoints to [0 0] ? " Because image points start at X0 Y0, thats why. In image processing, when you have a 800x600 image your image index goes from 0 to 799 and 0 to 599.
Hesham Khalifa
on 30 Jul 2018
Edited: Hesham Khalifa
on 30 Jul 2018
Florian Morsch
on 31 Jul 2018
Maybe this might help you with the understanding: https://de.mathworks.com/help/vision/ref/cameraparameters.pointstoworld.html
If you take a look at the example section, you can see that the worldPoints start at [0 0] and if you set your imagePoints to worldPoints, those also start at [0 0]
Hesham Khalifa
on 31 Jul 2018
Florian Morsch
on 31 Jul 2018
Edited: Florian Morsch
on 31 Jul 2018
Because pixels are always couted from X0 Y0. As i said in a previous comment, if you have a image with a resolution of 800x600 pixel, your start at pixel 0,0 and end at 799,599. The top left pixel is always 0,0 and you start to count your pixels coordinates from there.
In the case of the cameraman.tif, you have a picture with 256x256 pixels. This means you have 256 rows of pixel and 256 collums of pixel. The counting of those pixels however starts with index X0 Y0 and ends with X255 Y255. So the pixel at row 1, collumn 1 (top left pixel) has the pixel coordinate X0 Y0. The pixel at row 256, collumn 256 has the pixel coordinate X255 Y255.
or google "pixel coordinate system". Dont confuse the image size with pixel coordinates, they are not the same.
Hesham Khalifa
on 31 Jul 2018
Florian Morsch
on 31 Jul 2018
Yes, you are correct there. The pixel coordinate 0 0 refers to the matrix element (1, 1).
Hesham Khalifa
on 31 Jul 2018
Answers (0)
Categories
Find more on Camera Calibration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!