用OpenCV反卷积? [英] Deconvolution with OpenCV?

查看:121
本文介绍了用OpenCV反卷积?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用OpenCV进行反卷积?

Is there a way of doing deconvolution with OpenCV?

我对这里显示的改进印象深刻

I'm just impressed by the improvement shown here

,并希望将此功能也添加到我的软件中.

and would like to add this feature also to my software.

编辑(赏金的其他信息.)

EDIT (Additional information for bounty.)

我仍然没有弄清楚如何实现反卷积. 这段代码有助于我提高图像的清晰度,但是我认为反卷积可以做得更好.

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.

void ImageProcessing::sharpen(QImage & 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( &gsimg );
    cvReleaseImage( &cvimg );
    cvReleaseImage( &dimg );
    cvReleaseImage( &outgreen );
    cvReleaseImage( &zeroChan );
}

希望获得有用的提示!

推荐答案

当然,您可以使用OpenCV编写反卷积代码.但是还没有可以使用的功能.

Sure, you can write a deconvolution Code using OpenCV. But there are no ready to use Functions (yet).

要开始使用,您可以查看此示例显示了使用OpenCV在Python中实现Wiener反卷积的功能.

To get started you can look at this Example that shows the implementation of Wiener Deconvolution in Python using OpenCV.

这是另一个示例 C,但这是从2012年开始的,所以也许已经过时了.

Here is another Example using C, but this is from 2012, so maybe it is outdated.

这篇关于用OpenCV反卷积?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆