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

Remove dependency on opencv4nodejs and CMake #10

Open
arnaudh opened this issue Dec 24, 2020 · 1 comment
Open

Remove dependency on opencv4nodejs and CMake #10

arnaudh opened this issue Dec 24, 2020 · 1 comment

Comments

@arnaudh
Copy link
Owner

arnaudh commented Dec 24, 2020

## Problem

Depending on opencv4nodejs means the extension takes a long time (20 minutes+) to build, and the build itself is brittle due to the use of CMake (which is only needed to build opencv4nodejs).

Solution

MagicCardZoom only depends on opencv4nodejs for offline tasks such as indexing the images, however it is not used by the extension when running in the browser (since it is a NodeJS package).

In theory we could replace all usages of opencv4nodejs with calls to opencv.js (see my instructions here on how to compile any function from OpenCV), or other more lightweight image libraries. This way we can drop the dependencies on opencv4nodejs and CMake, and make the build faster and more robust.

@arnaudh
Copy link
Owner Author

arnaudh commented Jul 28, 2022

Usages of opencv4nodejs:

- cv_debug.js
  - index_images (+ benchmark + contour_finder_test)
    - cvDebug.imread
      - **cv.imread**
    - cvDebug.resize
      - **img.resize**
    - cvDebug.cropToArtPlusOrbBorderInside
      - .crop
        - **img.getRegion**
        - **cv.Rect**
    - **img.gaussianBlur**
    - **cv.Size(1, 1)**
    - cvDebug.toImageData
      - **img.cvtColor**
      - **cv.COLOR_GRAY2RGBA**
      - **cv.COLOR_BGR2RGBA**
    - imwrite
      - **cv.imwrite**
  
  - [debug only: additional] identify_service + matcher
    - cv_debug.setDescriptorInputImg
    - cv_debug.fromImageData
      - **cv.Mat**
      - **cv.COLOR_RGBA2BGR**
    - cv_debug.drawAndSaveMatches
      - drawPoints
        - **cv.Vec**
        - **img.drawCircle**
        - **cv.Point2**
      - joinImages
        - **img.copyTo**
    - cv_debug.drawAndSaveContour
      - drawContour
        - **cv.Contour**
        - **img.drawContours**

So only 10 simple OpenCV functions/structs are essential.

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