matlab - Convert bitmap to binary values -


i convert bitmap file array consisting of binary values; when use script:

arr=imread('sample.bmp'); arrbin=cell(1140,912,3); i=1:1140     j=1:912         k=1:3             arrbin(i,j,k)=dec2bin(arr(i,j,k));         end;     end; end; 

the debug info shows this:

conversion cell char not possible.  error in imgproc (line 9)             arrbin(i,j,k)=dec2bin(arr(i,j,k));  >>  

is there anyone? in advance.

your solution going slow on big images. better this:

i=imread('sample.bmp'); a=dec2bin(i,8);%8bit % how index array i=5;j=35;ch=2; pixel=a(sub2ind(size(i),i,j,ch),:) 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -