Fungsi rgb2hsi dalam matlap

Fungsi rgb2hsi dalam matlap
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0TaL1ZJQnxhMlN9KHwv5bbfZXpEnxOz07v7YbLR_HhyphenhyphenzFMgS1c8esJK9CvCDOfhLZxxD56_10l44oJ2mZbF5bUWGFPwNhGC5QAoqUjh1G5Lv04tQGzf4aYMKgszArdoNozQR-ksvRslI/s72-c/images.jpeg
Semoga bermanfaat artikel singkat ini.
function hsi = rgb2hsi(rgb)
%function [H,S,I] = rgb2hsi(r,g,b)
%RGB2HSI Converts RGB image to HSI

%Extract the indidividual component images
rgb = im2double(rgb);
r = rgb(:,:,1);
g = rgb(:,:,2);
b = rgb(:,:,3);

% conversion

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;
I = den/3;
den(den == 0) = eps;
S = 1 - 3.*num./den;
H(S ==0) = 0;

% combine all three results into an hsi image

hsi = cat(3, H, S, I);

Related product you might see:

Share this product :

Post a Comment

Iklan Gratis

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2012. BLOG ALTERNATIV - All Rights Reserved
Template Created by Creating Website Published by Blog Alternatifs
Proudly powered by Blogger