Skip to content

Commit

Permalink
new boolean option enablleBlur
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed Mar 20, 2024
1 parent e9c7fb1 commit afac6e7
Show file tree
Hide file tree
Showing 4 changed files with 10 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) {
void WebARKitManager::processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace, bool enableBlur) {
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);
m_tracker->processFrameData(frameData, frameCols, frameRows, colorSpace, enableBlur);
state = DETECTION_RUNNING;
WEBARKIT_LOGd("WebARKitManager::processFrameData() done\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ class WebARKitTracker::WebARKitTrackerImpl {
return true;
}

void processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace) {
void processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace, bool enableBlur) {
cv::Mat grayFrame = convert2Grayscale(frameData, frameCols, frameRows, colorSpace);
cv::blur(grayFrame, grayFrame, blurSize);
if (enableBlur) {
cv::blur(grayFrame, grayFrame, blurSize);
}
buildImagePyramid(grayFrame);
processFrame(grayFrame);
grayFrame.release();
Expand Down Expand Up @@ -441,8 +443,8 @@ void WebARKitTracker::initTracker(uchar* refData, size_t refCols, size_t refRows
_trackerImpl->initTracker<uchar*>(refData, refCols, refRows, colorSpace);
}

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

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);
void processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace, bool enableBlur);

std::vector<double> getOutputData();

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);
void processFrameData(uchar* frameData, size_t frameCols, size_t frameRows, ColorSpace colorSpace, bool enableBlur);

std::vector<double> getOutputData();

Expand Down

0 comments on commit afac6e7

Please sign in to comment.