Hello! The second day I do not understand what to do. I read from the webcam using OpenCV frame and with the imdecode function I write it into a vector, then the data is encrypted, decrypted on the other side (in this case I simulate the second side) and then all the data should be written back into the vector from which the frame is recreated. Tried without encryption, the effect is the same. Most likely it is a matter of conversion from char * to vector.

Mat frame; vector<uchar> buf; vector<int> params; params.insert(params.end(), IMWRITE_PNG_COMPRESSION); params.insert(params.end(), 5); VideoCapture capt(0); unsigned char* data; int size; for (int a = 0; a < 100; ++a){ try{ capt >> frame; imencode(".png", frame, buf, params); size = buf.size(); cout << size << endl; data = enc(&buf[0], (unsigned char*)"hello", size); data = dec(data, (unsigned char*)"hello", size); memcpy(&buf[0], data, size); frame = imdecode(Mat(buf), CV_LOAD_IMAGE_COLOR); imshow("img", frame); } catch (cv::Exception ex){ ex.formatMessage(); } waitKey(30); } return 0; 

    0