Skip to content

Instantly share code, notes, and snippets.

@albjeremias
Created March 19, 2020 16:33
Show Gist options
  • Save albjeremias/c50a5610d35e40f279546f8ee1d1d4ce to your computer and use it in GitHub Desktop.
Save albjeremias/c50a5610d35e40f279546f8ee1d1d4ce to your computer and use it in GitHub Desktop.
function OpencvExt() {
cv.DMatchVector.prototype.sort = function () {
for (let i = 0; i < this.size(); i++) {
for (let j = 0; j < this.size(); j++) {
if (this.get(i).distance < this.get(j).distance) {
let x = this.get(i);
let y = this.get(j);
this.set(i, y);
this.set(j, x);
}
}
}
}
cv.DMatchVector.prototype.resizeMe=function(length){
let matchesResized = new cv.DMatchVector();
for (let i = 0; i < length; i++) {
matchesResized.push_back(this.get(i));
}
return matchesResized;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment