• 图像点线性运算


    对原灰度图像每个像素点进行线性操作,aX+b=X_new

    a=1,b=0时不变

    b!=0时所有灰度值上/下移

    a>1时对比度上升

    0<a<1时对比度减小

    a<0时暗区变亮,亮区变暗,图像求补

    pic=imread('pic/coltogray/1.jpg');
    gray_pic=rgb2gray(pic);
    
    [x,y]=size(gray_pic);
    
    new_pic1=zeros(x,y);
    new_pic2=zeros(x,y);
    new_pic3=zeros(x,y);
    new_pic4=zeros(x,y);
    max=0;
    for i=1:x
      for j=1:y
        if max<gray_pic(i,j)
          max=gray_pic(i,j);
        end
        
        new_pic1(i,j)=gray_pic(i,j)+50;
        new_pic2(i,j)=gray_pic(i,j)*1.5;
        new_pic3(i,j)=gray_pic(i,j)*0.8;
        new_pic4(i,j)=255-gray_pic(i,j);
      end
    end
    
    new_pic1=uint8(new_pic1);
    new_pic2=uint8(new_pic2);
    new_pic3=uint8(new_pic3);
    new_pic4=uint8(new_pic4);
    
    figure(1);
    imshow(gray_pic);
    
    figure(2);
    set(figure(2),'name','D*D+50','Numbertitle','off');
    imshow(new_pic1);
    
    figure(3);
    set(figure(3),'name','D*1.5','Numbertitle','off');
    imshow(new_pic2);
    
    figure(4);
    set(figure(4),'name','D*0.8','Numbertitle','off');
    imshow(new_pic3);
    
    figure(5);
    set(figure(5),'name','D*(-1)+255','Numbertitle','off');
    imshow(new_pic4);

  • 相关阅读:
    ASP.NET结合COM组件发送Email
    木马生成技术
    AJAX中使用Session
    对象模型文档对象模型DOM简介
    何遍历数据源中的表名称
    AJAX.NET用户开发指南
    用ASP.NET上传大文件
    .net反编译利器
    Equals和GetHashcode
    Factory Method模式
  • 原文地址:https://www.cnblogs.com/wangtianning1223/p/11153836.html
Copyright © 2020-2023  润新知