문제

For part of my project I need to apply log-polar transform on an image. I found out that there is a class in OpenCV called:

cv::LogPolar_Interp and cv::LogPolar_Adjacent() for this purpose.

The problem is that I don't know how to use them to produce a transformed image like this one

I played with its parameters but I couldn't get desired result.

this it my try:

    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);

Does anyone know how can I get this. Thanks

도움이 되었습니까?

해결책

You should first map your input image to cortical coordinates and then remap it to Cartesian. You also have to convert your image to grayscale if you want to take advantage of Adjacent mapping.

By changing your code to the following one, you might get what you are looking for.

    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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top