Skip to content

Commit

Permalink
better code for pointers but not solve issue
Browse files Browse the repository at this point in the history
Uncaught exception in processFrame #11
  • Loading branch information
kalwalt committed Apr 23, 2023
1 parent 104f31f commit 9fc582f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
26 changes: 25 additions & 1 deletion build/webarkit_ES6_wasm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/WebARKit.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions emscripten/WebARKitJS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ void WebARKit::initTrackerGray(emscripten::val data_buffer, int width, int heigh
std::vector<uint8_t> u8 =
emscripten::convertJSArrayToNumberVector<uint8_t>(data_buffer);
if (this->m_trackerType == TRACKER_TYPE::AKAZE_TRACKER) {
m_akaze_tracker->initialize_gray_raw(u8.data(), width, height);
m_akaze_tracker->initialize_gray_raw(static_cast<std::shared_ptr<unsigned char>>(u8.data()), width, height);
} else if (this->m_trackerType == TRACKER_TYPE::ORB_TRACKER) {
m_orb_tracker->initialize_gray_raw(u8.data(), width, height);
m_orb_tracker->initialize_gray_raw(static_cast<std::shared_ptr<unsigned char>>(u8.data()), width, height);
} else {
throw std::invalid_argument("Invalid tracker type");
}
Expand All @@ -16,10 +16,10 @@ void WebARKit::processFrame(emscripten::val data_buffer, ColorSpace colorSpace)
std::vector<uint8_t> u8 =
emscripten::convertJSArrayToNumberVector<uint8_t>(data_buffer);
if (this->m_trackerType == TRACKER_TYPE::AKAZE_TRACKER) {
m_akaze_tracker->processFrameData(u8.data(), this->videoWidth,
m_akaze_tracker->processFrameData(static_cast<std::shared_ptr<unsigned char>>(u8.data()), this->videoWidth,
this->videoHeight, colorSpace);
} else if (this->m_trackerType == TRACKER_TYPE::ORB_TRACKER) {
m_orb_tracker->processFrameData(u8.data(), this->videoWidth,
m_orb_tracker->processFrameData(static_cast<std::shared_ptr<unsigned char>>(u8.data()), this->videoWidth,
this->videoHeight, colorSpace);
} else {
throw std::invalid_argument("Invalid tracker type");
Expand Down

0 comments on commit 9fc582f

Please sign in to comment.