Search code examples
c++opencvimage-processingmat

How to get a cv::Mat to 2 by 2 maximum value mean?


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?


Solution

  • use blur filter like

    cv::gaussianblur(input_mat,output_mat,cv::size(5,5),0);