mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
Throw error if invalid binarization technique is provided
This commit is contained in:
parent
769b3f912e
commit
901edf4d58
@ -1,6 +1,7 @@
|
||||
#include "Contours.h"
|
||||
#include "Matrix.h"
|
||||
#include "OpenCV.h"
|
||||
#include <string.h>
|
||||
#include <nan.h>
|
||||
|
||||
Nan::Persistent<FunctionTemplate> Matrix::constructor;
|
||||
@ -1652,6 +1653,19 @@ NAN_METHOD(Matrix::Threshold) {
|
||||
else if (strcmp(*typstr, "Threshold to Zero Inverted") == 0) {
|
||||
typ = 4;
|
||||
}
|
||||
else {
|
||||
char *typeString = *typstr;
|
||||
char text[] = "\" is no supported binarization technique. "
|
||||
"Use \"Binary\", \"Binary Inverted\", \"Threshold Truncated\", "
|
||||
"\"Threshold to Zero\" or \"Threshold to Zero Inverted\"";
|
||||
char errorMessage[strlen(typeString) + strlen(text) + 2];
|
||||
strcpy(errorMessage, "\"");
|
||||
strcat(errorMessage, typeString);
|
||||
strcat(errorMessage, text);
|
||||
|
||||
Nan::ThrowError(errorMessage);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Local < Object > img_to_return =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user