pointstoworld() function error

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 件のコメント

Florian Morsch
Florian Morsch 2018 年 7 月 2 日
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
Hesham Khalifa 2018 年 7 月 30 日
編集済み: Hesham Khalifa 2018 年 7 月 30 日
image= imread('cameraman.tif')
now image is 2D matrix where the indexing starts from 1 to 256.
If i try to access the top left point of the image I would type image(1,1) not image(0,0) or Do I understand all wrong ?
Florian Morsch
Florian Morsch 2018 年 7 月 31 日
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
Hesham Khalifa 2018 年 7 月 31 日
my world point [0 0] is the top left corner of the checkerboard. These are mapped by the imagePoints. The images points are the pixel locations where the checkerboard corners detected in the 2D image. for Example worldPoint [0 0] corresponds to image point [475 571] ( this is the pixel location of this world point in the image). So, it is still confusing for me how you can put [0 0] for the ''image'' as I referred in my previous comment
Florian Morsch
Florian Morsch 2018 年 7 月 31 日
編集済み: Florian Morsch 2018 年 7 月 31 日
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
Hesham Khalifa 2018 年 7 月 31 日
Thanks. but just to make sure that I got you right in case of the camrea man example my pixel coordinate X0 Y0 corresponds to image(1,1) right ?
I think my mistake was I treated the pixel coordinate system is the same as the image as a matrix
Florian Morsch
Florian Morsch 2018 年 7 月 31 日
Yes, you are correct there. The pixel coordinate 0 0 refers to the matrix element (1, 1).
Hesham Khalifa
Hesham Khalifa 2018 年 7 月 31 日
Thanks !

サインインしてコメントする。

回答 (0 件)

カテゴリ

質問済み:

2018 年 6 月 28 日

コメント済み:

2018 年 7 月 31 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by