Ask Your Question
0

How to find the average pixel value for a rectangular region

asked 2017-08-03 02:46:07 -0600

arqam gravatar image

I have a rectangular region in an image and have to calculate the average value.

One way I can do is parsing through each pixel value to calculate the average, but that is not an efficient way. Is there any better approach to do in openCV, preferably JAVA.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2017-08-03 03:29:02 -0600

MeanStdDev function is all you need: http://docs.opencv.org/master/d2/de8/...

But I am unsure if it is in Java available, since the java docs stop at 3.0.0 and I cannot find it there.

edit flag offensive delete link more
-1

answered 2017-08-03 03:53:21 -0600

Kharoud gravatar image

Firstly store rectangular region in another matrix and then you can use meanStdDev to calculate mean value of matrix.

edit flag offensive delete link more

Comments

? How is this different to my response ?

StevenPuttemans gravatar imageStevenPuttemans ( 2017-08-03 04:07:57 -0600 )edit

As only mean of rectangular region in image is required, so rectangular region should be cropped before applying meanStdDev.

Kharoud gravatar imageKharoud ( 2017-08-03 23:04:54 -0600 )edit

He said he already has that region ...

StevenPuttemans gravatar imageStevenPuttemans ( 2017-08-04 06:05:32 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-08-03 02:46:07 -0600

Seen: 11,490 times

Last updated: Aug 03 '17