title: Store 2D image as an 1D array / Store 2D Matrix as a 1D array
body: <p>So according to many posts, saying that if creating a 2D matrix(array), it's best to create them in 1 dimensional, and use some simple math to convert an index of a 2D to a 1D index.</p>
  
  <p>This is not only faster and more space efficient.</p>
  
  <p>Also, in OpenCV, there's a function (<em>.isContinuous()</em>: <a href="https://docs.opencv.org/2.4/modules/core/doc/basic_structures.html#mat-iscontinuous" rel="nofollow noreferrer">https://docs.opencv.org/2.4/modules/core/doc/basic_structures.html#mat-iscontinuous</a>) for you to check the image you read are stored as continuously or not.</p>
  
  <p>If yes, when looping through each pixel in the image would be more efficient.</p>
  
  <p>I wonder if OpenCV stores an image 1 dimensionally, how do they manage to show the image correctly when showing the image?</p>
  
  <p>Does the show function in OpenCV reshapes the image from 1D to 2D?  Or how do they manage to show 1D data in 2D form?</p>
  
  <p>Thanks in advance!</p>