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
2022년 2월 12일
Okay, so you break an image into blocks that are 4 x 4 x number_of_color_panes . And you select blocks out of that randomly.
Then, having selected blocks randomly, you want to proceed randomly selected block by randomly selected block, and for each one have the user click on something that is within 4 x 4 blocks ? The blocks are only 4 x 4 x 1 (grayscale) or 4 x 4 x 3 (RGB), so it is not obvious to me where you would find a Hessenberg matrix inside the 4 x 4 x 1 or 4 x 4 x 3 area? I guess it is possible, if you were having the user point out a 1 x 2 or 2 x 1 sub-matrix, I guess? And then a complete binary image is to be embeded within the selected Hessenberg matrix ?
Part of my confusion is that I do not know what you mean by a Hessenberg Matrix in this context? Or how you could embed a complete binary image inside a matrix that is going to be at most 2 x 1 x 3 or 1 x 2 x 3 ? (If it was going to be the full 4 x 4 x 1 or 4 x 4 x 3 then there would not be any point in having the user click to select a Hessenberg matrix inside the selected block -- you would just use the complete selected block.)
javad danesh
2022년 2월 12일
I divide a 256 x 256 color image into three rgb channels. Then I divide each channel into 4x4 blocks (4x4 matrix). For example, the r channel becomes 64x64 blocks (4x4). Now we select a few blocks at random and with the Hessenberg matrix(hess), we calculate the upper triangular matrix and embed one bit instead of the maximum upper triangular matrix.
javad danesh
2022년 2월 12일
In the process of watermark embedding, the watermark information is embedded into the biggest energy element of the Hessenberg matrix by quantization technique.
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
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
2022년 2월 14일
This is great. But psnr is equal to infinity, and ssim is one. Is the embedding done correctly?
Walter Roberson
2022년 2월 14일
No, embedding is not done correctly according to your earlier specifications. You indicated earlier that you wanted to break up the image into three channels, and then break each channel up into 4 x 4 blocks. If you look carefully what I do instead here take the original RGB image and break it up into 4 x 4 x 1 blocks (getting 64 x 64 x 3 blocks), and select from them randomly -- instead of working on entire channels at a time. Working one channel at a time is a change you could make.
Also, earlier you indicated "the watermark information is embedded into the biggest energy element of the Hessenberg matrix by quantization technique.". I do not know what is meant by "the biggest energy element of the Hessenberg matrix". Perhaps you mean the entry with the largest absolute value? That would match what you said about "and embed one bit instead of the maximum upper triangular matrix."
I also do not know what quantization technique you intend to use.
I did not look at the entry with the largest absolute value. Another meaning for "maximum upper triangular matrix" is the entry that is furthest from the diagonal -- which would be the entry at index (1,end) . That is the meaning I used for "maximum upper triangular matrix".
As you said "embed one bit", that is what I did -- I changed the least significant bit of a particular entry. I did not do any mathematical analysis to figure out whether changing the least significant bit of a floating point number would have any effect when reconstructing the matrix. I would tend to doubt that it would change anything (most of the time) as the absolute value of changing the bit is likely to be only on the order of 10^-13 or so, which is probably not going to matter.
As I have shown you the structure of the program, you can now to change the for idx = 1 : num_watermarkBits loop as appropriate. I show in the code there how to get at the content of one of the blocks; I show how to compute hess(); I show how to modify one bit to a new value, and how to reconstruct the matrix and store it back. You should be able to advance the code from here.
javad danesh
2022년 2월 14일
The meaning of the largest Hessenberg matrix is as follows.

The embedding method is as follows.

Walter Roberson
2022년 2월 15일
편집: Walter Roberson
2022년 2월 15일
h_max__star = h_max - mod(h_max, T) + 0.25*T + 0.5*T*watermarkBits(idx)
... whatever T is here.
Use the two-output form of max(abs(H(:))) to find the element of H that has the largest absolute value
javad danesh
2022년 2월 15일
This is an article I want to simulate. I only encountered the watermark during the embedding stage and I can not do the embedding and extraction work accurately.
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
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
2022년 2월 15일
You need to uint8(H_invR) unless you used im2double() when you read it and cover image.
Walter Roberson
2022년 2월 15일
A challenge in using a random placement of bits when you embed a watermark, is knowing where to look for the bits when you go to extract the bits.
Common strategies include:
- using fixed positions instead of random positions
- using a fixed algorithm for the positions that depends upon the image size
- using a pseudo-random placement with a fixed seed; this is equivalent to using a fixed algorithm that depends on the image size
- using a pseudo-random placement but embed the seed at fixed positions in the image (be careful that noise does not ruin the possibility of retrieving the seed information)
- using the information from all of the other bit planes to compute a seed for pseudo-random placement (again, watch out noise ruining reconstruction by ruining the seed)
If you embed information about how to find the bits into the image, you should be asking yourself what the fewest number of bits is that could be corrupted by noise, that would ruin the possibility to recover the position information.
(It is also a good idea when thinking about watermarks, to ask whether you would still be able to recover the watermark sufficiently well if someone had resized the image and then resized it back... or even just resized the image. Can you recover if the image were to be resized by 50% for example?)
javad danesh
2022년 2월 15일
When watermark is extracted, the watermark image is extracted along with the noise. And I can not understand why.
Walter Roberson
2022년 2월 16일
Imagine that you have two neighbors.
One of them says to you, "My car is making a funny noise and I do not understand why".
The other says to you, "This here is my car, and here are my keys in case you need to test it. When I make a left hand turn when I am going more 30 km/hour, there is a scraping noise from the right rear wheelwell area, and the noise goes away about 2 seconds after I straighten the wheel, not immediately; also there is a scraping noise after I go over big bumps."
Imagine that your time is limited. Which of the two are you going to help?
You glance at the car that is sitting right there and you see that it is a 1973 AMC Pacer. You remember that in the early 70s that some of the AMC had defective struts. With the car being that old, it might be a fair bit of work to fix. Or perhaps it is just that the shocks are gone, and that might not be nearly as bad. You have the car right there and you can go for a test drive to narrow down the possibilities.
The other car? "Funny noise" could mean anything from "forgot to take the box off the windshield wiper" to "never had a car with a continuous differential before and that's just how it sounds normally" to "needs a complete engine and engine box replacement". Might be a trivial amount of work, might be a lot of work, you don't know. You do know that when you have asked the neighbor questions before, they seldom give you a straight answer.
You only have time for one of the two. Which one are you going to pick?
javad danesh
2022년 2월 19일
편집: javad danesh
2022년 2월 19일
The example was quite good and complete. Maybe I could not fully explain my problem. Can I send the complete code?Maybe with the code I can get what I mean.
I did the simulation. I went to the next step, and got a good psnr and ssim output. But the output watermark image has noise.

Walter Roberson
2022년 2월 19일
You can attach the code here and perhaps someone will have a look at it . Please do not send it to my email.
javad danesh
2022년 2월 19일
Walter Roberson
2022년 2월 19일
javad danesh
2022년 2월 19일
yes. I took the original image to rgb space, then clicked the converter on it and selected the low frequency image for embedding. Continue the low frequency image to be converted into non-overlapping 4x4 books and then randomly selected blocks for embedding and embedding is done by Hessenberg conversion. I took the watermark image to space and converted it to Arnold. Then it was converted to 8-bit by quantization technique.
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!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다: .
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)