Skip to content

Commit 5f4ef5a

Browse files
committed
Fix unit test build - looks like cv::resize doesn't work with 64 bit floats
re - http://stackoverflow.com/questions/7385465/resize-an-image-and-changing-its-depth
1 parent d154496 commit 5f4ef5a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Matrix.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Matrix::Matrix(): ObjectWrap() {
6666
}
6767

6868
Matrix::Matrix(int w, int h): ObjectWrap() {
69-
mat = cv::Mat(w, h, CV_64FC1);
69+
mat = cv::Mat(w, h, CV_32FC1);
7070
}
7171

7272
Handle<Value>
@@ -225,7 +225,7 @@ Matrix::Eye(const v8::Arguments& args){
225225

226226
Local<Object> im_h = Matrix::constructor->GetFunction()->NewInstance();
227227
Matrix *img = ObjectWrap::Unwrap<Matrix>(im_h);
228-
cv::Mat mat = cv::Mat::eye(w, h, CV_64FC1);
228+
cv::Mat mat = cv::Mat::eye(w, h, CV_32FC1);
229229

230230
img->mat = mat;
231231
return scope.Close(im_h);
@@ -241,7 +241,7 @@ Matrix::Resize(const v8::Arguments& args){
241241
int y = args[1]->Uint32Value();
242242

243243
Matrix *self = ObjectWrap::Unwrap<Matrix>(args.This());
244-
cv::Mat res;
244+
cv::Mat res = cv::Mat(x, y, CV_32FC1);
245245
cv::resize(self->mat, res, cv::Size(x, y), 0, 0, cv::INTER_LINEAR);
246246
~self->mat;
247247
self->mat = res;

0 commit comments

Comments
 (0)