1 / 9

Computer Vision

This paper by Kim Nam Woo from Dongseo University presents a comprehensive overview of color models in digital image processing. It includes detailed algorithms for conversions among the RGB, HSI, and YCbCr color formats. The RGB-to-YCbCr conversion is explained with specific formulas, and the HSI model is elaborated through code for color extraction and manipulation. Additionally, the paper discusses skin color detection using the Hsu-Mottaleb-Jain approach, emphasizing practical applications in computer vision.

avedis
Télécharger la présentation

Computer Vision

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Vision Kim Nam Woo

  2. RGB Color Model G R B Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  3. YMC Color Model 2014-09-19 Digital Image Processing, Kim Nam Woo, Dongseo Univ. 3

  4. HSI Color Model 2014-09-19 Digital Image Processing, Kim Nam Woo, Dongseo Univ. 4

  5. RGB →YCbCr void RGBtoYCbCr(BYTE R, BYTE G, BYTE B, float *pfY, float *pfCb, float *pfCr) { *pfY = (77.*R + 150.*G + 29.*B)/256.; *pfCb = (-44.*R - 87.*G + 131.*B)/256. + 128; *pfCr = (131.*R - 110.*G - 21.*B)/256. + 128; } 2014-09-19 Digital Image Processing, Kim Nam Woo, Dongseo Univ. 5

  6. RGB →HSI void RGBtoHSI(int H, int S, int I){    int min;    unsigned char r,g,b;    float H,S,I;    float angle;    if(r==0 && g==0 && b==0)        H=0;S=0;I=0;    if((r<=g) && (r<=b))         min=r;    else if((g<=r) && (g<=b))        min=g;    else         min=b; if((r==g) && (g==b))    {        H=0.0f;        S=0.0f;    } else    {        if(b>g)        {            H=360.0f-H;        }        else        {            H=(float)acos(angle);            H *=57.29577951f;        }        S=(1.0f-(3.0f/(r+b+g)) * min);        angle = (r-0.5f*g-0.5f*b)                /(float)sqrt((r-g)*(r-g)+(r-b)*(g-b));    }    I=(r+g+b)/3.0;} Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  7. Skin Color BOOL HsuMottalebJain_Ellipse2002(BYTE R, BYTE G, BYTE B) { float Y, Cb, Cr, x, y; const float Cx=109.38, Cy=152.02, theta=2.53, ECx=1.6, ECy=2.41, a=25.39, b=14.03; RGBtoYCbCr(R, G, B, &Y, &Cb, &Cr); x=((cos(theta))*(Cb-Cx)) + ((sin(theta))*(Cr-Cy)); y=((-sin(theta))*(Cb-Cx)) + ((cos(theta))*(Cr-Cy)); if((((x-ECx)*(x-ECx))/(a*a)) + (((y-ECy)*(y-ECy))/(b*b)) <= 1) return true; else return false; } Digital Image Processing, Kim Nam Woo, Dongseo Univ.

  8. Skin Color BOOL HsuMottalebJain_Central2002(BYTE R, BYTE G, BYTE B) { float Y, Cb, Cr, wCb, wCr, BCb, BCr; const float Cx=109.38, Cy=152.02, theta=2.53, ECx=1.6, ECy=2.41, a=25.39, b=14.03; RGBtoYCbCr(R, G, B, &Y, &Cb, &Cr); HsuMottalebJain_CentralEg2002(Y, &wCb, &wCr, &BCb, &BCr); if((Cb < BCb+0.35*wCb && Cb > BCb-0.35*wCb) && (Cr > BCr-0.35*wCr && Cr < BCr+0.35*wCr)) return true; else return false; } 2014-09-19 Digital Image Processing, Kim Nam Woo, Dongseo Univ. 8

  9. Skin Color void HsuMottalebJain_CentralEg2002(float Y, float *wCb, float *wCr, float *BCb, float *BCr) { const float Kl=125., Kh=188., Ymin=16., Ymax=235., cWCb=46.97, cWLCb=23. ; if(Y<125.) { *wCb = 23.+(23.97*Y + 383.52)/109.; *wCr = 20.+(18.76*Y + 2.76)/109.; *BCb = 108.+(1250.-10*Y)/109.; *BCr = 154.-(1250.-10*Y)/109.; } else if(Y>188.) { *wCb = 14.+(-32.97*Y + 7747.95)/47.; *wCr = 10.+(-28.76*Y + 675.86)/47.; *BCb = 108.+(10*Y-1880.)/47.; *BCr = 154.+(22*Y-4136.)/109.; } else { *wCb = 46.97; *wCr = 38.76; *BCb = 108.; *BCr = 108.; } } 2014-09-19 Digital Image Processing, Kim Nam Woo, Dongseo Univ. 9

More Related