Frage

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

War es hilfreich?

Lösung

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);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top