GpuMat copyTo doesnt work on sub-images

asked 2016-03-02 00:29:32 -0500

I have been trying to copy two different GpuMat images to sub-images (selected ROI) from the bigger gpuMat. But it is failing to copy. All i get is black image. Please find the code below.

I am using OpenCv4Tegra.

    Point c1, c2;
    c1 = tdptr->cam_params->corners[0];
    c2 = tdptr->cam_params->corners[1];

    c1.x -= tdptr->cam_params->corners[0].x;
    c1.y -= tdptr->cam_params->corners[0].y;
    c2.x -= tdptr->cam_params->corners[0].x;
    c2.y -= tdptr->cam_params->corners[0].y;

    GpuMat gdst = GpuMat(dst_sz,CV_8UC3);

    Rect r1(c1.x, c1.y, m1.cols, m1.rows);
    Rect r2(c2.x, c2.y, m2.cols, m2.rows);

    GpuMat ghalf1 = gdst(r1);
    GpuMat ghalf2 = gdst(r2);

edit retag flag offensive close merge delete


//! copies the GpuMatrix content to "m". // It calls m.create(this->size(), this->type()). void copyTo(GpuMat& m) const; why would it call "create" wouldnt it lose the set ROI ? I am confused

mdotali gravatar imagemdotali ( 2016-03-02 01:09:08 -0500 )edit