フィルターのクリア

How return my image from binary to grayscale

5 ビュー (過去 30 日間)
hudof najeeb
hudof najeeb 2016 年 12 月 29 日
コメント済み: snehal gaikwad 2020 年 10 月 3 日
I hide my image "mouse" in image " pigs". Firstly I convert the image "mouse" to binary in encryption code .secondly I return it from decryption code .Now I want to return it to gray-scale. how can help please.
encryption code
main = imread('mouse.tif');
cover = imread('pigs.tif');
main2= im2bw(main);
bitNo = 1;
steg = zeros(size(cover), 'uint8');
for i = 1:size(cover,1)
for j = 1:size(cover,2)
coverTmp = dec2bin(cover(i,j), 8);
msgTmp = dec2bin(main2(i,j));
coverTmp(9-bitNo) = msgTmp;
steg(i,j) = bin2dec(coverTmp);
end
end
imwrite(steg,'S1.tif');
decryption code
stego = imread('S1.tif');
steg1 = zeros(size(stego));
for i = 1:size(stego,1)
for j = 1:size(stego,2)
mTmp = dec2bin(stego(i,j), 8);
msTmp = mTmp(9-bitNo);
steg1(i,j) = bin2dec (msTmp);
end
end
grayImage = 255*uint8(steg1);
figure, imshow(grayImage);
  2 件のコメント
Image Analyst
Image Analyst 2016 年 12 月 29 日
You forgot to attach s1.tif, mouse.tif, and pigs.tif. If you want an bitplane watermarking demo, see my attached demo.
hudof najeeb
hudof najeeb 2016 年 12 月 30 日
thank you it is very useful.

サインインしてコメントする。

回答 (1 件)

John D'Errico
John D'Errico 2016 年 12 月 29 日
編集済み: John D'Errico 2016 年 12 月 29 日
If your image is at the end in binary form, so 0-1 only, then nothing can convert it back into a full grayscale, with additional information per pixel. You have thrown that information away. That information is lost forever. If you wanted to retain more information, then you needed to do a better job of storing the additional information before you lost it.
  1 件のコメント
snehal gaikwad
snehal gaikwad 2020 年 10 月 3 日
if we have rescaled the binary image which gives area of interest from grayscale image then how we can convert binary image back to that input garyscaled image of same size (size of resized binary image)

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by