首页 > 其他 > 详细

图像的HSV拉伸增强对比度

时间:2014-10-21 21:33:03      阅读:608      评论:0      收藏:0      [点我收藏+]

图像的HSV拉伸增强对比度



HSV 和RGB颜色空间的相互转换

http://blog.csdn.net/cinmyheart/article/details/40348831


HSV的拉伸对比度增强就是对S V 两个域进行归一化,H保持不变即可

左侧是原图,右侧是经过处理的图片

bubuko.com,布布扣


转换代码:


%% *********************************************************
% code writer      : EOF
% code file        : HSV_enhance_filter.m
% code date        : 2014.10.21
% e-mail           : jasonleaster@gmail.com
% 
% Code description :
%           we translate RGB into HSV and normolize the
%   S V channel and then translate HSV back to RGB.
%
% *********************************************************

function Output = HSV_enhance_filter(Image)

    if size(Image,3) ~= 3
        fprintf('ERROR Imput-Image must be three channel image\n');
        return;
    end

    [H,S,V] = RGB2SHV(Image);
    
    V_max = max(max(V));
    V_min = min(min(V));
    
    S_max = max(max(S));
    S_min = min(min(S));
    
    Height_Image = size(Image,1);
    Width_Image  = size(Image,2);
    
    for row = 1:Height_Image
        for col = 1:Width_Image
            
            S(row,col) = (S(row,col) - S_min)/(S_max - S_min);
            V(row,col) = (V(row,col) - V_min)/(V_max - V_min);
        end
    end
    
    Output = HSV2RGB_Color(H,S,V);

end



















图像的HSV拉伸增强对比度

原文:http://blog.csdn.net/cinmyheart/article/details/40347757

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!