Skip to content

Allow partial observations and remove dependence on OpenCV Mat types - #28

Merged
mcm001 merged 3 commits into
PhotonVision:mainfrom
thatcomputerguy0101:partial-observations
Jul 13, 2026
Merged

Allow partial observations and remove dependence on OpenCV Mat types#28
mcm001 merged 3 commits into
PhotonVision:mainfrom
thatcomputerguy0101:partial-observations

Conversation

@thatcomputerguy0101

@thatcomputerguy0101 thatcomputerguy0101 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Part of my refactor to improve the handling of OpenCV's Mats in PhotonVision/photonvision#2511, this pushes the responsibility for conversion to arrays onto the caller so that this library doesn't have to deal with Mats. Also, this takes on the responsibility of skipping unobserved points, allowing the observation mats to be immutable. By accepting an iterator here, the amount of data loaded into memory at once can be reduced for highly repetitive data like levels.

@thatcomputerguy0101
thatcomputerguy0101 marked this pull request as ready for review June 18, 2026 19:35
Comment thread src/main/java/org/photonvision/mrcal/MrCalJNI.java
Comment thread src/main/java/org/photonvision/mrcal/MrCalJNI.java Outdated
Co-authored-by: Matt Morley <matthew.morley.ca@gmail.com>
@mcm001
mcm001 merged commit b65c352 into PhotonVision:main Jul 13, 2026
5 of 9 checks passed
mcm001 added a commit to PhotonVision/photonvision that referenced this pull request Jul 29, 2026
## Description

This fixes the many native memory leaks of OpenCV's matrixes. While I
can't guarantee I got everything, it is substantially better than it
was. The test results are now a lot cleaner. ~~Blocked on
PhotonVision/mrcal-java#28.~~

## Meta

Merge checklist:
- [x] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [x] The description documents the _what_ and _why_, including events
that led to this PR
- [ ] If this PR changes behavior or adds a feature, user documentation
is updated
- [ ] If this PR touches photon-serde, all messages have been
regenerated and hashes have not changed unexpectedly
- [ ] If this PR touches configuration, this is backwards compatible
with all settings going back to the previous seasons's last release
(seasons end after champs ends)
- [ ] If this PR touches pipeline settings or anything related to data
exchange, the frontend typing is updated
- [ ] If this PR addresses a bug, a regression test for it is added
- [ ] If this PR adds a dependency, the license has been checked for
compatibility and steps taken to follow it

---------

Co-authored-by: Matt Morley <matthew.morley.ca@gmail.com>
Bobcat66 pushed a commit to Bobcat66/photonvision that referenced this pull request Jul 30, 2026
This fixes the many native memory leaks of OpenCV's matrixes. While I
can't guarantee I got everything, it is substantially better than it
was. The test results are now a lot cleaner. ~~Blocked on
PhotonVision/mrcal-java#28.~~

Merge checklist:
- [x] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [x] The description documents the _what_ and _why_, including events
that led to this PR
- [ ] If this PR changes behavior or adds a feature, user documentation
is updated
- [ ] If this PR touches photon-serde, all messages have been
regenerated and hashes have not changed unexpectedly
- [ ] If this PR touches configuration, this is backwards compatible
with all settings going back to the previous seasons's last release
(seasons end after champs ends)
- [ ] If this PR touches pipeline settings or anything related to data
exchange, the frontend typing is updated
- [ ] If this PR addresses a bug, a regression test for it is added
- [ ] If this PR adds a dependency, the license has been checked for
compatibility and steps taken to follow it

---------

Co-authored-by: Matt Morley <matthew.morley.ca@gmail.com>
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.

2 participants