matlab image processing question - very basic one

Status
Not open for further replies.

abhigopal

Member level 3
Joined
Dec 21, 2004
Messages
61
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
624
Hi all
I am faced with a very basic problem .
I have some images which are all gray scale ones (black and white, no color ones).
I use MATLAB 7.0 to read these images and express these images in matrix format
When i use imread('filename'), i get a matrix which is of order M x N. However, I want to perform certain matrix related operations to this matrix and i want a square matrix of order N x N. How will I get a square matrix from Matlab. Do I have to resize my image such that I get a square matrix. Maybe play around with it a bit using Photo shop. Please help
thanks in advance
 

if you want a square image on way is

if suppose a contains the image in M x N

you want to take the sub image with O x O

where O < M and O < N

you can simply take

B[1:O,1:O]= A[1:O,1:O]

or you want the full image you can padd other values to either zero or one

O>M or (or) and O>N


zero(B(O,O));
B[1:M,1:N]= A[1:M,1:N]


(there may be some small errors like camma or brackets in the above program i used matlab 2 years before)
 

Hi...

You can use 'imresize' function...
 

    abhigopal

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…