Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing module functions with manually built OpenCV #171

Open
Cruaier opened this issue Oct 11, 2024 · 0 comments
Open

Missing module functions with manually built OpenCV #171

Cruaier opened this issue Oct 11, 2024 · 0 comments

Comments

@Cruaier
Copy link

Cruaier commented Oct 11, 2024

Hi there,

I am currently working on a Lambda layer for object detection trying to use this module. Unfortunately I am having some issues after installing it.

My build process of OpenCV:

curl -L https://github.com/opencv/opencv/archive/refs/tags/4.10.0.tar.gz | tar zx && \ cd opencv-4.10.0 && mkdir -p build && cd build && cmake \ -DCMAKE_INSTALL_PREFIX=/opt \ -DBUILD_LIST=dnn,objdetect,imgcodecs \ -DBUILD_TESTS=OFF \ -DBUILD_PERF_TESTS=OFF \ .. && cmake --build . --target install

I am setting the needed environment variables accordingly and then install the module via npm without issues.
After installation I run some code to verify the installation:

import cv from '@u4/opencv4nodejs';
console.log(cv);
const image = cv.imread('image.jpg');

Which errors:

const image = cv.imread('image.jpg');
                 ^

TypeError: cv.imread is not a function
    at Object.<anonymous> (/var/task/test.cjs:4:18)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.12.0

Logging the cv object I can see there are many functions, e.g. from dnn available...but not from imgcodecs.

Having a look into the lib64 directory of OpenCV I can see that imgcodecs lib is present.

Any leads on what is missing would be appreciated. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant