# I want to do the embedding operation by converting Hessenberg

조회 수: 4 (최근 30일)
댓글: javad danesh 2022년 2월 20일
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이전 댓글 3개 표시이전 댓글 3개 숨기기
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?
편집: javad danesh 2022년 2월 13일
Yes, I want to do that.

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

### 답변 (2개)

Walter Roberson 2022년 2월 14일
Cover_filename = 'flamingos.jpg';
watermark_filename = 'cameraman.tif';
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이전 댓글 6개 표시이전 댓글 6개 숨기기
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.
Yes, Sure.

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

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이전 댓글 9개 표시이전 댓글 9개 숨기기
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.
I used the functions inside this folder.

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

### 카테고리

Help CenterFile Exchange에서 Watermarking에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by