How to embed image watermark bits into histogram of the audio file?

I have an image watermarks that is converted into binary bits and histogram of an audio wav file. I need to embed the watermarking bits in the histogram.
close all;
clc;
% read image
[embededimage_fname, image_pthname] = ...
uigetfile('*.jpg; *.png; *.tif; *.bmp', 'Select the Cover Image');
if (embededimage_fname ~= 0)
embedded_image = strcat(image_pthname, embededimage_fname);
embedded_image = double( rgb2gray( imread( embedded_image ) ) );
embedded_image = imresize(embedded_image, [512 512], 'bilinear');
else
return;
end
% read audio
[watermarkAudio_fname, watermark_pthname] = ...
uigetfile('*.wav', 'Select the Watermark audio');
if (watermarkAudio_fname ~= 0)
watermark_audio = strcat(watermark_pthname, watermarkAudio_fname);
[n, fs] = audioread(watermark_audio); % "n" is number of samples and fs is the sample rate
%watermark_audio = imresize(watermark_audio, [512 512], 'bilinear');
else
return;
end
imbin_seq = reshape(dec2bin(embedded_image, 8) - '0', 1, []);
% To calculate modified mean
na = 2^15;
n = n*na;
nLength = length(n);
modified_mean = mean(abs(n));
% Embedding Range
lmda = 2.4; %pick any value of lmda from the range (2.0, 2.5);
e_range = ceil(lmda * modified_mean);
%number of bins and Bin Width
h = histogram(n);
Bin_Num = h.NumBins();
Bin_Width = h.BinWidth();
Now, my next step is selecting three consecutive bins of the histogram and then 1 bit of watermark is embeded into these 3 bins. I am not getting how to this embedding, suggest me how to perform this watermarking??
Thanks in Advance!!!!

12 Comments

This is an algorithm question rather than a MATLAB question.
I do not understand how watermarking the audio histogram would be of any use with a cover image since you are not embedding the audio in the image. I could understand if you were embedding audio bits into the histogram of the image with an image result.
Yes, I have binary bits of image and histogram of an audio file. I need to divide all bins into several groups, each group including 3 consecutive bins. For each group, one bit of watermark is embedded by reassigning the number of samples in this group of three bins. Then, The watermarked audio is obtained by modifying a small set of samples in the original audio signal. I am using MATLAB for Implemention of this watermarking.
That I want to do in watermarking. I stucked in how to divide into groups and afterwards.
Supposing that you had the watermarked audio: then what? What does it have to do with the image? And remind me where you are getting the bits to watermark into the audio ??
Normally you would either use bits of the image to watermark the audio, or bits of the audio to watermark the image, but at the moment you just have an image floating around unused, and you have an audio that is being used to watermark itself.
Sir, Actually What I am going to do is that Initially I have an cover image. On this cover Image, I had performed Image Watermarking(implemented succesfully ). Next On result of that , I have to perform Audio Watermarking with help of histograms (means hide the image in the audio) and the Output of that procedure(Watermarked Audio) will be robust against attacks. this is an Approach .
Thats why I need group of bins of histogram.
Is still something left which is unclear to you Sir, Walter Roberson.
robust against attacks would be difficult .
this is not a matlab question . you should be research in papers and literature .
Yes, I did that literature part. Currently I am in Implementing phase of it. I am not so familiar to MATLAB thats why I asked that question of grouping of hitogram`s bin where each group have 3 consecutive bins.
v = h.Values;
next_3 = ceil(Bin_Num/3)*3;
augmented_v = nan(1, next_3);
augmented_v(1:Bin_Num) = v;
bins_by_3 = reshape(augmented_v, 3, 1);
Now every column of bins_by_3 is a group of three bin counts, except that the last one or two entries of the last column will be nan if the number of bins was not a multiple of 3.
Note that some of the counts might be 0.
If it is acceptable to have the final values (where number of bins is not a multiple of 3) be 0 instead of nan, and you have the signal processing toolbox, then the above code can be replaced with
bins_by_3 = buffer(h.Values, 3);
Sir, what is the requirement of the 4th line, if we already have these values in augmented_v eariler.
augmented_v(1:Bin_Num) = v;
The line before that creates augmented_v as all nan and a length that is a multiple of 3.
The line you indicate assigns the actual v to the the beginning of the array, leaving nan in the spaces needed to pad with.
Another way of writing this would have been
augmented_v = [v, nan(1, next_3 - Bin_Num)];
which would start with the existing v and then add on 0, 1, or 2 nan as needed to make the overall a multiple of 3 long.
Sir, How will i acces the groups of bins_by_3 such that 3 bins anyone`s is used for embedding?
Can we access it like a multi-dimensional array?
it is a 2d array . Each column is a group of 3 bins.

Sign in to comment.

Answers (0)

Asked:

on 9 Mar 2019

Commented:

on 13 Mar 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!