Skip to content

Commit

Permalink
Fixed issue with conversion of raw frame to cv mat
Browse files Browse the repository at this point in the history
  • Loading branch information
r4stered committed Dec 28, 2023
1 parent 05a231b commit 6b53449
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static Point[] getImageCorners(Size size) {
*/
public static Mat get36h11TagImage(int id) {
RawFrame frame = AprilTag.generate36h11AprilTagImage(id);
Mat result = new Mat(10, 10, CvType.CV_8UC1, frame.getData());
Mat result = new Mat(10, 10, CvType.CV_8UC1, frame.getData(), frame.getStride());
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ static constexpr units::meter_t fieldWidth{8.0137_m};
static cv::Mat Get36h11TagImage(int id) {
wpi::RawFrame frame;
frc::AprilTag::Generate36h11AprilTagImage(&frame, id);
cv::Mat markerImage{frame.height, frame.width, CV_8UC1, frame.data};
cv::Mat markerImage{frame.height, frame.width, CV_8UC1, frame.data,
static_cast<size_t>(frame.stride)};
cv::Mat markerClone = markerImage.clone();
return markerClone;
}
Expand Down

0 comments on commit 6b53449

Please sign in to comment.