SHARED memory between GpuMat and Mat

asked 2019-04-03 01:23:46 -0600

Hi all: Nice to meet you here.

    I want to use memory between GPU and CPU like:
    GpuMat gmat;
    Mat cmat;
    HostMem hostm = HostMem(640,480,CV_8CU3,SHARED);
    gmat = hostm.createGpuMatHeader();
    cmat = hostm.createMatHeader();

    But this failed in the later process of the GpuMat.can any one  tell me the reason?

    if I use the opencv samples gpumat,it works/
    Mat cmat();
    GpuMat gmat();
    gmat.upload(cmat); 
    //I thinks the function copyed the data to Device.

   1,So what is difference between upload and hostmem to shared memory?
   2,Does any one know how to use shared memory between CPU and GPU?

Thanks

edit retag flag offensive close merge delete