-
Notifications
You must be signed in to change notification settings - Fork 613
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
Move RawFrame to wpiutil and add function to generate RawFrames of AprilTags #5923
Conversation
What’s the actual use case for this? Simulation? I’d also like to split getting a raw bitmap apart from the OpenCV Mat bits. |
The primary use case is simulation. Being able to access the AprilTags as OpenCV mats allows someone to easily draw them to a screen for visualization. In photonvision the new simulation feature generates a simulated camera feed with apriltags included to feed into the detection algorithm. As for splitting up the bitmap and cv mat stuff, do you mean instead of returning a cv::Mat, you could return a java BufferedImage or even just a byte[]? |
Right; because BufferedImage is AWT we probably wouldn’t use it directly, but we should have a similar class to use across WPILib (cscore has https://github.com/wpilibsuite/allwpilib/blob/main/cscore/src/main/java/edu/wpi/first/cscore/raw/RawFrame.java which could be refactored to wpiutil so it can be used more broadly). And then we could provide a lightweight library to translate that to OpenCV. The ultimate goal here is to remove the direct opencv dependency from WPILib. |
@PeterJohnson Any suggestions or blockers for this PR? |
This fixes a compilation error introduced by wpilibsuite#5923.
This fixes a compilation error introduced by #5923.
This fixes a compilation error introduced by wpilibsuite#5923.
Needed after wpilibsuite/allwpilib#5923
Per discussion on the FRC discord, users should be able to easily generate an OpenCV Mat of the two AprilTag families used in FRC. I tested it on my PC and it generated the images properly in Java and C++.
I am unfamiliar with how people usually use OpenCV Mats in Java, but I think you would have to call .release() on the mat returned from the methods.
Not sure the best way to add a test for this...