user602774
user602774

Reputation: 1103

Represent a image as a matrix matlab

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

Upvotes: 7

Views: 19350

Answers (3)

Marcin
Marcin

Reputation: 238877

imread can read your image file as a matrix.

Upvotes: 2

mpenkov
mpenkov

Reputation: 21912

Have a look at this question.

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

Upvotes: 2

Jonas
Jonas

Reputation: 74940

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

Upvotes: 13

Related Questions