I am using OpenCV on android to build a a DCT steganography app.
I have to change the CvType
of the image mat according to the different processes like dct
, idct
..etc.
Steps: (and required type of mat
for that step)
- Load image bitmap and get image
mat
(CvType.CV_8UC4) from it. - Convert image from RGB to YCrCb
- Divide the image into blocks of 8 x 8 blocks.
- Center pixel values around 0 [0-255 => -128-127] (CvType.CV_32SC1)
- Apply DCT transformation to get DCT coefficients for the block. (CvType.CV_32FC1)
- Quantization [divide the DCT coefficients with quant matrix]
- Now substitute the LSBs of the non 0/1/DC coefficients with our secret message. (CvType.CV_8SC1)
- inverse quantization**(CvType.CV_32FC1)**
- inverse DCT
- [0-255 <= -128-127]
- YCbCr to RGB
- Get bitmap from image
mat
(CvType.CV_8UC4) - Save the bitmap as jpeg.
Problem :
In the 11th
step I have to convert image mat to the original type imOut.convertTo(imOut, imIn.type())
.
By testing, I have found out, that at this step a small percentage of pixel values get changed (example - one of the DCT coeff : 13
to 12
) which changes the steg message from aaaaaa
to aaaa!a
Any solutions ?