How to read an image & convert it into an array and vice versa

5 views (last 30 days)
Muhammad Abdulrazek
Muhammad Abdulrazek on 18 Nov 2021
Commented: Jon on 18 Nov 2021
Hello ,
how to convert an image to 1x2 array & be able to do the inverse ?

Answers (1)

Jon
Jon on 18 Nov 2021
Edited: Jon on 18 Nov 2021
You can use MATLAB's imread and imwrite functions for this.
On the command line you can type doc imread to get documentation for imread, similarly doc imwrite for imwrite.
By the way I think you meant convert an image to an m x n array, an 1x2 array would only have one row and two columns.
  2 Comments
Jon
Jon on 18 Nov 2021
The only image appears to be in the variable that you call original. The variables that you call Original_Data and DecryptedText are just arrays with two elements (1 row by 2 column). There is no image in Original_Data it is just two numbers.
If you want to display the image in the variable you call original, you can use the functions image or imagesc

Sign in to comment.

Categories

Tags

Products


Release

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!