how to convert an image into bits???

35 ビュー (過去 30 日間)
user06
user06 2015 年 2 月 24 日
回答済み: Walter Roberson 2022 年 1 月 18 日
how we can convert an image into bits ?? and that bits back to image?
  2 件のコメント
Star Strider
Star Strider 2015 年 2 月 24 日
A relatively simple solution (since what you want is quite definitely not obvious) is to scan it, then print the scanned image.
user06
user06 2015 年 2 月 25 日
actually i want to insert the image bits into different image. so i need to convert the image into binary bits..

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

回答 (5 件)

Shoaibur Rahman
Shoaibur Rahman 2015 年 2 月 24 日
It is not clear to me exactly what is your goal? Are you trying to convert image pixels into binary bits? If so, you can use dec2bin for that, and bin2dec to get your image back.
I_in = your image...
% encoding image into array of bits
B = dec2bin(I_in);
C = reshape(B',1,numel(B)); % converted into bits
% decoding image from bits
D = reshape(C,size(B,2),size(B,1));
I_out = reshape(bin2dec(D'),size(I_in))
  16 件のコメント
dung nguyen
dung nguyen 2021 年 11 月 25 日
@Walter Roberson the image has a size of 1920x2560 , i want to convert the image into bit , How can i do , thanks you
Walter Roberson
Walter Roberson 2021 年 11 月 25 日
https://www.mathworks.com/matlabcentral/answers/180075-how-to-convert-an-image-into-bits#answer_169133 shows how.

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


Image Analyst
Image Analyst 2015 年 2 月 24 日
It's already in bits, as are all numbers in computers.
  7 件のコメント
user06
user06 2015 年 2 月 26 日
actually i m working on watermarking.and i need to process each and every pixel of image. and according to the pixel value (whether 0 or 1) i need to take appropriate action.
Image Analyst
Image Analyst 2021 年 6 月 30 日
"actually i m working on watermarking"
See my atttached demo on Least significant bit watermarking.

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


Image Analyst
Image Analyst 2021 年 11 月 25 日
If you want to view bitplanes 0 through 7, as binary images, see my attached demo.

Andy Paulo Ureña
Andy Paulo Ureña 2022 年 1 月 18 日
Hello there! I hope you can help me with this question... I'm simulating a Digital Comm System, so i want to transmit an image and for that i converted that image into a bitstream, i used "imbinarize" function and reshape the matrix into a row vector for the "transmission" which function should i use to make the opposite process for the recosntruction of the image? Thanks!

Walter Roberson
Walter Roberson 2022 年 1 月 18 日
reshape() to reconstruct the image. The remote side will need to know the image size, so either the size will need to be fixed or else you will need to transmit size information.
Note that your process will end up with a black and white image. If you want grey or color then you will need to use something different than imbinarize

Community Treasure Hunt

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

Start Hunting!

Translated by