1、imshow 功能:显示读取的图像调用格式: imshow(I,n); %I 代表所显示的灰度图像的数据矩阵,n 为整数,代表所要显示图像的灰度等级数,默认值为 256; imshow(I,[low,high]); %[low,high]为图像数据的值域。2.subimage 功能:在一个图形窗口中显示多幅图像调用格式: subimage(X,map); subimage(I); subimage(RGB); subimage(x,y, …); h=subimage(…); 3. imresize 功能:对图像进行放大和缩小处理调用格式: B=imresize(A,m,method); % A 为原图句柄,m 为放大倍数,method 用于指定插值方法, 可选的值为‘nearest’,‘bilinear’,‘bicubic’, 默认值为‘nearest’; B=imresize(A,[mrows,mcols],method); %返回一个 mrows 行、ncols 列的图像, 若与原图的长宽比不同,则图像会产生变形; 4. imrotate 功能:对图像进行旋转处理调用格式: |
B=imrotate(A,angle,method); %method 含义同上B=imrotate(A,angle,method,’crop’); %一般来说,旋转后的图像会比原图大, 用户可以指定‘crop’参数对旋转后的图像进行剪切(取图像的中间部分),使返回的图像与原图像大小相同。 ‘loosed’保持旋转后的大小 5.imcrop 功能:对图像进行剪切处理。用函数 imcrop 实现对图像的剪切。该操作剪切的是图像中的一个矩形子图,用户可以通过参数指定这个矩形四个顶点的坐标,也可以交互地用鼠标选取这个矩形。 调 用 格 式 : I2=imcrop(I,rect); X2=imcrop(X,map,rect); RGB2=imcrop(RGB,rect); %按指定的矩形框剪切图像 imcrop(name,[xmin,ymin,wedth,height]); imcrop(name); //鼠标操作 [k,rect]=imcrop(name); rect可返回选择的四个点的坐标 |
直方图均衡化 name1=histeq(name);
在对数据进行处理时,有时我们需要对含有小数的数据进行取整处理,本例分享matlab里面常用的几种取整函数,fix、round、floor、ceil
-
7.6806 3.5388 3.6130 9.0150 8.1769 3.1781
2.3309 3.4719 7.4163 3.1834 9.8118 9.8445
5.8736 2.5372 7.0590 5.9708 8.6199 5.4825
4.5897 9.5253 7.0089 2.9780 0.8382 7.4925
8.6098 2.9820 0.0623 1.2501 3.3771 8.4185
6.6084 1.5841 3.7435 3.8836 2.3613 1.6689
-----------------------------------------------------------------------
-
round-向最近的方向取整。
round Round towards nearest integer.
round(X) rounds the elements of X to the nearest integers.
-
floor-向负无穷大方向取整:
floor Round towards minus infinity.
floor(X) rounds the elements of X to the nearest integers
towards minus infinity.
-
ceil-向正无穷大方向取整。
ceil Round towards plus infinity.
ceil(X) rounds the elements of X to the nearest integers
towards infinity.
-
mod-计算模数:
mod Modulus after division.
mod(x,y) is x - n.*y where n = floor(x./y) if y ~= 0. If y is not an
integer and the quotient x./y is within roundoff error of an integer,
then n is that integer. The inputs x and y must be real arrays of the
same size, or real scalars.
The statement "x and y are congruent mod m" means mod(x,m) == mod(y,m).
By convention:
mod(x,0) is x.
mod(x,x) is 0.
mod(x,y), for x~=y and y~=0, has the same sign as y.
Note: REM(x,y), for x~=y and y~=0, has the same sign as x.
mod(x,y) and REM(x,y) are equal if x and y have the same sign, but
differ by y if x and y have different signs.
-