Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,556 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,605 people online right now. Registration is fast and FREE... Join Now!




Image Steganography

 
Reply to this topicStart new topic

Image Steganography, Image Steganography in C

Guardianva
3 Dec, 2007 - 12:07 PM
Post #1

New D.I.C Head
*

Joined: 3 Dec, 2007
Posts: 2


My Contributions
I'm working on a masters in Modeling & Simulation and have found myself in a Digital Imaging class that requires a fair amount of C programming. I have made to the end, but the final project has taxed my very limited (read basic) C/C++ programming skills.

The program is two fold. Write a program that will embed an image (in my case a PGM grey scale file) into a (PPM) color image. The second part will be to write an extraction program, but until I know how I got it in I can't pull it out.

I have finally figured out how to read two files, without corrupting the data. The image to be inserted (imageb) and the host image (imagea) is the target PPM file.

I have a check routine to make sure there is enough space for the image to fit. I also output the size of the grey image so that I have the parameters to pull it out when I write the extraction program.

The file reading code is class provided, so that doesn't need adjusting. It reads to know if the file is a PPM or PGM file.

I am going to use the least significant bit method when I am finished, but for now I am embedding on the MOST significant bit in order to see if the embedding is happening. When that is successful I will shift the the least significant bit.

To keep everything simple I am also dropping the two least significant bits of the gray image so that I can pair the gray image bits 7 & 6 to band O (red), bits 5 & 4 with band 1 (green), and bits 3 & 2 with band 2 (blue).

The logic, as I understand it, and what I am having trouble with is sequencing from band 0 after loading the new bits and writing, then going to band 1 to do the same, and then on to band 2 to finish the routine and then advance the grey image to the second pixel. The color image advances three times for each single advance of the grey image.

Attached is my CPP code file.

Thanks,
Guardianva


Attached File(s)
Attached File  Code.txt ( 11.07k ) Number of downloads: 419
User is offlineProfile CardPM
+Quote Post

William_Wilson
RE: Image Steganography
3 Dec, 2007 - 08:29 PM
Post #2

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,101



Thanked: 25 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
Although the code is Java, I feel this may help.
http://www.dreamincode.net/forums/showtopic27950.htm
It explains the general logic of adding bytes to an image, if you modify some of the basic functions into C++ code to deal with your image types, the switch should be rather trivial.
I have not had time to finish a Steganography in C++, I would be very interested to see how you make out, or help you out here as you go along smile.gif
User is offlineProfile CardPM
+Quote Post

Guardianva
RE: Image Steganography
3 Dec, 2007 - 09:15 PM
Post #3

New D.I.C Head
*

Joined: 3 Dec, 2007
Posts: 2


My Contributions
QUOTE(William_Wilson @ 3 Dec, 2007 - 09:29 PM) *

Although the code is Java, I feel this may help.
http://www.dreamincode.net/forums/showtopic27950.htm
It explains the general logic of adding bytes to an image, if you modify some of the basic functions into C++ code to deal with your image types, the switch should be rather trivial.
I have not had time to finish a Steganography in C++, I would be very interested to see how you make out, or help you out here as you go along smile.gif


Thanks WW, there may be something in here I can use. I'll study it in detail as soon as I am able. Again, thanks. G
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/7/09 09:55PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month