im

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可返回选择的四个点的坐标    

图像直方图 imhist(name);

直方图均衡化 name1=histeq(name);

在对数据进行处理时,有时我们需要对含有小数的数据进行取整处理,本例分享matlab里面常用的几种取整函数,fix、round、floor、ceil

  1. 2
  2. 3

    round-向最近的方向取整。

    round  Round towards nearest integer.

        round(X) rounds the elements of X to the nearest integers.

     

  3. 4

    floor-向负无穷大方向取整:

     floor  Round towards minus infinity.

        floor(X) rounds the elements of X to the nearest integers

        towards minus infinity.

  4. 5

    ceil-向正无穷大方向取整。

     ceil   Round towards plus infinity.

        ceil(X) rounds the elements of X to the nearest integers

        towards infinity.

  5. 6

    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.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值