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

OpenCV Fisheye Camera Functions Missing #1185

Closed
calvertdw opened this issue Jun 3, 2022 · 9 comments
Closed

OpenCV Fisheye Camera Functions Missing #1185

calvertdw opened this issue Jun 3, 2022 · 9 comments

Comments

@calvertdw
Copy link
Contributor

calvertdw commented Jun 3, 2022

The "undistort" function is missing:

https://docs.opencv.org/3.4/da/d54/group__imgproc__transform.html#ga69f2545a8b62a6b0fc2ee060dc30559d

and the fisheye functions:
https://docs.opencv.org/4.5.5/db/d58/group__calib3d__fisheye.html

Edit: I renamed this issue to be more general about needing functions relating to fisheye cameras. We are trying to accelerate our new Fisheye camera on our robot with OpenCV 🙂

@calvertdw calvertdw changed the title OpenCV imgproc is missing undistort OpenCV Fisheye Camera Functions Missing Jun 3, 2022
@calvertdw
Copy link
Contributor Author

Oh well that's great news! Thank you. I was expecting them to be in imgproc.

@calvertdw
Copy link
Contributor Author

I finally got around to using these and I'm finding that the fisheye functions are missing the helper types, for instance the calibrate method has MatVector objectPoints instead of Point3fVectorVector objectPoints. This can be worked around but is not ideal. The pinhole model methods have the helper types, i.e. in calibrateCamera.

@calvertdw calvertdw reopened this Jan 26, 2023
@saudet saudet added the bug label Jan 27, 2023
@saudet
Copy link
Member

saudet commented Jan 27, 2023

Right, that's easy enough to fix, see commit 86a78a6.
Please give it a try with the snapshots: http://bytedeco.org/builds/

@calvertdw
Copy link
Contributor Author

calvertdw commented Jan 31, 2023

Wow, thanks! I'll give it a shot. My code can be simpler now.

However, I think I ran into another issue. It seems that by chance the fisheye and non-fisheye method for calibrate and undistort are different. cv::fisheye has calibrate and undistortImage and calib3d (for pinhole/perspective cameras) has calibrateCamera and undistort. However, the functions for initUndistortRectifyMap have the same signature and the fisheye version is not accessible in the preset. The fisheye undistortImage was not working for me, see the weird trianglar output below. I was going to break it down into initUndistortRectifyMap and remap when I noticed the missing method.

Is it hard to fix? @ds58 or myself can try to fix, though some pointers might help. 😄

image
The code

@calvertdw
Copy link
Contributor Author

I guess we could add something like

.put(new Info("cv::fisheye::initUndistortRectifyMap").javaText(
                        "@Namespace(\"cv::fisheye\") public static native void initUndistortRectifyMap
                        ...

@calvertdw
Copy link
Contributor Author

calvertdw commented Jan 31, 2023

Okay I did fix my issue with cv::fisheye::undistortImage. I was not calling estimateNewCameraMatrixForUndistortRectify first.
image

@saudet
Copy link
Member

saudet commented Jan 31, 2023

I guess we could add something like

.put(new Info("cv::fisheye::initUndistortRectifyMap").javaText(
                        "@Namespace(\"cv::fisheye\") public static native void initUndistortRectifyMap
                        ...

If we don't need to change anything but the name, it's easier using Info.javaNames:
https://github.com/bytedeco/javacpp/wiki/Mapping-Recipes#specifying-names-to-use-in-java

@saudet
Copy link
Member

saudet commented Jun 6, 2023

Version 1.5.9 has been released with the fixes! Thanks for contribution

@saudet saudet closed this as completed Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants