Hey,
s.th. in this Shape Transformer Interface seems to be buggy.
Maybe also see my [former Question](http://answers.opencv.org/question/69384/shape-transformers-and-interfaces/)
The following code will only produce a completly gray image. The error is reproducable by giving the last point the same x/y value e.g. 2/2, but will work perfectly fine with 2/3.
But thats only one possibility to cause this error. I found other picutres with "real" landmark points which also cause this error but I couldn't figure out a pattern. (Let me know if you need the data)
I would be grateful for any help :)
int main(void)
{
cv::Mat sImg = cv::imread("D:\\Opencv3\\sources\\samples\\data\\graf1.png", cv::IMREAD_GRAYSCALE);
std::vector points;
std::vector good_matches;
cv::Mat tImg;
points.push_back(cv::Point(0, 0)); //Just to have a few points
points.push_back(cv::Point(1, 1));
points.push_back(cv::Point(2, 2)); // points.push_back(cv::Point(2, 3)) -> works fine
good_matches.push_back(cv::DMatch(0, 0, 0));
good_matches.push_back(cv::DMatch(1, 1, 0));
good_matches.push_back(cv::DMatch(2, 2, 0));
// Apply TPS
cv::Ptr mytps = cv::createThinPlateSplineShapeTransformer(0);
mytps->estimateTransformation(points, points, good_matches); // Using same points nothing should change in tImg
imshow("sImg", sImg); // Just to see if I have a good picture
mytps->warpImage(sImg, tImg);
imshow("tImg", tImg); //Always completley gray ?
cv::waitKey(0);
}
↧