Skip to content

Commit

Permalink
fix for: Test issue: impossible to load a jpeg image with imread (Ope…
Browse files Browse the repository at this point in the history
…nCV) #24
  • Loading branch information
kalwalt committed Nov 9, 2023
1 parent dce5a2a commit ce4fe4d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
11 changes: 8 additions & 3 deletions WebARKit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ if(${EMSCRIPTEN_COMP} EQUAL 1)
message("Fetching opencv for emscripten compilation from webarkit/opencv-em ...")
FetchContent_Declare(
build_opencv
URL https://github.com/webarkit/opencv-em/releases/download/0.1.3/opencv-js-4.7.0-emcc-3.1.26.zip
URL https://github.com/webarkit/opencv-em/releases/download/0.1.4/opencv-js-4.7.0-emcc-3.1.26.zip
)
else()
message("Fetching opencv from webarkit/opencv-em ...")
FetchContent_Declare(
build_opencv
URL https://github.com/webarkit/opencv-em/releases/download/0.1.3/opencv-4.7.0.zip
URL https://github.com/webarkit/opencv-em/releases/download/0.1.4/opencv-4.7.0.zip
)
endif()

Expand Down Expand Up @@ -69,4 +69,9 @@ target_include_directories(WebARKitLib PRIVATE
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/imgproc/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/video/include"
"${build_opencv_SOURCE_DIR}/libs/opencv_contrib/modules/xfeatures2d/include"
)
)

target_link_libraries(WebARKitLib
jpeg
"${build_opencv_SOURCE_DIR}/3rdparty/lib/liblibopenjp2.a"
)
9 changes: 1 addition & 8 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,9 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)

FetchContent_Declare(
build_opencv
URL https://github.com/webarkit/opencv-em/releases/download/0.1.3/opencv-4.7.0.zip
URL https://github.com/webarkit/opencv-em/releases/download/0.1.4/opencv-4.7.0.zip
)


#[[FetchContent_Declare(
build_opencv
URL /home/kalwalt/kalwalt-github/opencv-em/packaging/opencv-4.7.0.zip
)
]]#

FetchContent_MakeAvailable(googletest build_opencv)

enable_testing()
Expand Down
6 changes: 1 addition & 5 deletions tests/webarkit_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include <WebARKitManager.h>
#include <WebARKitTrackers/WebARKitOpticalTracking/WebARKitEnums.h>
#include <WebARKitCamera.h>
//#include <WebARKitGL.h>
#include <opencv2/imgcodecs.hpp>

class WebARKitEnumTest : public testing::TestWithParam<std::tuple<webarkit::TRACKER_TYPE, webarkit::ColorSpace>> {};
Expand Down Expand Up @@ -91,9 +90,6 @@ TEST(WebARKitGLTest, TestCameraProjectionMatrix) {
std::array<double, 9> camera_mat = camera.getCameraData();
std::array<double, 16> projectionMatrix = {0.0};
webarkit::cameraProjectionMatrix(camera_mat, 0.01, 100.0, width, height, projectionMatrix);
/*for(auto i : projectionMatrix) {
std::cout << "proj Matrix: " << (double)i << std::endl;
}*/
EXPECT_EQ(projectionMatrix[0], -1.7851850084276433);
EXPECT_EQ(projectionMatrix[5], 2.3802466779035241);
EXPECT_EQ(projectionMatrix[10], -1.0002000200020003);
Expand Down Expand Up @@ -164,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");

if(image.data == NULL) {
std::cout << "Something wrong while reading the image!" << std::endl;
Expand Down

0 comments on commit ce4fe4d

Please sign in to comment.