Skip to content

Commit

Permalink
new example with jsfeatNext
Browse files Browse the repository at this point in the history
- bunch of debug logs
- removing enableBlur bool variable because not necessary anymore (commit files previously missed)
  • Loading branch information
kalwalt committed Sep 14, 2024
1 parent 82c08b6 commit 77b2029
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions WebARKit/WebARKitManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ bool WebARKitManager::shutdown() {
return true;
};

void WebARKitManager::processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace, BLUR_TYPE blurType, bool enableBlur) {
void WebARKitManager::processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace, BLUR_TYPE blurType) {
WEBARKIT_LOGd("WebARKitManager::processFrameData(...)\n");
if (state < WAITING_FOR_VIDEO) {
WEBARKIT_LOGe("processFrameData called without init the tracker. Call first initTracker.\n");
Expand All @@ -88,7 +88,7 @@ void WebARKitManager::processFrameData(uchar* frameData, size_t frameCols, size_
WEBARKIT_LOGe("Error initialising processFrameData.\n");
//return false;
}
m_tracker->processFrameData(frameData, frameCols, frameRows, colorSpace, blurType, enableBlur);
m_tracker->processFrameData(frameData, frameCols, frameRows, colorSpace, blurType);
state = DETECTION_RUNNING;
WEBARKIT_LOGd("WebARKitManager::processFrameData() done\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,13 @@ class WebARKitTracker::WebARKitTrackerImpl {
assert(grayImage.channels() == 1);

this->_featureDetector->detect(grayImage, keypoints, featureMask);
WEBARKIT_LOGd("keypoints size: %d\n", keypoints.size());
if (keypoints.empty()) {
WEBARKIT_LOGe("No keypoints detected!\n");
return false;
}
this->_featureDescriptor->compute(grayImage, keypoints, descriptors);
WEBARKIT_LOGd("descriptors size: %d\n", descriptors.size());
if (descriptors.empty()) {
WEBARKIT_LOGe("No descriptors computed!\n");
return false;
Expand All @@ -155,7 +157,7 @@ class WebARKitTracker::WebARKitTrackerImpl {
}

void processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace,
BLUR_TYPE blurType, bool enableBlur) {
BLUR_TYPE blurType) {
cv::Mat grayFrame = convert2Grayscale(frameData, frameCols, frameRows, colorSpace);
if (blurType == BLUR_TYPE::BOX_BLUR) {
cv::blur(grayFrame, grayFrame, blurSize);
Expand Down Expand Up @@ -347,7 +349,7 @@ class WebARKitTracker::WebARKitTrackerImpl {
// return false;
};
//if (!_isDetected) {
WEBARKIT_LOGd("frameKeyPts.size() = %d\n", frameKeyPts.size());
WEBARKIT_LOGd("frame KeyPoints size: %d\n", frameKeyPts.size());
if (static_cast<int>(frameKeyPts.size()) > minRequiredDetectedFeatures) {
MatchFeatures(frameKeyPts, frameDescr);
}
Expand Down Expand Up @@ -793,8 +795,8 @@ void WebARKitTracker::initTracker(uchar* refData, size_t refCols, size_t refRows
}

void WebARKitTracker::processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace,
BLUR_TYPE blurType,bool enableBlur) {
_trackerImpl->processFrameData(frameData, frameCols, frameRows, colorSpace, blurType, enableBlur);
BLUR_TYPE blurType) {
_trackerImpl->processFrameData(frameData, frameCols, frameRows, colorSpace, blurType);
}

std::vector<double> WebARKitTracker::getOutputData() { return _trackerImpl->getOutputData(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WebARKitTracker {

void initTracker(uchar* refData, size_t refCols, size_t refRows, ColorSpace colorSpace);

void processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace, BLUR_TYPE blurType, bool enableBlur);
void processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace, BLUR_TYPE blurType);

std::vector<double> getOutputData();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,21 @@ static auto convert2Grayscale(uchar* refData, size_t refCols, size_t refRows, Co
cv::Mat colorFrame(refRows, refCols, CV_8UC4, refData);
refGray.create(refRows, refCols, CV_8UC1);
cv::cvtColor(colorFrame, refGray, cv::COLOR_RGBA2GRAY);
WEBARKIT_LOGd("convert to GRAY from RGBA !!\n");
} break;
case ColorSpace::RGB: {
cv::Mat colorFrame(refRows, refCols, CV_8UC3, refData);
refGray.create(refRows, refCols, CV_8UC1);
cv::cvtColor(colorFrame, refGray, cv::COLOR_RGB2GRAY);
WEBARKIT_LOGd("convert to GRAY from RGB !!\n");
} break;
case ColorSpace::GRAY: {
refGray = cv::Mat(refRows, refCols, CV_8UC1, refData);
WEBARKIT_LOGd("no need to convert to GRAY!!\n");
} break;
default: {
refGray = cv::Mat(refRows, refCols, CV_8UC1, refData);
WEBARKIT_LOGd("Default: no need to convert to GRAY!!\n");
}
}

Expand Down
2 changes: 1 addition & 1 deletion WebARKit/include/WebARKitManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class WebARKitManager {

bool shutdown();

void processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace, BLUR_TYPE blurType, bool enableBlur);
void processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace, BLUR_TYPE blurType);

std::vector<double> getOutputData();

Expand Down

0 comments on commit 77b2029

Please sign in to comment.