jsfeat icon indicating copy to clipboard operation
jsfeat copied to clipboard

Help needed!!, ORB matching - How train pattern using image from image folder instead of webcam.

Open rohitkshirsagar opened this issue 8 years ago • 3 comments

Could you please help me into it.

rohitkshirsagar avatar Dec 18 '17 09:12 rohitkshirsagar

just get the image data using canvas

var image = new Image();
image.src = "image.jpg";

var c = document.getElementById("myCanvas");
var ctxx = c.getContext("2d");
c.width = image.width;
 c.height = image.height;
ctxx.drawImage(image, 0, 0, image.width, image.height);
var imgData = ctxx.getImageData(0, 0, c.width, c.height);

var imgg = new jsfeat.matrix_t(image.width, image.height, jsfeat.U8_t | jsfeat.C1_t);
jsfeat.imgproc.grayscale(imgData.data, image.width, image.height, imgg);

//Finally change this line in train_pattern()
jsfeat.imgproc.resample(img_u8, lev0_img, new_width, new_height);
//to this
jsfeat.imgproc.resample(imgg, lev0_img, new_width, new_height);

jinoantony avatar Dec 26 '17 07:12 jinoantony

@rohitkshirsagar here is the html file

https://drive.google.com/file/d/19uFc0k3vkntF8YjXjRJwvXeHfJvEy07M/view?usp=sharing

jinoantony avatar Dec 29 '17 17:12 jinoantony

@jinoantony Thank yo so much for your help !!

rohitkshirsagar avatar Jan 02 '18 17:01 rohitkshirsagar