title: OpenCV with Laplacian formula to detect image is blur or not in iOS
body: <p>Thanks for help in advance.</p>
  
  <p>I have lots of R&amp;D and search but I can't find any solution for detect blur image or not.</p>
  
  <p><strong>I have used this <a href="https://github.com/BloodAxe/OpenCV-Tutorial">https://github.com/BloodAxe/OpenCV-Tutorial</a> and for blur detection used Laplacian formula but can't get blur detection in image</strong></p>
  
  <blockquote>
    <p>-(void) checkForBurryImage:(UIImage *) image {</p>
  
  <pre><code>cv::Mat matImage = [image toMat];
  cv::Mat matImageGrey;
  cv::cvtColor(matImage, matImageGrey, CV_BGRA2GRAY);
  
  cv::Mat dst2 =[image toMat];
  cv::Mat laplacianImage;
  dst2.convertTo(laplacianImage, CV_8UC1);
  cv::Laplacian(matImageGrey, laplacianImage, CV_8U);
  cv::Mat laplacianImage8bit;
  laplacianImage.convertTo(laplacianImage8bit, CV_8UC1);
  //-------------------------------------------------------------
  //-------------------------------------------------------------
  unsigned char *pixels = laplacianImage8bit.data;
  //-------------------------------------------------------------
  //-------------------------------------------------------------
   //    unsigned char *pixels = laplacianImage8bit.data;
  int maxLap = -16777216;
  
  for (int i = 0; i &lt; ( laplacianImage8bit.elemSize()*laplacianImage8bit.total()); i++) {
      if (pixels[i] &gt; maxLap)
          maxLap = pixels[i];
  }
  
  int soglia = -6118750;
  
  printf("\n maxLap : %i",maxLap);
  
  
  if (maxLap &lt; soglia || maxLap == soglia) {
      printf("\n\n***** blur image *****");
  }else
      printf("\nNOT a blur image"); }
  </code></pre>
  </blockquote>
  
  <p>And I used same code as Android and its working fine but In iOS, its give me always positive value so I think its not working,</p>
  
  <p>So please give me idea or link or any suggestion.</p>