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 个评论
Walter Roberson
Walter Roberson 2022-2-13
I still do not understand what the purpose of the clicking is.
I also do not understand what a Hessenberg matrix is in this situation.
Are you doing something like an LU decomposition, https://www.mathworks.com/help/matlab/ref/lu.html and then modifying one element of the U matrix, and then multiplying out to construct a modified matrix?

请先登录,再进行评论。

回答(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 个评论
Walter Roberson
Walter Roberson 2022-2-15
Telling me that you cannot do the embedding and extraction correctly does not tell me what code you are using, or what problems you are encountering.
The implied message from posting what you posted is that you expect me to read the article and produce a debugged implementation for you, but I am not going to do that. If I have the resources then I will assist you in debugging your code.

请先登录,再进行评论。


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 个评论
Walter Roberson
Walter Roberson 2022-2-20
In that source for pdfbdec, the file lprec.m duplicates lpdec.m . MATLAB does not consider that to be an error, so the program would not give an error unless the calling sequence happened to be incompatible. But without the correct lprec.m I cannot run the program correctly.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by