Merge pull request #461 from piercus/master

fix get method for CV_32FC1
This commit is contained in:
Peter Braden 2016-11-11 10:56:56 -08:00 committed by GitHub
commit 976788c411
2 changed files with 7 additions and 2 deletions

View File

@ -208,6 +208,9 @@ double Matrix::DblGet(cv::Mat mat, int i, int j) {
case CV_64FC1:
val = mat.at<double>(i, j);
break;
case CV_32FC1:
val = mat.at<float>(i, j);
break;
default:
val = mat.at<double>(i, j);
break;

View File

@ -103,8 +103,10 @@ test('Matrix functions', function(assert) {
// convertTo
var mat = new cv.Matrix(75, 75, cv.Constants.CV_32F, [2.0]);
var matNew = new cv.Matrix(75, 75, cv.Constants.CV_8U);
mat.convertTo(matNew, cv.Constants.CV_8U, 2, 1);
assert.equal(matNew.pixel(0, 0), 5);
var alpha = 2;
var beta = 1;
mat.convertTo(matNew, cv.Constants.CV_8U, alpha, beta);
assert.equal(matNew.pixel(0, 0), mat.get(0, 0)*alpha + beta);
// reshape
mat = new cv.Matrix(75, 75, cv.Constants.CV_8UC1);