我想要實作一幅影像極坐標顯示例如這樣


其實就是讓它像轉圈圈一樣轉起來
我其實實作了用opencv自帶的
transpose(image, image1);
Point2f center = Point2f(image.rows / 2, image.cols/2); //極坐標在影像中的原點
warpPolar(image1, image, Size(image.rows, image.cols), center, center.y,
INTER_LINEAR + WARP_POLAR_LINEAR + WARP_INVERSE_MAP);
但是我現在想要用一個自定義函式polar_change把上面的變換一起干了,主函式main只要呼叫自己定義的函式就能得到我想要的結果。但是為什么我呼叫之后,影像并沒有發生轉換呢。求哪位大神指導一下,代碼我碼在下面了
#include <opencv2\opencv.hpp>
#include <iostream>
#include <opencv2\core.hpp>
using namespace std;
using namespace cv;
void polar_change(int rows, int cols, unsigned __int8 *data);
int main()
{
double time0 = static_cast<double>(getTickCount());
Mat image = imread("0513.png");
int rows = image.rows;
int cols = image.cols;
polar_change(rows, cols, image.data);
time0 = ((double)getTickCount() - time0) / getTickFrequency();
cout << "此方法的運行時間為:" << time0 << "秒。" << endl;
imshow("1", image);
waitKey();
return 0;
}
void polar_change(int rows, int cols, unsigned __int8 *data)
{
Mat image(rows, cols, CV_8U, &data[0]);
Mat image1;
transpose(image, image1);
/* Insert code here */
Point2f center = Point2f(rows / 2, cols / 2); //極坐標在影像中的原點
warpPolar(image1,image, Size(image.rows, image.cols),center,center.x,
INTER_LINEAR + WARP_POLAR_LINEAR + WARP_INVERSE_MAP);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/64594.html
標籤:新手樂園
上一篇:求答案
下一篇:keil沒有自動匯入頭檔案
