MATLAB: How to store pixels of MxN bitmap image into MxN array

Image Processing Toolboxpixels

I want to store an image pixels into an array. So please guide me to store an binary image into an array of size equals to the image size.

Best Answer

YourImage = imread('NameOfImage.tif');
grayImage = rgb2gray(YourImage);
level = graythresh(grayImage);
bwImage = im2bw(grayImage, level);
now bwImage is a binary image the same number of rows and columns as your original image.
Related Question