I want to do the embedding operation by converting Hessenberg

조회 수: 4(최근 30일)
Hello,
I divided an image into 4x4 blocks and selected blocks randomly. Now I want to click on the selected Hessenberg matrix on these selected blocks and embed a binary image in the Hessenberg matrix. Thank you for your help.
  댓글 수: 5
javad danesh
javad danesh 2022년 2월 13일
편집: javad danesh 2022년 2월 13일
Yes, I want to do that.

댓글을 달려면 로그인하십시오.

답변(2개)

Walter Roberson
Walter Roberson 2022년 2월 14일
Cover_filename = 'flamingos.jpg';
watermark_filename = 'cameraman.tif';
CoverImage = imresize(imread(Cover_filename), [256 256]);
watermarkImage = imresize( imread(watermark_filename), [8 8] );
watermarkBits = reshape((dec2bin(watermarkImage, 8) - '0').', 1, []);
num_watermarkBits = numel(watermarkBits);
image_blocks = mat2cell(CoverImage, 4 * ones(1,size(CoverImage,1)/4), 4 * ones(1,size(CoverImage,2)/4), ones(1,size(CoverImage,3)));
num_image_blocks = numel(image_blocks);
if num_image_blocks < num_watermarkBits
error('watermark image is too big to store in the cover image');
end
selected_blocks = randperm(numel(image_blocks), num_watermarkBits);
new_blocks = image_blocks;
displayed_once = false;
for idx = 1 : num_watermarkBits
blocknum = selected_blocks(idx);
thisblock = image_blocks{blocknum};
[P, H] = hess(double(thisblock));
H1 = typecast(H(1,end), 'uint64');
H1 = typecast(bitset(H1, 64, watermarkBits(idx)), 'double');
reconstructed_block = cast(P * H * P', class(thisblock));
new_blocks{blocknum} = reconstructed_block;
end
watermarkedImage = cell2mat(new_blocks);
figure(); imshow(CoverImage); title('Cover image');
figure(); imshow(watermarkImage); title('image to watermark with');
figure(); imshow(watermarkedImage); title('image after watermarking');
imshowpair(CoverImage, watermarkedImage)
Watermarked image is the same as the original image.
  댓글 수: 8

댓글을 달려면 로그인하십시오.


javad danesh
javad danesh 2022년 2월 15일
No, I do not want you to read the article. Using the quantization method you mentioned, I want to place watermark bits in the overlay image in 4x4 block using the random function. But we also use this random function in the extraction so that the watermark is extracted correctly.
I used the following code.
for i=1:num_watermarkBits
[row col]=ind2sub([si_b(1),si_b(2)],s_r(i));
[P_R,H_R]=hess(double(b_r{row, col}));
[m,p]=max(H_R(:));
if bw_R(i)==1
H_R(p)=m-mod(m,T)+(T*0.75);
elseif bw_R(i)==0
H_R(p)=m-mod(m,T)+(T*0.25);
end
H_invR=P_R*H_R*P_R.';
b_r{row, col}=H_invR;
  댓글 수: 11
javad danesh
javad danesh 2022년 2월 20일
I used the functions inside this folder.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by