I want to encode a descriptor in order to send them later through a TCP socket. The descriptor is saved as a cv::Mat.
...
surf->detectWithDescriptors(gpu_img1, cuda::GpuMat(), keypoints1GPU, descriptors1GPU);
Mat dsc;
descriptors1GPU.download(dsc);
vector<int> compressionsparam;
vector<uchar> encoded;
compressionsparam.push_back(IMWRITE_EXR_TYPE_FLOAT);
compressionsparam.push_back(80);
imencode(".exr", dsc, encoded);
send(socket,(char*)&encoded[0],dsc.elemSize()*dsc.total(),0);
on the other side I want to decode it
recv(socket,buf,bufsize,0);
Mat matImg = cv::imdecode(Mat(1, bufsize, CV_32F, buf), IMREAD_ANYDEPTH);
Unfortunately that doesn't work. I receive for matImg an [0x0] Mat.