Convert Rbg To Hsi

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Convert Rbg To Hsi as PDF for free.

More details

  • Words: 180
  • Pages: 2
I/***********************call RBG to HSI**********************/ int x,y,k; double** hsv = new double*[CAM_WIDTH]; for( x=0;x340 || hsv[x][y]<220){ //if (hsv[x][y]>350 || hsv[x][y]<240){ if (hsv[x][y]>270 || hsv[x][y]<220){ hsv[x][y]=0; } k+=3; } }

/***********************Convert RBG to HSI**********************/ double CHRS_MoleDlg::rgb_to_hsv( int red, int green, int blue ) { double max_, min_, r, g, b, h=0, s=0, v=0; r = (double)red/255.0; g = (double)green/255.0; b = (double)blue/255.0; max_ = max(max( r, g ), b ); min_ = min(min( r, g ), b ); v = max_; if( max_ != 0.0 ) s = (max_-min_)/max_; else s = 0.0; if( s == 0.0 ){ // Do nothing

} else{ double delta = (max_-min_); if( r == max_ ) h = (g-b)/delta; else if( g == max_ ) h = 2.0 + (br)/delta; else if( b == max_ ) h = 4.0 + (rg)/delta; h *= 60.0; while( h<0.0 ) h += 360.0; } double hue = h; int sat = (s * 255.0); int lum = (v * 255.0); return hue; }

Related Documents

Convert Rbg To Hsi
November 2019 25
Hsi
May 2020 9
Convert
May 2020 14
Convert
November 2019 38
Convert
August 2019 59
Convert
June 2020 16