Ask Your Question

Ives's profile - activity

2016-08-19 07:15:48 -0600 received badge  Nice Question (source)
2015-10-05 04:11:41 -0600 commented question Shape Transformers and Interfaces 2

Ok you're right on using only collinear control points, but I can assure you that's not the only problem. Right now I can't check but I'm pretty sure it also failed when I set the first two points not collinear. And I can definitely tell that the TPS failed with 217 non trivial control points of face landmarks. (Same controllpoints woked perfectly fine in an Matlab implementation of TPS) I already started debugging the TPS but for the next two weeks its not priority.

2015-10-02 07:36:29 -0600 received badge  Editor (source)
2015-10-02 06:03:20 -0600 asked a question Shape Transformers and Interfaces 2

Hey, 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. 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<cv::Point2f> points;
std::vector<cv::DMatch> 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<cv::ThinPlateSplineShapeTransformer> 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);
}
2015-08-25 10:55:14 -0600 received badge  Scholar (source)
2015-08-25 10:55:12 -0600 received badge  Supporter (source)
2015-08-25 10:37:57 -0600 received badge  Student (source)
2015-08-25 09:43:27 -0600 asked a question Shape Transformers and Interfaces

Hi, I was trying to make use of the new Shape Transformers and Interfaces. Unfortunately it doesn't work as expected. To ensure not making any fancy warps and getting strange results cause of that reason I initialized a transformation where nothing at all should happen. But output for transformation for a testpoint is always [0,0] and the warped image is always completley gray. Any suggestions what could be wrong are welcome.

int main(void)
{
    Mat img1 = imread("C:\\opencv\\sources\\samples\\data\\graf1.png", IMREAD_GRAYSCALE);
    std::vector<cv::Point2f> points1, testpoints;
    vector<DMatch> good_matches;
    Mat respic, resmat;

    points1.push_back(Point(0, 0)); //Corners 800x600 pic
    points1.push_back(Point(799, 0));
    points1.push_back(Point(799, 599));
    points1.push_back(Point(0, 599));

    Mat pointmatrix1(points1);

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

    testpoints.push_back(Point(250, 250));
    Mat testpointsmat(testpoints);

    // Apply TPS
    Ptr<ThinPlateSplineShapeTransformer> mytps = createThinPlateSplineShapeTransformer(0);
    mytps->estimateTransformation(pointmatrix1, pointmatrix1, good_matches); // Using same pointmatrix nothing should change in res
    mytps->applyTransformation(testpointsmat, resmat);

    cout << "pointmatrix1 = " << endl << " " << pointmatrix1 << endl << endl;
    cout << "testpointsmat = " << endl << " " << testpointsmat << endl << endl;
    cout << "resmat = " << endl << " " << resmat << endl << endl; //Always [0,0] ?

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

    mytps->warpImage(img1, respic);

    imwrite("Tranformed.png", respic);
    imshow("Tranformed", respic); //Always completley grey ?

    waitKey(0);

    return 0;
}