Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Represent a image as a matrix matlab

Tags:

matlab

How can I represent an image as a matrix in Matlab?

like image 864
user602774 Avatar asked Feb 15 '11 14:02

user602774


2 Answers

As soon as you've loaded the image into Matlab, it is represented as a matrix. For example

>> A = imread('peppers.png');
>> size(A)
ans =
   384   512     3

A is a 384-by-512-by-3 array, representing an RGB image, where e.g. A(:,:,1) is the red channel

like image 166
Jonas Avatar answered Sep 20 '22 23:09

Jonas


Have a look at this question.

Basically, start with the imread function, and take it from there.

like image 32
mpenkov Avatar answered Sep 23 '22 23:09

mpenkov