openMVS
openMVS copied to clipboard
error of image center position or image scale
I have images, pointclouds and camera trajectory. Then I generate a mvs file by calling "interface.h". But all image center points (green) do not at the center of their rectangle region.
I only have one camera. So I set
camera.K = intrinsic_mat;
camera.R = Interface::Mat33d::eye();
camera.C = Interface::Pos3d(0, 0, 0);
then I set N poses for N images as follows:
pose.R = R;
pose.C = -R.t()*t;
where R and t are from transformation matrix (4x4, from World coordinate to Camera coordinate)
The camera trajectory and pointcloud in Viewer looks good, but the image center or image scale must be wrong.
I cannot find the bug. Did I make a mistake at any step or miss any parameter?"
Do you set the image resolution in the one camera you initialized?
Are you sure you set the pose correctly? Inn the screenshot i see only the cameras and not the point cloud.
I hide the point-cloud in Viewer in order to see the green points clearly.
And yes, I set
camera.width = img_w;
camera.height = img_h;
double fScale = (double)1 / double(max(img_w, img_h));
but fx, fy, cx, cy in camera.K are all divided by fScale.
So width and height parameter are optional when K is normalized (as mentioned in "Interface.h")
I enable the visualization for point-cloud now. the cloud and camera poses looks correct. But all image centers are wrong. (Or the image center is correct but the scale of image(view) is wrong. I don't know.)
no need to normalize if you set the width and h, pls try that
I comment the normalization part and remain camera.width, camera.height and camera.K.
then re-generate mvs file.
in Viewer, (we hide point cloud)
it looks camera's size become 0
Strange. You can put a break point where the MVS scene you generate is read, and check that you get the values you expect.
Strange. You can put a break point where the MVS scene you generate is read, and check that you get the values you expect.
@cdcseacave
in this line :
if (!scene.Load(fileName, true))
I found camera.K(0,2) and camera.K(1,2) in "scene.images._vector.camera.K.val" is NOT equal to that of "scene.platforms._vector.cameras._vector.K.val", i.e. principal point value, why?
depends, is K in platforms normalized? do you change the resolution? simplest set K in platforms not normalized, set width and height too, and use the same resolution when u use it
no need to normalize if you set the width and h, pls try that
I found that it's caused by normalization of K. No need to normalize K.
Strange. You can put a break point where the MVS scene you generate is read, and check that you get the values you expect.
This bug is caused by my fault. I called "ARCHIVE::SerializeSave" but set the "version" parameter to 0 which stop the serialization of camera size. Just remove it to use the default value.
depends, is K in platforms normalized? do you change the resolution? simplest set K in platforms not normalized, set width and height too, and use the same resolution when u use it
Many thanks for your help! @cdcseacave