Hello Guys i hope that you are doing great , i have my final project presentation on sunday and am really struggling , The project is about the steganography we are using jsteg algorithm the teacher asked us to use JPEG compression and to insert the secret message after the quantification matrix , the steps that am following are :
DCT , Quantization , inserting the secret message , Inverse of the quantization , IDCT --> getting the stego image
and in order to extract data am applying on the stego image a 2nd compression:
DCT , quantization , extracting the secret message
The problem is the message extracted is wrong , when i did researches i've found that JPEG is a lossy compression which means using the 2nd compression we will lose the hidded message
It's been more than a month trying to figure it out , but still didn't find any solution
Do you have any suggestions in mind ?
Thank you
Related
So I'm doing real time Audio processing in Python. The good news is, i found this link, which helps me collect data from my PC mic, and plot all the data in real time which is fantastic.
I also found this code from other links, where i can stream the data from Mic to Speaker for a given time.
self.stream=self.p.open(format=pyaudio.paInt16,channels=self.CHANNELS,rate=self.RATE,input=True,
output=True,frames_per_buffer=self.CHUNK)
def stream_data(self):
for i in range(0, int(self.RATE / self.CHUNK * self.RECORD_SECONDS)):
data = self.stream.read(self.CHUNK)
self.stream.write(data, self.CHUNK)
Where my idea diverges from the above link is, I want to apply an FFT to the Microphone data before i send it to the speaker. if I print the 'data' from the above code, i see that it is a whole lot of hexa gibberish that has to converted to decimal format. From the earlier link, I know how to do that as well
data = np.frombuffer(self.stream.read(self.CHUNK),dtype=np.int16)
I have the data that I need in decimal format. But now that i have this data, how can i convert it back to the hexa format after processing, that 'self.stream.write' can understand & output to the speaker. I'm not sure how that gets done.
i believe I've been able to find an answer. so if this might help someone else as well, here is a paper that helped me.
Real-Time Digital Signal Processing Using pyaudio_helper and the ipywidgets
I've used bigtiff library(coming from libtiff to deal with files larger than 4GB) to generate a 8GB image. It can be saved and display successfully, however, it's still to large to be transferred or shared. So I'm trying to compress it with the jpeg support from bigtiff(or libtiff), but it doesn't seem to work for me.
TIFFSetField(out,TIFFTAG_COMPRESSION,COMPRESSION_JPEG);
TIFFSetField(out,TIFFTAG_JPEGQUALITY,30);
TIFFSetField(out,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RGB);
As above, I set the Jpeg quality tag to 30, and the program can be compiled correctly. However, the result turned out to be a image with jpeg quality equaling to 75 with compression ratio 0.99.
Does anyone have any idea about what's going on here or any suggestions?
Thanks,
sunhmy
There is no such thing as a JPEG quality value. Quality settings are simplifications JPEG encoders use to select quantization tables.
One encoder may use a range of 0-100.
Another might use 1-8.
You would need to find out what BigTif uses as its range of "Quality" values. It's 30 may well correspond to your 75.
You might want to play around with different values to find out.
I'm using patternify and pixieengine when i need to make some small graphic elements for my websites. It didn't bother me till now - pixel editor is dead a few days now. Why these websites ? Because of the base64 code compression.
Example:
Patternify - I fill 5x5 px pattern with black color, this is the base64 code i can get:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAEUlEQVQImWNgYGD4jwVTXRAA9qoY6Kb21uEAAAAASUVORK5CYII=
It's short and everything works as i expected.
Now I'll try to make a short base64 code without these sites. I made in photoshop a black square 5x5 the same as above and saved this in every possible format. Next I've found few online encoders but this is what they gave me:
iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAMAAAC6sdbXAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RTM1QjVGOEU0MDkxMTFFM0E5MDlGOUFDNDM5REVCMUQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RTM1QjVGOEY0MDkxMTFFM0E5MDlGOUFDNDM5REVCMUQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpFMzVCNUY4QzQwOTExMUUzQTkwOUY5QUM0MzlERUIxRCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpFMzVCNUY4RDQwOTExMUUzQTkwOUY5QUM0MzlERUIxRCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pg8gB7gAAAAGUExURQAAAP///6XZn90AAAAOSURBVHjaYmDABwACDAAAHgABzCCyiwAAAABJRU5ErkJggg==
Much longer code and the weight of file was similar to the PNG from patternify ~950 B
Patternify has limitation to 10x10 px. So for larger elements i have to use pixieengine, it has exact the same compression level as patternify and no limitation unfortunately it's dead thats why i need to understand now how it really works. Is there any "offline" way to achieve patternify/pixieengine compression level ?
This isn't really a question about base64 encoding, it's about image compression. Base64 encoding is not going to implicitly make your image take up fewer bytes, in fact it makes it take up more (binary vs. a string representation of that binary). Run your original PNG through a good compression tool such as pngcrush and then encode it as base64.
I'm trying to understand the JPEG compression process and performed the following steps to verify a few things.
I take an input image img1.jpg and compress it by using IrfanView, say quality=50 (img1_compress.jpg).
Then I crop a small block from the input image img1.jpg (block.jpg of size 8x8 at X,Y=16,16) and compress it by using the same value of quality parameter (50). Let's call it block_compress.jpg.
Now when I compare this block's pixel values with the one in fully compressed image, they don't match.
To clarify, the pixel value at position 0,0 in block_compress.jpg should match with the pixel value at position 16,16 in img1_compress.jpg.
I'm confused why pixel values don't match? Any ideas?
I just did this experiment with my JPEG codec and the pixel values match. Irfanview may be applying some kind of noise filter or other modifications when it compresses JPEG images. Without seeing the source code to the codec you can't know what it's doing. Your experiment is valid, but by using other people's code to test your theory you can't know what's really going on inside their code.
JPEG is lossy compression algorithm. Compressing one image with identical compression settings in different tools can produce differ result. You need use one of lossless algorithms if you want pixel-to-pixel result. I.e. you can use PNG
"the DC component of each 8x8 block is predicted from the previous block.” : by Oli Charlesworth
I am trying to extract Quantization Table values in c# from different camera images , the Quantization table values are supposed to same for a particular camera model , but what i found is that the Quantization tables are different for a same camera model . Can any body tell me the process of extracting QTables .
Thanks and Regards
Somu
Looks like you have one of the cameras with the variable quantization table.
JPEG viewer available from several sources by entering into the search window*JPEG VIEWER * will lead you to software that can extract the quantazation table that is embedded in JPEG photos. Plus other data such as compression ratio