Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The camera intrinsic [cx] and [cy] is useless in this demo. #4

Open
qpc001 opened this issue Apr 26, 2022 · 8 comments
Open

The camera intrinsic [cx] and [cy] is useless in this demo. #4

qpc001 opened this issue Apr 26, 2022 · 8 comments

Comments

@qpc001
Copy link

qpc001 commented Apr 26, 2022

The camera intrinsic [cx] and [cy] is useless in this demo.

@pablospe
Copy link
Owner

It is used in the intrinsic, see the K matrix in this function, for instance:

def draw_camera(K, R, t, width, height, scale=1, color=None):

Or what do you mean exactly?

@qpc001
Copy link
Author

qpc001 commented Apr 28, 2022

它用于内在函数,参见此函数中的 K 矩阵,例如:

def draw_camera(K, R, t, width, height, scale=1, color=None):

或者你到底是什么意思?

I mean , the (.capture_depth) or (capture_screen) is still using the intrinsic [ width, height, fx, fy , width/2 , height/2], not the [ width, height, fx, fy , cx , cy].

Here is the same issue : [https://github.com/isl-org/Open3D/issues/3079]

@pablospe
Copy link
Owner

pablospe commented May 2, 2022

Do you mean this:
https://github.com/pablospe/Open3D/blob/0728214089c2f149e522b3b81006067753a899ad/cpp/open3d/visualization/visualizer/ViewControl.cpp#L172-L173
?

    intrinsic.intrinsic_matrix_(0, 2) = (double)window_width_ / 2.0 - 0.5;
    intrinsic.intrinsic_matrix_(1, 2) = (double)window_height_ / 2.0 - 0.5;

@qpc001
Copy link
Author

qpc001 commented May 2, 2022

I mean the following code block:

https://github.com/pablospe/Open3D/blob/0728214089c2f149e522b3b81006067753a899ad/cpp/open3d/visualization/visualizer/ViewControl.cpp#L196

if (!allow_arbitrary && (window_height_ <= 0 || window_width_ <= 0 ||
                             window_height_ != intrinsic.height_ ||
                             window_width_ != intrinsic.width_ ||
                             intrinsic.intrinsic_matrix_(0, 2) !=
                                     (double)window_width_ / 2.0 - 0.5 ||
                             intrinsic.intrinsic_matrix_(1, 2) !=
                                     (double)window_height_ / 2.0 - 0.5)) {
        utility::LogWarning(
                "[ViewControl] ConvertFromPinholeCameraParameters() failed "
                "because window height and width do not match.");
        return false;
    }

the flag "allow_arbitrary" doesn't change the camera intrinsic value about "cx" and "cy". As a result, the function (.capture_depth) 或 (capture_screen) is still using the intrinsic [ width, height, fx, fy , width/2 , height/2].

@Rashfu
Copy link

Rashfu commented Nov 8, 2023

Hi @pablospe ! I met with the same problem.

If I change the cx or cy of intrinsic_matrix in view_point.json, the rendered image doesn't change with cx or cy. Logically, when I increase cx, the rendered image should shift to the right by the according pixel distance. However, the open3D returned the same images with different cx.

It means that the visualizer of open3D still uses the intrinsic [ width, height, fx, fy , width/2 , height/2] instead of [ width, height, fx, fy , cx , cy] that I specify.

@pablospe
Copy link
Owner

pablospe commented Nov 9, 2023

One would need to debug the Open3D viewer to find the problem and see where is set to width/2 , height/2.

I had some problems with Open3D viewer so I tried to replicate this code using pyvista (VTK backend), in this branch:
https://github.com/pablospe/render_depthmap_example/tree/pyvista
Maybe you want to give a try to this branch to avoid flighting with Open3D viewer.

@pablospe
Copy link
Owner

pablospe commented Nov 9, 2023

Another alternative:
https://github.com/cvg/raybender
(see the demo: https://github.com/cvg/raybender/blob/main/examples/demo.py)

@Rashfu
Copy link

Rashfu commented Nov 9, 2023

Thank you for your prompt response. I will give it a try ! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants