Ask Your Question

Revision history [back]

GpuMat copyTo doesnt work on sub-images

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);


    m1_converted.copyTo(ghalf1);
    m2_converted.copyTo(ghalf2);