title: Deconvolution with OpenCV?
body: <p>Is there a way of doing deconvolution with OpenCV?</p>
  
  <p>I'm just impressed by the improvement shown here </p>
  
  <p><a href="https://i.stack.imgur.com/xEv1Y.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xEv1Y.jpg" alt="from https://web.archive.org/web/20160402174700/http://www.olympusmicro.com/primer/digitalimaging/deconvolution/images/deconalgorithmsfigure1.jpg"></a></p>
  
  <p>and would like to add this feature also to my software.</p>
  
  <p><strong>EDIT</strong> (Additional information for bounty.)</p>
  
  <p>I still have not figured out how to implement the deconvolution.
  This code helps me to sharpen the image, but I think the deconvolution could do it better.</p>
  
  <pre><code>void ImageProcessing::sharpen(QImage &amp; img)
  {
      IplImage* cvimg = createGreyFromQImage( img );
      if ( !cvimg ) return;
  
      IplImage* gsimg = cvCloneImage(cvimg );
      IplImage* dimg = cvCreateImage( cvGetSize(cvimg), IPL_DEPTH_8U, 1 );
      IplImage* outgreen = cvCreateImage( cvGetSize(cvimg), IPL_DEPTH_8U, 3 );
      IplImage* zeroChan = cvCreateImage( cvGetSize(cvimg), IPL_DEPTH_8U, 1 );
      cvZero(zeroChan);
  
      cv::Mat smat( gsimg, false );
      cv::Mat dmat( dimg, false );
  
      cv::GaussianBlur(smat, dmat, cv::Size(0, 0), 3);
      cv::addWeighted(smat, 1.5, dmat, -0.5 ,0, dmat);
      cvMerge( zeroChan, dimg, zeroChan, NULL, outgreen);
  
      img = IplImage2QImage( outgreen );
      cvReleaseImage( &amp;gsimg );
      cvReleaseImage( &amp;cvimg );
      cvReleaseImage( &amp;dimg );
      cvReleaseImage( &amp;outgreen );
      cvReleaseImage( &amp;zeroChan );
  }
  </code></pre>
  
  <p>Hoping for helpful hints!</p>