zoukankan      html  css  js  c++  java
  • 一种基于RGB空间的对照度增强的filter


    今天看前辈博客的时候看到一种新的基于RGB颜色空间的image contrast enhance filter

    流浪的鱼link:

    http://blog.csdn.net/jia20003/article/details/7385160#comments


    算法的实现还是非常easy的。

    左边的均是原图。右边的是增强后的图片,只是感觉RGB空间的算法都还是又色相转移的问题...这样的算法的效果没有HSV的效果好~说死点。这样的做法就是不正确的....


    一下參数均使用

    对照度1.5

    亮度 1

    即对照度增强1.5。亮度不变.






    %*********************************************************
    % code writer   : EOF
    % code file     : ehc_filter_color_img.m
    % code date     : 2014.10.27
    % e-mail        : jasonleaster@gmail.com
    %
    % Code Description:
    %       A image enchance filter in RGB color space.
    %*********************************************************
    
    function Output = ehc_filter_color_img(Image,contrast_coefficient,brightness_coefficient)
    
        Image_Channel = size(Image,3);
        
        if Image_Channel ~=3 
            fprintf('Image channel error!
    ');
        end
        
        Height_Image = size(Image,1);
        Width_Image  = size(Image,2);
        
        for row = 1 : Height_Image
            for col = 1 : Width_Image
                 mean_value = (Image(row,col,1) + Image(row,col,2) + Image(row,col,3) )/3;
                 
                  Image(row,col,1) =  Image(row,col,1) - mean_value;
                  Image(row,col,2) =  Image(row,col,2) - mean_value;
                  Image(row,col,3) =  Image(row,col,3) - mean_value;
                  
                  Image(row,col,1) =  Image(row,col,1)*contrast_coefficient;
                  Image(row,col,2) =  Image(row,col,2)*contrast_coefficient;
                  Image(row,col,3) =  Image(row,col,3)*contrast_coefficient;
                  
                  Image(row,col,1) =  Image(row,col,1) + mean_value*brightness_coefficient;
                  Image(row,col,2) =  Image(row,col,2) + mean_value*brightness_coefficient;
                  Image(row,col,3) =  Image(row,col,3) + mean_value*brightness_coefficient;
            end
        end
    
        Output = Image;
    end


  • 相关阅读:
    Vue异步数据交互 promise axios async fetch
    JS数组或对象转为JSON字符换 JavaScript JSON.stringify()
    JS返回数组的最大值与最小值
    Error: Cannot find module './application'
    Express框架
    NodeJS项目制作流程
    模板引擎art-template
    基于NodeJS的网络响应原理与HTTP协议
    leetcode 953. 验证外星语词典 做题笔记
    leetcode 771. 宝石与石头 做题笔记
  • 原文地址:https://www.cnblogs.com/mthoutai/p/7029272.html
Copyright © 2011-2022 走看看