Ask Your Question

# Revision history [back]

### Shape Transformers and Interfaces 2

Hey it's me again. S.th. in this Shape Transformer Interface seems to be buggy. Maybe also see my former Question

The following code will only produce a completly gray image again. The error is reproducable by giving the last point the same x/y 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 vor any help :)

using namespace cv;
using namespace std;

void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
Mat sImg = imread("D:\\Opencv3\\sources\\samples\\data\\graf1.png", IMREAD_GRAYSCALE);
std::vector<cv::Point2f> points;
vector<DMatch> good_matches;
Mat tImg;

points.push_back(Point(0, 0)); //Just to have a few points, works with different combinations
points.push_back(Point(1, 1));
points.push_back(Point(2, 2)); // e.g. this would work perfectly fine! points.push_back(Point(2, 3));

good_matches.push_back(DMatch(0, 0, 0));
good_matches.push_back(DMatch(1, 1, 0));
good_matches.push_back(DMatch(2, 2, 0));

// Apply TPS
Ptr<ThinPlateSplineShapeTransformer> mytps = createThinPlateSplineShapeTransformer(0);
mytps->estimateTransformation(points, points, good_matches); // Using same pointmatrix nothing should change in the target Image

imshow("img1", sImg); // Just to see if I have a good picture

mytps->warpImage(sImg, tImg);

imshow("Tranformed", tImg); //Always completley grey ?

waitKey(0);
}


### Shape Transformers and Interfaces 2

Hey it's me again. S.th. in this Shape Transformer Interface seems to be buggy. Maybe also see my former Question

The following code will only produce a completly gray image again. The error is reproducable by giving the last point the same x/y 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 vor any help :)

using namespace cv;
using namespace std;

void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
main(void)
{
Mat sImg = imread("D:\\Opencv3\\sources\\samples\\data\\graf1.png", IMREAD_GRAYSCALE);
std::vector<cv::Point2f> points;
vector<DMatch> good_matches;
Mat tImg;

points.push_back(Point(0, 0)); //Just to have a few points, works with different combinations
points.push_back(Point(1, 1));
points.push_back(Point(2, 2)); // e.g. this would work perfectly fine! points.push_back(Point(2, 3));

good_matches.push_back(DMatch(0, 0, 0));
good_matches.push_back(DMatch(1, 1, 0));
good_matches.push_back(DMatch(2, 2, 0));

// Apply TPS
Ptr<ThinPlateSplineShapeTransformer> mytps = createThinPlateSplineShapeTransformer(0);
mytps->estimateTransformation(points, points, good_matches); // Using same pointmatrix nothing should change in the target Image

imshow("img1", sImg); // Just to see if I have a good picture

mytps->warpImage(sImg, tImg);

imshow("Tranformed", tImg); //Always completley grey ?

waitKey(0);
return 0;
}


### Shape Transformers and Interfaces 2

Hey it's me again. S.th. Hey, s.th. in this Shape Transformer Interface seems to be buggy. buggy. Maybe also see my former Question

The following code will only produce a completly gray image again. 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 vor for any help :)

using namespace cv;
using namespace std;

int main(void)
{
Mat cv::Mat sImg = imread("D:\\Opencv3\\sources\\samples\\data\\graf1.png", IMREAD_GRAYSCALE);
cv::imread("D:\\Opencv3\\sources\\samples\\data\\graf1.png", cv::IMREAD_GRAYSCALE);
std::vector<cv::Point2f> points;
vector<DMatch> std::vector<cv::DMatch> good_matches;
Mat cv::Mat tImg;

points.push_back(Point(0, points.push_back(cv::Point(0, 0)); //Just to have a few points, points
points.push_back(cv::Point(1, 1));
points.push_back(cv::Point(2, 2)); // points.push_back(cv::Point(2, 3)) -> works with different combinations
points.push_back(Point(1, 1));
points.push_back(Point(2, 2)); // e.g. this would work perfectly fine! points.push_back(Point(2, 3));

good_matches.push_back(DMatch(0, fine

good_matches.push_back(cv::DMatch(0, 0, 0));
good_matches.push_back(DMatch(1, good_matches.push_back(cv::DMatch(1, 1, 0));
good_matches.push_back(DMatch(2, good_matches.push_back(cv::DMatch(2, 2, 0));

// Apply TPS
Ptr<ThinPlateSplineShapeTransformer> cv::Ptr<cv::ThinPlateSplineShapeTransformer> mytps = createThinPlateSplineShapeTransformer(0);
cv::createThinPlateSplineShapeTransformer(0);
mytps->estimateTransformation(points, points, good_matches); // Using same pointmatrix points nothing should change in the target Image

imshow("img1", tImg

imshow("sImg", sImg); // Just to see if I have a good picture

mytps->warpImage(sImg, tImg);

imshow("Tranformed", imshow("tImg", tImg); //Always completley grey gray ?

waitKey(0);
return 0;
cv::waitKey(0);
}