Results 1 to 12 of 12
Thread: Watermarking process in java
- 03-31-2009, 11:03 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 3
- Rep Power
- 0
Watermarking process in java
I need help in understanding a code. Its related to watermarking concept. My doubt is how to embed a message/a set of bytes into a video file . I mean after converting the video file into byte array.
The video file must be working after the embedding process.
If u can help me please do reply.
If needed I am ready to send the code.
- 03-31-2009, 07:39 PM #2
The basic concept is to embed the watermark in the least significant bits of the video data. There are lots of ways of doing this, including different places and different encoding schemes, affecting how much the video will change and how resistant the watermark is to video editing.
A typical way is to use Huffman coding to add the watermark repeatedly in the lowers bits of the chroma values of every I frame (in MPEG video).
- 04-01-2009, 06:48 PM #3
Member
- Join Date
- Mar 2009
- Posts
- 3
- Rep Power
- 0
Re:WaterMarking
This is the major coding part in embeding a message behind a video.
I cant understand what they have did here.....
--------->Related to Video file
String fileName= masterFile.getName();
masterExtension= fileName.substring(fileName.length()-3, fileName.length());
if(masterExtension.equalsIgnoreCase("jpg"))
{
// Skip past OFFSET_JPG bytes
byteOut.write(byteArrayIn, 0, OFFSET_JPG);
inputOutputMarker= OFFSET_JPG;
}
else if(masterExtension.equalsIgnoreCase("png"))
{
// Skip past OFFSET_PNG bytes
byteOut.write(byteArrayIn, 0, OFFSET_PNG);
inputOutputMarker= OFFSET_PNG;
}
else
{
// Skip past OFFSET_JPG_BMP_TIF bytes
byteOut.write(byteArrayIn, 0, OFFSET_GIF_BMP_TIF);
inputOutputMarker= OFFSET_GIF_BMP_TIF;
}
// Convert the 32 bit input file size into byte array
byte tempByte[]= new byte[4];
for(i=24, j=0; i>=0; i-=8, j++)
{
tempInt= inputFileSize;
tempInt>>= i;
tempInt&= 0x000000FF;
tempByte[j]= (byte) tempInt;
}
// Embed 4 byte input File size array into the master file
embedBytes(tempByte);
// Write the remaining bytes
byteOut.write(byteArrayIn, inputOutputMarker, inputFileSize- inputOutputMarker);
inputOutputMarker= inputFileSize;
// Embed the 3 byte version information into the file
writeBytes(VERSION_BYTE);
// Write 1 byte for features
writeBytes(new byte[]{features});
// Embed 1 byte compression ratio into the output file
writeBytes(new byte[]{(byte) compressionRatio});
-------->Related to Message
// Convery the 32 bit message size into byte array
tempByte= new byte[4];
for(i=24, j=0; i>=0; i-=8, j++)
{
tempInt= messageSize;
tempInt>>= i;
tempInt&= 0x000000FF;
tempByte[j]= (byte) tempInt;
}
// Embed 4 byte messageSize array into the master file
writeBytes(tempByte);
// Embed the message
writeBytes(messageArray);
If you need the coding please tell me i will send u the coding to ur mail... My mail id is tsbarath->gmail
- 04-01-2009, 07:19 PM #4
It appears to be a program to watermark images, not video. It is very simple, only adding the message once, at a point OFFSET_XXX into the file, along with messageSize and compressionRatio.
The way it embeds the message is contained in embedBytes(), which you have not provided.
- 04-01-2009, 07:25 PM #5
Member
- Join Date
- Mar 2009
- Posts
- 3
- Rep Power
- 0
Re:WaterMarking
Ya thats wat i dont understand ...
It looks like watermarking pictures but when i run those file, I am able to watermark a video file.. can i have ur mail id to send u the full file.
- 04-01-2009, 07:32 PM #6
Well, as long as the process to create the byte array from the file, it will be able to watermark any file that will survive low-bits being changed, as long as it lands in the right place. It would be a pretty rubbish video watermark, and apparently a pretty rubbish image watermarker too.
I don't want to give out my email, but if you upload it to the internet and give the link then I'll look at it (and others here will be able to as well).
- 04-16-2009, 08:13 AM #7
Member
- Join Date
- Apr 2009
- Posts
- 10
- Rep Power
- 0
Watermarking in java class file
Hi
I would like to know how to embed watermark in Java class file and decode that watermark class file to get back the watermark value.
I will be appreciate if any one can provide the source code.
I'hv tried many time to get the bytecode of the class file to embed the watermark value but failed. Should i used the class reader to read the class file but where i must to called the class file and how.
I include some code that i don't know where to get my .class inside this code:
package test;
import javax.swing.JOptionPane;
public class ClassLocationTest {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, getClassLocation(String.class));
}
public static String getClassLocation(final Class<?> pClass) {
final String location, name;
name = pClass.getName().replaceAll("\\.", "/") + ".class";
location = ClassLoader.getSystemResource(name).getPath();
return location;
}
}
I hope any one can help me immediately because i must to submit it next week.
Thanks you
Azura
- 04-16-2009, 08:46 AM #8
1. Please don't hi-jack other people's threads
2. Please use [code] tags when posting code
3. Watermarking is used to encode data in files that have high tolerance for corrupted bits. A Java class file is not one of them. You might be able to add Annotations, or obfuscate some code, but steganograpic techniques are not possible.Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 04-16-2009, 12:43 PM #9
Member
- Join Date
- Apr 2009
- Posts
- 10
- Rep Power
- 0
i notice that we can embed watermark in attribute from the class file that we choose.
- 04-16-2009, 01:24 PM #10
Not sure what you mean by "watermark" or "attribute" in this context.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 05-06-2011, 07:13 PM #11
Member
- Join Date
- May 2011
- Posts
- 1
- Rep Power
- 0
Audio Steganography
Hey Frds...Will you please help me in my audio Steganography Project. i have some doubt in following coding.
// Convert the 32 bit input file size into byte array
byte tempByte[]= new byte[4];
for(i=24, j=0; i>=0; i-=8, j++)
{
tempInt= inputFileSize;
tempInt>>= i;//tempInt=tempInt>>i;
tempInt&= 0x000000FF;
tempByte[j]= (byte) tempInt;
}
Why and How to Convert 32 bit input file size into byte array....?
Will anyone explain me this coding?
Please I have a Project Submission on Monday(09/5/2011).
-
Please do not hijack another's thread with your question. Go to the correct forum, click on the "New Thread" button and create your new question. I'm locking this thread and will delete your post and mine in a few.
Similar Threads
-
How to find OS Process List in JAVA ?
By abstrusevaibhav in forum New To JavaReplies: 0Last Post: 01-29-2009, 10:08 AM -
Java subprocesses via Runtime.exec() and windows "end process tree"...
By fxRichard in forum Advanced JavaReplies: 2Last Post: 01-06-2009, 03:53 PM -
killing a java process
By paritoshcg in forum Advanced JavaReplies: 3Last Post: 12-01-2008, 08:16 AM -
There's not enough memory to process the command. at java.io.FileInputStream
By mary in forum New To JavaReplies: 1Last Post: 08-03-2007, 06:17 PM -
Linux process from java
By Ed in forum New To JavaReplies: 2Last Post: 07-04-2007, 05:03 AM


LinkBack URL
About LinkBacks

Bookmarks