Okay I am working on a video processing project and this include encryption of each frame and writing it to a file (outputenc.avi). I use a key.jpg to encrypt each file using XOR operation and its going well but the problem is during decryption I am getting a noisy original image the key and the frame under process are GRAY SCALE images with dimension 384*288.
encyption
capWebcam.read(matOriginal);
if(matOriginal.empty()==true)
return;
cv::Mat temp;
cv::resize(matOriginal,matOriginal,dsize,0,0,cv::INTER_CUBIC);
cv::cvtColor(matOriginal,matProcessed,CV_BGR2GRAY);
cv::bitwise_xor(matProcessed,key,temp);
output_enc_cap.write(temp);
decryption
capfile.read(temp);
if(temp.empty()==true)
return;
cvtColor(temp,temp,CV_BGR2GRAY);
cv::bitwise_xor(temp,key,temp);