function hsi=rgb2hsi(rgb)
%RGB2HSI Converts an RGB image to HSI
% HSI=RGB2HSI(rgb) converts an RGB image to HSI. The input image is
% assumed to be of size M-by-N-by-3, where the third dimension accounts
% for three image planes:red, green, and blue, in that order. If all RGB
% component images are equal, the HSI conversion is undefined. Ths input
% image can be of class double (with values in the rang[0,1]), uint8, or
% uint16.
% The output image, HSI, is of class double, where:
% hsi(:,:,1)= hue image normalized values to the range [0,1] by
% dividing all angle values by 2*pi.
% hsi(:,:,2)=saturation image, in the range [0,1].
% hsi(:,:,3)=intensity image, in the range [0,1].
%Extract the individual component images.
rgb=im2double(rgb);
r=rgb(:,:,1);
g=rgb(:,:,2);
b=rgb(:,:,3);
%Implement the conversion equations.
num=0.5*((r-g)+(r-b));
den=sqrt((r-g).^2+(r-b).*(g-b));
theta=acos(num./(den+eps));
H=theta;
H(b>g)=2*pi-H(b>g);
H=H/(2*pi);
num=min(min(r,g),b);
den=r+g+b;
den(den==0)=eps;
S=1-3.*num./den;
H(S==0)=0;
I=(r+g+b)/3;
%Combine all three results into an hsi image.
hsi=cat(3,H,S,I);
rgb2hsi.rar_HSI到RGB_rgb to hsi_rgb2hsi_颜色_颜色模型 MATLAB
版权申诉
68 浏览量
2022-07-14
13:33:35
上传
评论
收藏 969B RAR 举报
JonSco
- 粉丝: 67
- 资源: 1万+
最新资源
- open_setting.mobileprovision
- zidongdianjiqi.apk
- 卷积神经网络(Convolutional Neural Networks,CNN)是深度学习领域中一种非常重要的神经网络结构,特
- DHT11温湿度传感器是一款高性能、低成本的数字温湿度复合传感器 它集成了温度感应和湿度感应功能,可以准确地测量环境中的温度和湿
- eMMC的压力测试工具
- JUC代码演示 Java多线程并发
- 基于matlab实现的数据挖掘机期末大挖掘.rar
- 基于matlab实现的势函数非线性和感知机线性三分类,并画出分界图.rar
- 基于matlab实现的为2天线,BPSK调制模式 自己写的Space time code simulation提供给大家.rar
- 基于matlab实现的元胞自动机模拟的渗流集群,非常好的一个程序.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0