Skip to content

Commit

Permalink
pinball image is 3 channels add support for this type to initTracker
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed Nov 10, 2023
1 parent fe46f86 commit f6dfcbc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,16 @@ class WebARKitTracker::WebARKitTrackerImpl {
cv::Mat colorFrame(refRows, refCols, CV_8UC4, refData);
refGray.create(refRows, refCols, CV_8UC1);
cv::cvtColor(colorFrame, refGray, cv::COLOR_RGBA2GRAY);
} else if (colorSpace == ColorSpace::RGB ) {
cv::Mat colorFrame(refRows, refCols, CV_8UC3, refData);
refGray.create(refRows, refCols, CV_8UC1);
cv::cvtColor(colorFrame, refGray, cv::COLOR_RGB2GRAY);
} else if (colorSpace == ColorSpace::GRAY) {
refGray = cv::Mat(refRows, refCols, CV_8UC1, refData);
}

WEBARKIT_LOGi("Gray data ok!\n");

//cv::Mat refGray(refRows, refCols, CV_8UC1, refData);

cv::Mat trackerFeatureMask = createTrackerFeatureMask(refGray);
Expand Down
4 changes: 2 additions & 2 deletions tests/webarkit_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ TEST(WebARKitTest, InitTrackerTest) {
// Init the manager with the Akaze tracker
manager.initialiseBase(webarkit::TRACKER_TYPE::AKAZE_TRACKER, 640, 480);
// Load the test image
cv::Mat image = cv::imread("../pinball.jpg");
cv::Mat image = cv::imread("../pinball.jpg", cv::IMREAD_UNCHANGED);

if(image.data == NULL) {
std::cout << "Something wrong while reading the image!" << std::endl;
Expand All @@ -178,7 +178,7 @@ TEST(WebARKitTest, InitTrackerTest) {
EXPECT_EQ(image.cols, 1637);
EXPECT_EQ(image.rows, 2048);
// Check if initTracker returns sucessfully
EXPECT_TRUE(manager.initTracker(data, width, height, webarkit::ColorSpace::RGBA));
EXPECT_TRUE(manager.initTracker(data, width, height, webarkit::ColorSpace::RGB));
}

// Check WebARKit version
Expand Down

0 comments on commit f6dfcbc

Please sign in to comment.