Home > Back-end >  Small white seek counsel, when use opencv to realize image coordinates transform
Small white seek counsel, when use opencv to realize image coordinates transform

Time:09-22

I want to realize an image coordinates such as


Actually is to make it turn like a terrible
I actually realized using opencv's own
Transpose (image, image1);
Point2f center=Point2f (image. Rows/2, image cols/2);//polar coordinates in the image of the origin of
WarpPolar (image1, image, the Size (image rows, image. The cols), center, center. The y,
INTER_LINEAR + WARP_POLAR_LINEAR + WARP_INVERSE_MAP);
But now I want to use a custom function polar_change convert the above work, the main function main self-defining function called as long as you can get what I want results, but why do I call later, image conversion did not happen, for which the great spirit guide, I code below the
#include
#include
#include

using namespace std;
Using the namespace CV;

Void polar_change (int rows, int cols, unsigned __int8 * data);

Int main ()
{
Double time0=static_cast & lt; Double> (getTickCount ());
Mat image=imread (" 0513 PNG ");
Int rows=image. Rows;
Int cols=image. The cols;
Polar_change (rows, cols, image data);
Time0=((double) getTickCount () - time0)/getTickFrequency ();
Cout & lt; <"Running time of this method are as follows:" & lt; Imshow (" 1 ", image);
WaitKey ();
return 0;
}
Void polar_change (int rows, int cols, unsigned __int8 * data)

{
Mat image (rows, cols, CV_8U, & amp; Data [0]);
Mat image1.
Transpose (image, image1);
/* Insert code here */
Point2f center=Point2f (rows/2, cols/2);//polar coordinates in the image of the origin of
WarpPolar (image1, image, the Size (image rows, image. The cols), center, center, x,
INTER_LINEAR + WARP_POLAR_LINEAR + WARP_INVERSE_MAP);
}


  • Related