MATLAB Answers

how to convert an image into bits???

조회 수: 297(최근 30일)
user06
user06 24 Feb 2015
댓글: Walter Roberson 14 Mar 2017
how we can convert an image into bits ?? and that bits back to image?

  댓글 수: 2

Star Strider
Star Strider 24 Feb 2015
A relatively simple solution (since what you want is quite definitely not obvious) is to scan it, then print the scanned image.
user06
user06 25 Feb 2015
actually i want to insert the image bits into different image. so i need to convert the image into binary bits..

로그인 to comment.

답변(2개)

Shoaibur Rahman
Shoaibur Rahman 24 Feb 2015
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))

  댓글 수: 11

표시 이전 댓글 수: 8
Sanjeev Tyagi
Sanjeev Tyagi 14 Mar 2017
B: Cannot display variables with more than 524288 elements.
C: is displaying the binary stream
D: Cannot display variables with more than 524288 elements.
I: is working
I_out: working
Dear Shoaibur Rahman, Ur code is usefull for me.
My purpose is search the Binary-pattern into binary stream of color image, then I want to implement the concept of Steganography for my research.
Please please provide me the code to search the binary-pattern into file of binary-stream of Colored image,
Please help me, how to solve given problem
B: Cannot display variables with more than 524288 elements.
D: Cannot display variables with more than 524288 elements.
Sanjeev Tyagi
Sanjeev Tyagi 14 Mar 2017
In MATLAB variables values are not displayed of following variables
B: Cannot display variables with more than 524288 elements.
C: is displaying the binary stream
D: Cannot display variables with more than 524288 elements
so Binary stream could not be displayed, please help me
Walter Roberson
Walter Roberson 14 Mar 2017
524288 elements is 512 x 1024. If you were to display more than that many elements at the same time, you would be devoting an average of less than 2 pixels each to them. At that point you should be considering using imagesc() to display the array.
You cannot get around the 524288 limit; it is built-in to MATLAB. If you need to use the variable browser to look at part of the array, then extract a portion of the array that is no more than 512 x 1024 (or 1024 x 512) and assign it to a variable and view that variable.
Or just disp() the entire array.

로그인 to comment.


Image Analyst
Image Analyst 24 Feb 2015
It's already in bits, as are all numbers in computers.

  댓글 수: 6

표시 이전 댓글 수: 3
Image Analyst
Image Analyst 25 Feb 2015
See my attached demo for copying and pasting an image or portion of an image that you specify into a bigger image.
Image Analyst
Image Analyst 25 Feb 2015
Please describe what you want. No one can figure it out. I just gave you code to do copying and pasting. Is that what "insert the image bits into different image" means? Who knows? Only you. Or perhaps you mean watermarking or steganography, though you didn't add any tag for those concepts so I have my doubts. But your imprecise language leaves them as possibilities. Will you clear up exactly what you want? I have a demo for LSB Steganography if that's what you want, but I have hundreds of demos and I can't post them all, so let me know if you're working on steganography.
user06
user06 26 Feb 2015
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.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by