mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
threshold
This commit is contained in:
parent
769d6ebf77
commit
bae7a1bfd9
@ -72,6 +72,8 @@ Matrix::Init(Handle<Object> target) {
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "adjustROI", AdjustROI);
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "locateROI", LocateROI);
|
||||
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "threshold", Threshold);
|
||||
|
||||
NODE_SET_METHOD(constructor, "Eye", Eye);
|
||||
|
||||
|
||||
@ -999,3 +1001,19 @@ Matrix::LocateROI(const v8::Arguments& args) {
|
||||
|
||||
return scope.Close(arr);
|
||||
}
|
||||
|
||||
Handle<Value>
|
||||
Matrix::Threshold(const v8::Arguments& args) {
|
||||
SETUP_FUNCTION(Matrix)
|
||||
|
||||
double threshold = args[0]->NumberValue();
|
||||
double maxVal = args[1]->NumberValue();
|
||||
|
||||
Local<Object> img_to_return = Matrix::constructor->GetFunction()->NewInstance();
|
||||
Matrix *img = ObjectWrap::Unwrap<Matrix>(img_to_return);
|
||||
self->mat.copyTo(img->mat);
|
||||
|
||||
cv::threshold(self->mat, img->mat, threshold, maxVal, cv::THRESH_BINARY);
|
||||
|
||||
return scope.Close(img_to_return);
|
||||
}
|
||||
|
||||
@ -68,6 +68,8 @@ class Matrix: public node::ObjectWrap {
|
||||
|
||||
JSFUNC(LocateROI)
|
||||
JSFUNC(AdjustROI)
|
||||
|
||||
JSFUNC(Threshold)
|
||||
/*
|
||||
static Handle<Value> Val(const Arguments& args);
|
||||
static Handle<Value> RowRange(const Arguments& args);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user