matlab实现PS算法之自动色阶
来源:互联网 发布:知止而有得 编辑:程序博客网 时间:2024/05/18 02:24
function I_out=F_color(I, percent)%%% the tonal range of the input image is 0-1.[row, col]=size(I);I_sort=sort(I(:));I_out=I;%%% based on the clipping percentage, %%% compute the upper and lower boundaries if (percent==0) I_min=min(I_sort) I_max=max(I_sort)else I_min=I_sort(floor(row*col*percent)) I_max=I_sort(floor(row*col*(1-percent)))endfor i=1:row for j=1:col if(I(i,j)<I_min) I_out(i,j)=I_min; elseif(I(i,j)>I_max) I_out(i,j)=1; else I_out(i,j)=(I(i,j)-I_min)*(1-I_min)/(I_max-I_min)+I_min; end end end
%{ 对R,G,B三个通道的动态范围分别进行 拉伸。这个算法还要考虑一个 clipping percentage, 默认值是 0.1%。根据这个定义,可以先编写一个拉伸动态范围的函数%}clear,clc;[filename,pathname] = uigetfile('*.jpg;*.bmp','选择图片','E:\pictures\For_Project\Matlab');imgaepath = strcat(pathname,filename);image = imread(imgaepath);Image = double(image)/255;r = Image(:,:,1);g = Image(:,:,2);b = Image(:,:,3);image_out = Image;percent = 0.01;image_out(:,:,1) = F_color(r,percent);image_out(:,:,2) = F_color(g,percent);image_out(:,:,3) = F_color(b,percent);figure(1),subplot(1,2,1),imshow(image),title('原图');subplot(1,2,2),imshow(image_out),title('自动色阶');
0 0
- matlab实现PS算法之自动色阶
- matlab实现PS算法之黑白照
- matlab实现PS算法之亮度调整
- matlab实现PS算法之色调分离
- matlab实现PS算法之渐变
- matlab实现PS算法之百叶窗、老照片
- matlab之PS算法小程序
- matlab实现PS算法之颜色变换、高反差保留、染色玻璃、碎片
- matlab之PS算法小程序(差值,溶解, 排除)
- ps滤镜之旋转扭曲算法实现
- 自动色阶、自动对比度算法实现
- 自动色阶算法实现
- PS 图像调整算法——自动色阶 (Auto Levels)
- matlab之PS算法小程序(线性加深,线性减淡,变亮,变暗)
- 迪克斯特拉(Dijkstra)算法之MATLAB实现
- 遗传算法实现之python VS matlab
- BP神经网络算法之matlab具体实现
- 自动阈值法:Otsu法 用MATLAB实现Otsu算法:
- 剑指offer: 二叉树的下一个结点
- python basic configuration in linux
- python selenium常见问题之一
- mina传输实现数据推送
- 安卓四大组件之一-----活动
- matlab实现PS算法之自动色阶
- Spring--装配普通属性
- linux高端内存
- OpenCV:OpenCV目标检测Adaboost+haar源代码分析
- mysql大数据分库和分表 php解决方案
- 桥梁模式(单一职责)
- Linux最常用的命令总结
- houdini中产生场景深度图
- [转]activemq的几种基本通信方式总结