TechStark / opencv-js

OpenCV JavaScript version for node.js or browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ORB doesn't work

Nachttisch opened this issue · comments

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)

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

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.

Fixed in v4.8.0-release.6