Guest User

Untitled

a guest
Aug 9th, 2017
514
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     // -----------------------------------------------------
  2.     // ---------- FIND AVG LUMINENCE OF FRAME --------------
  3.     // -----------------------------------------------------
  4.    
  5.     cv::Mat grayMat;
  6.     cv::cvtColor(_classImage, grayMat, CV_BGR2GRAY);
  7.    
  8.     int Totalintensity = 0;
  9.     for (int i=0; i < grayMat.rows; ++i){
  10.         for (int j=0; j < grayMat.cols; ++j){
  11.             Totalintensity += (int)grayMat.at<uchar>(i, j);
  12.         }
  13.     }
  14.  
  15.     // Find avg lum of frame
  16.     float avgLum = 0;
  17.     avgLum = Totalintensity/(grayMat.rows * grayMat.cols);
RAW Paste Data