Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit e54e859

Browse files
committed
imgproc: fix version issues
1 parent aad2659 commit e54e859

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

cc/modules/imgproc/imgprocBindings.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ namespace ImgprocBindings {
4747
bool useUserColor = 0;
4848

4949
bool unwrapRequiredArgs(Nan::NAN_METHOD_ARGS_TYPE info) {
50-
#if CV_VERSION_MINOR < 4
50+
#if CV_VERSION_MINOR < 3
5151
return (Mat::Converter::arg(0, &src, info) ||
5252
IntConverter::optArg(1, &colormap, info));
5353
#endif
5454

55-
#if CV_VERSION_MINOR >= 4
55+
#if CV_VERSION_MINOR >= 3
5656
if (info[1]->IsNumber()) {
5757
return (Mat::Converter::arg(0, &src, info) ||
5858
IntConverter::optArg(1, &colormap, info));
@@ -66,12 +66,12 @@ namespace ImgprocBindings {
6666
}
6767

6868
std::string executeCatchCvExceptionWorker() {
69-
#if CV_VERSION_MINOR < 4
69+
#if CV_VERSION_MINOR < 3
7070
cv::applyColorMap(src, dst, colormap);
7171
return "";
7272
#endif
7373

74-
#if CV_VERSION_MINOR >= 4
74+
#if CV_VERSION_MINOR >= 3
7575
if (useUserColor) {
7676
cv::applyColorMap(src, dst, userColor);
7777
} else {

test/tests/modules/imgproc/colormapTests.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,22 @@ module.exports = () => {
4242
});
4343
});
4444

45-
it('should process an image with a customized colormap', () => {
46-
generateAPITests({
47-
getDut: () => cv,
48-
methodName: 'applyColorMap',
49-
getRequiredArgs: () => ([
50-
new cv.Mat([[0, 1, 100]], cv.CV_8UC1),
51-
new cv.Mat(256, 1, cv.CV_8UC3),
52-
]),
53-
hasAsync: true,
54-
usesMacroInferno: false,
55-
expectOutput: res => {
56-
return expect(res).to.be.instanceOf(cv.Mat)
57-
},
45+
if (cv.version.minor >= 3) {
46+
it('should process an image with a customized colormap', () => {
47+
generateAPITests({
48+
getDut: () => cv,
49+
methodName: 'applyColorMap',
50+
getRequiredArgs: () => ([
51+
new cv.Mat([[0, 1, 100]], cv.CV_8UC1),
52+
new cv.Mat(256, 1, cv.CV_8UC3),
53+
]),
54+
hasAsync: true,
55+
usesMacroInferno: false,
56+
expectOutput: res => {
57+
return expect(res).to.be.instanceOf(cv.Mat)
58+
},
59+
});
5860
});
59-
});
61+
}
6062
});
6163
};

0 commit comments

Comments
 (0)