You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The description says the method works with single and multi channel.
So what I'm trying to do is smth like this:
// Prepare input data
var columns = imageData.width;
var rows = imageData.height;
var data_type = jsfeat.U8_t | jsfeat.C3_t; // RGB = 3 channels
var src = new jsfeat.matrix_t(columns, rows, data_type);
var size = imageData.data.length;
for (var i = 0, j = 0 ; i < size ; i +=4, j +=3) {
src.data[j] = imageData.data[i];
src.data[j + 1] = imageData.data[i + 1];
src.data[j + 2] = imageData.data[i + 2];
}
// Prepare output data
var scale = 0.5;
var nw = Math.floor(width * scale);
var nh = Math.floor(height * scale);
var dst = new jsfeat.matrix_t(nw, nh, data_type);
// Resample
jsfeat.imgproc.resample(src, dst, nw, nh);
// Prepare output imageData
var dstImageData = createEmptyImageData(nw, nh);
size = dstImageData.data.length;
for (i = 0, j = 0 ; i < size ; i += 4, j += 3) {
dstImageData.data[i] = dst.data[j];
dstImageData.data[i + 1] = dst.data[j + 1];
dstImageData.data[i + 2] = dst.data[j + 2];
dstImageData.data[i + 3] = 255;
}
// Draw dstImageData into the canvas and check
The description says the method works with single and multi channel.
So what I'm trying to do is smth like this:
// Prepare input data
var columns = imageData.width;
var rows = imageData.height;
var data_type = jsfeat.U8_t | jsfeat.C3_t; // RGB = 3 channels
var src = new jsfeat.matrix_t(columns, rows, data_type);
The result I got is pretty weird: https://www.dropbox.com/s/xfjucm99kjd6wpx/resample_result.jpg?dl=0
Can't figure out what is wrong, could you please help?
The text was updated successfully, but these errors were encountered: