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){ NAN_METHOD(Matrix::Brightness){
NanScope(); NanScope();
Matrix *self = ObjectWrap::Unwrap<Matrix>(args.This());
if (args.Length() == 2){ if (args.Length() == 2){
Matrix *self = ObjectWrap::Unwrap<Matrix>(args.This());
cv::Mat image; cv::Mat image;
if(self->mat.channels() == 3){ if(self->mat.channels() == 3){
@ -348,9 +349,15 @@ NAN_METHOD(Matrix::Brightness){
gray.copyTo(self->mat); 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{ }else{
NanReturnValue(NanNew("Insufficient or wrong arguments")); NanReturnValue(NanNew("Insufficient or wrong arguments"));
} }
}
NanReturnNull(); NanReturnNull();