使用OpenCV进行图像视网膜极坐标采样

3
为了完成我的项目的一部分,我需要在图像上应用对数极坐标变换。我发现OpenCV中有两个类可以实现这个目的:cv::LogPolar_Interp和cv::LogPolar_Adjacent()。
问题是我不知道如何使用它们来生成像这样的变换图像 this one
我尝试调整它的参数,但是我无法得到期望的结果。以下是我的尝试:
    cv::LogPolar_Interp *LogPolar=new cv::LogPolar_Interp(inputFrame.cols,inputFrame.rows,cv::Point2i(inputFrame.cols/2,inputFrame.rows/2),120,20,CV_INTER_LINEAR, 1,117,1);

    logPolar_out=LogPolar->to_cartesian(inputFrame);

有人知道我该如何获得这个吗。 谢谢

1个回答

4

首先,您应该将输入的图像映射到大脑皮层坐标系,然后再将其重映射到笛卡尔坐标系。

如果您想利用邻近映射,还必须将图像转换为灰度。

通过将您的代码更改为以下内容,您可能会得到您想要的结果。

    cv::cvtColor(inputFrame,inputFrame,CV_BGR2GRAY);

    cv::LogPolar_Adjacent *logP=new cv::LogPolar_Adjacent(inputFrame.cols,inputFrame.rows,cv::Point2i(inputFrame.cols/2,inputFrame.rows/2));

    logPolar_out=logP->to_cortical(inputFrame);
    logPolar_out=logP->to_cartesian(logPolar_out);
    cv::imshow("Log Polar output",logPolar_out);
    cv::imshow("Log Polar input",inputFrame);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接