cv::Mat colorMap( 255, 255, CV_8UC3, cv::Scalar(0,0,0) ); cv::Mat resultat( 255, 255, CV_8UC3, cv::Scalar(255,255,255) ); //faire un dégradé de couleur dans l'image for (int y=0; y<255; y++) { for (int x=0; x<255; x++) { colorMap.at(x,y)[0] = x; colorMap.at(x,y)[1] = y; colorMap.at(x,y)[2] = 0; } } cv::imshow("test",colorMap); cv::waitKey(1); CvMat* deformation = cvCreateMat(3,3, CV_32F); CvPoint2D32f* c1 = (&cvPoint2D32f(0,0), &cvPoint2D32f(0,255), &cvPoint2D32f(255,0), &cvPoint2D32f(255,255)); CvPoint2D32f* c2 = (&cvPoint2D32f(100,100), &cvPoint2D32f(20,200), &cvPoint2D32f(230,15), &cvPoint2D32f(200,240)); deformation = cvGetPerspectiveTransform(c1, c2, deformation); cvWarpPerspective(&colorMap, &resultat, deformation); cv::imshow("test2", resultat); cv::waitKey(1);