justadudewhohacks / justadudewhohacks/opencv4nodejs

How to use this project as a C++ dependency?

Open
#177 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5.1k
Forks
826
PR merge metrics
No merged PRs in 30d

Description

First off, you're a legend!

This project is amazing, and works so well - I was up and running in like 10 minutes - and using your resources as a basis, I was able to write my own module in an hour!

Along those lines though - is there a way to write a C++ module which uses this one as a dependency?

I have a Ximea camera, which contains it's own OpenCV API and integration (https://www.ximea.com/support/wiki/vision-libraries/OpenCV) - so I wrote a NodeJS wrapper for that API. However, when I wanted to use your Mat.h, everything fell over.

First attempt was to simply reference the node_modules/opencv4js includes (works) and link to the newly created static lib (fail - linker errors galore).

Second attempt was to pull down a copy of this library, and ram my code into a new folder, and compile the whole thing together. This works without an issue, but I would like to share my work - however, it doesn't make sense to do a PR into an OpenCV library for a specific hardware driver.

Any ideas why the linker might fail in the first attempt? I only use the Mat constructor, and it's here that the linker fails on me.

FF_OBJ jsMat = FF_NEW_INSTANCE(Mat::constructor);
cv::Mat image = FF_UNWRAP(info.This(), Camera)->ximeaCam.GetNextImageOcvMat();
FF_UNWRAP_MAT_AND_GET(jsMat) = image;
FF_RETURN(jsMat);

My goal would be to have a Ximea camera library, that takes a dependency on opencv4nodejs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.