plotoptix icon indicating copy to clipboard operation
plotoptix copied to clipboard

Camera module

Open asd33015 opened this issue 3 years ago • 8 comments

Good day, Could the project support the opencv camera module (i.e., camera matrix and distortion module) to save the image? Thanks for help.

Best Regards

asd33015 avatar Feb 09 '23 10:02 asd33015

Hi,

I can look into this. The implementation could use distortion coefficients and camera intrinsic parameters in the camera shader. Performace overhead should be rather minimal, I think.

Can you share your use case? It is always helpful for development.

Thanks!

robertsulej avatar Feb 11 '23 18:02 robertsulej

Thank you very much for your help!

Yes, I can share my case. The thing I would like to implement is that importing a textured 3D mesh and rendering it with HDRI background. Additionally, I can set up various cameras to show the results in different views.

Thanks for help again. Best Regards.

asd33015 avatar Feb 13 '23 02:02 asd33015

Hi,

May I ask how to implement the camera shader of OpenCV that I mentioned above?

Thanks for help. Best Regards.

asd33015 avatar Feb 21 '23 15:02 asd33015

I have to add it on my side. I should have a time slot to do this over the weekend. Then I'll cut the new release together with a few other improvements - I'll let you know here when it is ready.

robertsulej avatar Feb 21 '23 17:02 robertsulej

I added intrinsics matrix to camera setup and update. Example is here. It is still on the brach since I am trying to find an efficient method to calculate distort map to include distortion coefficients (undistort is easy, but inverse covering full view with no missing spots - need figure it out).

robertsulej avatar Mar 12 '23 18:03 robertsulej

I added intrinsics matrix to camera setup and update. Example is here. It is still on the brach since I am trying to find an efficient method to calculate distort map to include distortion coefficients (undistort is easy, but inverse covering full view with no missing spots - need figure it out).

Thank you so much for taking the time to respond to my query. I look forward to using the features and functions in the future!

Best Regards.

asd33015 avatar Mar 22 '23 03:03 asd33015

Hi robertsulej,

Could I use the intrinsic parameters with pixel unit for the rendering the image if I can't get the sensor height and other variables with mm unit? Thank you so much for taking the time to implement the utilities !

Best Regards.

asd33015 avatar Jul 18 '23 06:07 asd33015

Sure, it is all relative calculations and you can assume 1 px = 1 mm, and then set sensor height to the image height (note that fx and fy in the camera matrix will need to be updated accordingly if object sizes and locations are not changed).

I also checked again these functions and found error in cx calculations. Fixes are now pushed to master branch.

robertsulej avatar Jul 20 '23 16:07 robertsulej