Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add matrix mean method #401

Merged
merged 1 commit into from Apr 22, 2016
Merged

Add matrix mean method #401

merged 1 commit into from Apr 22, 2016

Conversation

jainanshul
Copy link
Contributor

@mvines ?
@peterbraden ?

I see there is a meanWithMask method already available. Ideally there should only be one mean method with an optional argument of mask. There are a bunch of other such withMask methods so may be as a separate PR I would consolidate them.

SETUP_FUNCTION(Matrix)

cv::Scalar means = cv::mean(self->mat);
v8::Local<v8::Array> arr = Nan::New<Array>(3);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to not assume a 3 channel matrix here, can we determine the number of channels in the src matrix and return that many means?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Means always return a 3 element scalar irrespective of 1-3 channels in an image. If there is only 1 channel for example then the first element in the only valid value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually means return a 4 element scalar and not 3. The MeanWithMask example I followed is incorrect too. Let me fix it to return 4 elements.

@mvines
Copy link
Collaborator

mvines commented Apr 22, 2016

Lgtm, thanks

@mvines mvines merged commit 13a1de4 into peterbraden:master Apr 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants