c++ opencv redis3m - How to store mat object to redis server and revert it back to mat object -
working around clock trying store opencv mat object redis server using redis3m , getting data same. below code:
//converting mat image object byte , storing in redis server
mat image; int size = (int)image.total() * image.channels(); byte * bytes = new byte[size]; memcpy(bytes, image.data, size*sizeof(byte)); connection::ptr_t conn = connection::create(); conn->run(command("set")<<"name"<<bytes);
// getting mat data redis server:
connection::ptr_t conn = connection::create(); reply r = conn->run(command("get") << "name"); vector<char> vectordata(r.str().begin(), r.str().end()); mat data_mat(vectordata,true); mat image(cv::imdecode(data_mat,1));
kindly me this.
Comments
Post a Comment