title: Reshaping Binary images into 1D vector Python
body: <p>I am working on an Image Processing Project and I am a beginner in Python. Any help would be appreciated.I am trying to convert matlab code to python.Below is my matlab code-</p>
  
  <pre><code>file_name='play.png';
  message=double(imread(file_name));
  Mm=size(message,1);                         %Height
  Nm=size(message,2);                         %Width
  message_vector=round(reshape(message,1200,1)./256);
  disp(message_vector)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/O4fVU.png" rel="nofollow noreferrer">Output of matlab code</a></p>
  
  <p>Below is python code</p>
  
  <pre><code>water = cv2.imread('sam.png')
  gray_image = cv2.cvtColor(water, cv2.COLOR_BGR2GRAY)
  file_name=im2double(gray_image)
  a=np.shape(gray_image)
  b=a[0]*a[1]#getting resolution
  images_rs = gray_image.reshape([b, 1])#reshaping array into 1D vector
  print(images_rs)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Ot0aZ.png" rel="nofollow noreferrer">Output of python</a></p>
  
  <p>I want output like what i get for matlab code with 1 and 0. How can i get that?Where I made mistake in python as the answer in python is not same as Matlab?</p>