Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

hmm, please try to avoid the old c-api, use the newer c++ one whenever possible:


#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/core/core.hpp"
using namespace cv;

int angle=180;
Mat im;
Mat dst_image;
void onChange(int,void*)
{
    Point2f cen(dst_image.cols/2,dst_image.rows/2);
    double scale = 1.0;
    double a = double(angle-180);
    Mat rot_mat = getRotationMatrix2D(cen, a, scale);
    warpAffine(im, dst_image, rot_mat, Size(), INTER_LINEAR); 
    imshow("lala",dst_image);
}
int main()
{
    im = imread("E:/MEDIA/faces/grimace/pat/pat_exp.17.jpg", 1);
    dst_image = Mat(im.rows*1.5,im.cols*1.5,im.type(),Scalar::all(0));
    namedWindow("lala", 0);
    createTrackbar("a","lala",&angle,360,onChange);
    onChange(0,0);
    waitKey();
    return 0;
}