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

Move RawFrame to wpiutil and add function to generate RawFrames of AprilTags #5923

Merged
merged 6 commits into from Nov 23, 2023

Conversation

r4stered
Copy link
Contributor

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...

@r4stered r4stered requested a review from a team as a code owner November 13, 2023 21:14
@PeterJohnson
Copy link
Member

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.

@r4stered
Copy link
Contributor Author

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[]?

@PeterJohnson
Copy link
Member

PeterJohnson commented Nov 14, 2023

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.

@r4stered r4stered requested review from PeterJohnson and a team as code owners November 15, 2023 16:27
@r4stered r4stered changed the title Add ability to generate opencv mat of apriltags Move RawFrame to wpiutil and add function to generate RawFrames of AprilTags Nov 15, 2023
@r4stered
Copy link
Contributor Author

@PeterJohnson Any suggestions or blockers for this PR?

@PeterJohnson PeterJohnson merged commit ca81ced into wpilibsuite:main Nov 23, 2023
24 checks passed
calcmogul added a commit to calcmogul/allwpilib that referenced this pull request Nov 23, 2023
This fixes a compilation error introduced by wpilibsuite#5923.
PeterJohnson pushed a commit that referenced this pull request Nov 23, 2023
This fixes a compilation error introduced by #5923.
Starlight220 pushed a commit to Starlight220/allwpilib that referenced this pull request Dec 1, 2023
Starlight220 pushed a commit to Starlight220/allwpilib that referenced this pull request Dec 1, 2023
sciencewhiz added a commit to sciencewhiz/shuffleboard that referenced this pull request Dec 3, 2023
PeterJohnson pushed a commit to wpilibsuite/shuffleboard that referenced this pull request Dec 3, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants