added simple brightness

This commit is contained in:
Thomas Hoffmann 2015-07-01 14:56:26 +02:00
parent 71da46939b
commit ef8090f4b6

View File

@ -313,9 +313,10 @@ NAN_METHOD(Matrix::GetData) {
NAN_METHOD(Matrix::Brightness){
NanScope();
Matrix *self = ObjectWrap::Unwrap<Matrix>(args.This());
if (args.Length() == 2){
Matrix *self = ObjectWrap::Unwrap<Matrix>(args.This());
cv::Mat image;
if(self->mat.channels() == 3){
@ -348,9 +349,15 @@ NAN_METHOD(Matrix::Brightness){
gray.copyTo(self->mat);
}
}else{
if (args.Length() == 1){
int diff = args[0]->IntegerValue();
cv::Mat img = self->mat + diff;
img.copyTo(self->mat);
}else{
NanReturnValue(NanNew("Insufficient or wrong arguments"));
}
}
NanReturnNull();