필터 지우기
필터 지우기

Image watermarking using LSB

조회 수: 3 (최근 30일)
Elysi Cochin
Elysi Cochin 2018년 3월 8일
편집: Guillaume 2018년 3월 8일
Below are few line from LSB image watermarking. Please can someone explain why we divide by 32 in the first code line. Why do we choose 224 and 248 for image2hide and coverImage and not same number or other number
im2hide = bitand(floor(im2hide), 224) / 32;
coverimage = bitand(floor(coverimage), 248);
same way why 7 * 32 is done in decryption line
im2hide = bitand(floor(watermarkedIm), 7) * 32;
  댓글 수: 1
Christoph F.
Christoph F. 2018년 3월 8일
It looks like the code is doing some bit manipulation on the raw pixel data. What image format is used for im2hide?

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

채택된 답변

Guillaume
Guillaume 2018년 3월 8일
편집: Guillaume 2018년 3월 8일
This is simple bit masking and shifting. Whenever you encounter this sort of thing, if you're not familiar with powers of 2, then convert the decimal values to binary to see which bits are actually kept or discarded.
anding with 224 (11100000b) keep the 3 highest bits. Dividing by 32 then shift these bits to the 3 lowest, hence that first line is equivalent to:
im2hide = bitshit(floor(im2hide), -5)
The second line is another masking operation, this time with 11111000b, hence it keeps the 5 highest bit.
The third line is the reverse of the first, it keeps the lowest 3 bits. Then multipliying by 32 shifts these 3 bits to the highest 3 bits, and it is thus equivalent to:
im2hide = bitshift(floor(watermarkedIm), 5);
I'm not sure why the floor are there. If you're dealing with integers (as you should since we're talking about integer bits), they serve no purpose.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by