No way to change Fast threshold in ORB on browser

This works:

var orb = new cv.ORB();
var keyPoints = new cv.KeyPointVector();
orb.detect(grayImage, keyPoints);
cv.drawKeypoints(im, keyPoints, im2show);

But there is no orb.setFastThreshold(th) in the available OpenCV.js build, as you can check here.

Default threshold is 20, it’s very important to be able to adjust it.

So, the only way to set the threshold is in the constructor. It has 9 optional arguments, the last one is the threshold. In javascript you must provide every argument before the one you want to pass (it’s different from Python).

The problem is that orb is failing with an error when trying to set the 7th parameter scoreType. It also fails with setScoreType(). This problem is already reported. ScoreType is either 0 or 1, and both fail. For completeness, constructor works fine with 6 arguments, the seventh is failing. Error excerpt:

unbound types: N2cv3ORB9ScoreTypeE, 
message: "Cannot construct ORB due to unbound types: N2cv3ORB9ScoreTypeE"
name: "UnboundTypeError"
(anonymous) @ opencv.js:24

Passing undefined (or null) as seventh argument raised the same error.

Does somebody know a workaround? Thank you!

FastDetector works and you can set the threshold. Using FastDetector instead to orb.detect is a nice approach but won’t work because it won’t give you the much needed keypoints angles.

1 Like