mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
[photon-lib] Fix incorrect tag visualization transforms (#1899)
## Description Fixes #1239 Tag image corners used in `VideoSimUtil` did not match the expected corner order returned by the detection pipeline of [BL, BR, TR, TL], causing the tag image to appear flipped. ## 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_ - [x] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR addresses a bug, a regression test for it is added
This commit is contained in:
@@ -84,14 +84,16 @@ public class VideoSimUtil {
|
||||
* through a Mat, the point (0,0) actually represents the center of the top-left pixel and not the
|
||||
* actual top-left corner.
|
||||
*
|
||||
* <p>Order of corners returned is: [BL, BR, TR, TL]
|
||||
*
|
||||
* @param size Size of image
|
||||
*/
|
||||
public static Point[] getImageCorners(Size size) {
|
||||
return new Point[] {
|
||||
new Point(-0.5, -0.5),
|
||||
new Point(size.width - 0.5, -0.5),
|
||||
new Point(-0.5, size.height - 0.5),
|
||||
new Point(size.width - 0.5, size.height - 0.5),
|
||||
new Point(-0.5, size.height - 0.5)
|
||||
new Point(size.width - 0.5, -0.5),
|
||||
new Point(-0.5, -0.5)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -76,10 +76,10 @@ static std::unordered_map<int, cv::Mat> LoadAprilTagImages() {
|
||||
|
||||
static std::vector<cv::Point2f> GetImageCorners(const cv::Size& size) {
|
||||
std::vector<cv::Point2f> retVal{};
|
||||
retVal.emplace_back(cv::Point2f{-0.5f, -0.5f});
|
||||
retVal.emplace_back(cv::Point2f{size.width - 0.5f, -0.5f});
|
||||
retVal.emplace_back(cv::Point2f{size.width - 0.5f, size.height - 0.5f});
|
||||
retVal.emplace_back(cv::Point2f{-0.5f, size.height - 0.5f});
|
||||
retVal.emplace_back(cv::Point2f{size.width - 0.5f, size.height - 0.5f});
|
||||
retVal.emplace_back(cv::Point2f{size.width - 0.5f, -0.5f});
|
||||
retVal.emplace_back(cv::Point2f{-0.5f, -0.5f});
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user