size of image changes after manipulating the pixels

asked 2013-11-02 05:38:51 -0500

Harsh gravatar image

updated 2013-11-02 05:44:10 -0500

berak gravatar image

A very beginner in OpenCV I am trying to implement text steganography: Trying to hide a text message in an image. What I do is, I hide each of the characters from the text message by modifying the pixels in the image. For each of the characters I take the binary representation of the character and replace the last bit of a pixel with the LSB of the character, and gain last bit of another pixel with the 2nd bit of the character, and so on .... for the whole message. After this encryption of the text into the image I store it on the disk using cv::imwrite.

This image is again read in by another routine and decrypts it doing the reverse opeartions used for encrypting.

But, the problem is decryption is not working if i read in the image(encrypted image) whihc is stored using cv::imwrite. But, it works if I pass-on the encrypted matrix (cv::Mat) object to the decryption routine rather than reading a image again.

Seems, something is getting changed when i store the encrypted matrix into an image. Not sure what is going on behind the scenes. Any help is appreciated.

edit retag flag offensive close merge delete



try to save lossless, i.e as png . avoid jpegs

berak gravatar imageberak ( 2013-11-02 05:43:41 -0500 )edit

thank you it worked

Harsh gravatar imageHarsh ( 2013-11-07 07:54:02 -0500 )edit
berak gravatar imageberak ( 2013-11-07 08:16:21 -0500 )edit