TechStark / opencv-js

OpenCV JavaScript version for node.js or browser
https://npmjs.com/@techstark/opencv-js
Apache License 2.0
410 stars 36 forks source link

ORB doesn't work #11

Closed Nachttisch closed 1 year ago

Nachttisch commented 2 years ago

Hey there, first of all thanks for your work, really appreciating! :) I have the problem that I cannot apply the ORB algorithm that was listed as a method or property. My source code looks like this:

  const img = cv.imread(imgSrc);
  const imgGray = new cv.Mat();
  const nfeatures= 100
  const orb = cv.ORB_create(nfeatures)    //ORB_
  const keypoints = orb.detectAndCompute(img, null)
  console.log(keypoints)
bperel commented 2 years ago

I'm having a similar issue with this code:

let orb: cv.ORB = new cv.ORB(5000);
const kp1 = new cv.KeyPointVector();
const descriptors = new cv.Mat();
const noArray = new cv.Mat();
const output = orb.detectAndCompute(img, noArray, kp1, descriptors)
console.log(output) // null

I don't know if it's related, but my IDE also tells me: TS2694: Namespace '...../node_modules/@techstark/opencv-js/dist/types/index"' has no exported member 'ORB'. on the first line of the code above; but despite this error it builds properly. image

richikchanda1999 commented 1 year ago

I am running into the same issue. I think the reason is that this package uses the types exported by mirada under the hood. So, when using Typescript, the IDE can only understands the types that were defined by mirada, and not the greater set of functions that this package offers (mirada was updated 4 years back, while this package was last updated 3 months back).

From this understanding of mine, I would try to export the updated types to support the newer functions added by OpenCV in the last 4 years.

ttt43ttt commented 1 year ago

Fixed in v4.8.0-release.6