How to convert an image into an array of numbers ( or in other words a matrix)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zceef05
    New Member
    • Feb 2010
    • 2

    How to convert an image into an array of numbers ( or in other words a matrix)

    I want to know how we could convert an image into an array of numbers. Furthemore coud you pleezzzzz tell me how we cud rotate this matrix ( please note te commands of java shud be rotating the matrix by 90 degrees) this shud eventually rotate the image too.

    Pleezz reply as early as possible pleezzz.
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    Read the image byte by byte and put each of them into your 2-dimensional array (matrix).
    Then you can rotate the array (90 degree) by copying all rows to lines in a loop: originalArray[x][y] = resultingArray[y][x].
    Then write all the values back byte by byte.
    An image consists of an image header followed by (most likely compressed) pixel data. So don't rotate the image header! And uncompress the data first; some Image-API will help you doing so.

    Comment

    • zceef05
      New Member
      • Feb 2010
      • 2

      #3
      Thanks

      Thanks alot for your help!!! Cud u tell me how do we look at each bit/ pixel of the picture.. COuld you please write an example of codes for me on how to convert picture into matrix of numbers....

      Regards

      Comment

      Working...