Matlab axis problems
In summary terms
Row Óyó High Ó vertical
Column Óxó width ó level
2 photos in Maplab
1. Jpg
Width (column): 320 high (ROW): 482
Show in MATLAB
2. Jpg
Width (column): 480 High (ROW): 360
First of all to clarify the two concepts: the processing object is a picture or a corresponding matrix (true color image return 3-dimensional matrix, gray value image return two-dimensional matrix)
If the object being processed is a picture, the following concepts are involved
1) coordinates origin: upper left corner
2) X: Horizontal Direction
3) Y: Vertical Direction
4) Image size: Width: Horizontal Height: Vertical direction
If the object being processed is a matrix, the following concepts are involved
1) Line: Vertical direction equivalent to Y
2) Column: Horizontal direction equivalent to X
Example
One processing object for picture
1.
>> imfinfo (' 1.jpg ')
Get:
width:320
height:482
>> imfinfo (' 2.jpg ')
width:480
height:360
2. Image clipping
I2=imcrop (I,rect) and RECT is an optional parameter,
The format is [XMIN ymin wigth HEIGHT]. For example [20 20 40 40], the upper-left pixel of the cropped image is the pixels of the original image position (20,20), and the lower-right pixel of the cropped image is the pixels of the original image position (60,60).
>>imshow (B)
>> C=imcrop (b,[300,5,200,100]);
>> Imshow (C)
Get:
The second processing object is a matrix
1) Size
True Color Image Returns a 3-dimensional matrix, grayscale value image returns two-dimensional matrix
Two-dimensional matrix matlab size (A): Returns row x column
Three-dimensional matrix matlab size (A): Returns the row x column x3,3 represents the color channel
>> a=imread (' 1.jpg ');
>> b=imread (' 2.jpg ');
>> size (A)
Ans =
482 320 3
>> size (B)
Ans =
360 480 3
2) Imresize
B = Imresize (A, [NumRows Numcols])
NumRows and Numcols Specify the height and width of the target image, respectively. It is obvious that because this format allows image scaling and the length-to-width ratio of the source image is not the same, the resulting image may be distorted.
>> Resize1=imresize (a,[50 500]);
>> Imshow (RESIZE1)
Get like:
Matlab axis problems