-2
0, 1, 0, 0 ,0, 0

0, 0, 2, 0 ,4, 0

0, 1, 0, 5 ,0, 0

0, 0, 1, 0 ,1, 0

0, 0, 0, 0 ,1, 0

I am using opencv. Assume that cv: mat data is the same as the above array.

I want to get the average of the maximum of 2 by 2 of the array.

As great as

           2, 0 
           0, 5

It will be. We will divide this value by four to get the average.

How do you get the maximum of 2 by 2?

walid hamdy
  • 100
  • 1
  • 9
김주환
  • 17
  • 6
  • Surely `0, 4, 5, 0` is larger? – Mark Setchell May 30 '17 at 07:01
  • for each 2x2 window, compute the mean and save it in a result Mat in the upper-left pixel position of your window (maybe with a 2x2 filter or two separated 1D filter). Afterwards, search the maximum in that result Mat with findMinMaxLoc function. – Micka May 30 '17 at 07:32

1 Answers1

1

use blur filter like

cv::gaussianblur(input_mat,output_mat,cv::size(5,5),0);
walid hamdy
  • 100
  • 1
  • 9