Advance image processing

  • Upload
    tuxdip

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

  • 8/14/2019 Advance image processing

    1/71

    ** Image.h** Copyright (C) 2008, Dipak Chirmade* Student, HD SE.* dipak(dot)chirmade(at)gmail(dot)com*

    * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.* YOU ARE ALLOWED TO USE THIS CODE FOR PERSONAL OR PROFESSIONAL USE* AND IS TOTALLY FREE!** This file defines the functions to deal with image processing.* Few selective snapshots of processed images are also added.**/

    ifndef _IMAGE_H_define _IMAGE_H_

    *Include files in relevance to image processing functions

    /

    include "version.h"include "Bmp.h"include include "Randomin.h"include include "noise.h"

    *All functions are implemented in generic orderas shown in menu options

    /

    *Description: Displays the image pixel by pixelArguments : r,g,b attributes of an imageReturns : Nothing

    /

    oid showImage(image rAttr, image gAttr, image bAttr)

    if((r!=NULL)&&(g!=NULL)&&(b!=NULL)){UINT iRow,jCol;for( iRow=0;iRow

  • 8/14/2019 Advance image processing

    2/71

    glVertex2i(jCol,screenHeight-iRow-1);glEnd();

    }}

    *Description: Sets white background and plot black points on itOnly one point at a time can be plotted

    Arguments : Image in 'image' struct link listReturns : Nothing

    /

    oid ShowHistogram(image Gray)

    UINT Height,Width;

    /*glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

    */

    glPointSize(1.0);

  • 8/14/2019 Advance image processing

    3/71

    glBegin(GL_POINTS);

    for(Width=0;Width

  • 8/14/2019 Advance image processing

    4/71

    rs[HHight][HWidth]=(float)rs[HHight][HWidth]+1.0;gs[HHight][HWidth]=(float)gs[HHight][HWidth]+1.0;bs[HHight][HWidth]=(float)bs[HHight][HWidth]+1.0;

    }elsefor(int HWidth=0;HWidth

  • 8/14/2019 Advance image processing

    5/71

    calculate max histogram counter*/

    NormalizationFactor=MaxHistoHeightCount/screenHeight;for(int HWidth=0;HWidth

  • 8/14/2019 Advance image processing

    6/71

    *Description: Performs histogram stretchArguments : NothingReturns : Nothing

    /

    oid DoHistrogramStretch(void)

    for(int Height=0;Height

  • 8/14/2019 Advance image processing

    7/71

    /

    oid DoHistrogramShrink(int MaxWidth,int MinWidth)

    /* __Have to go step by step conversion*/float diff0=float(MaxWidth-MinWidth);float diff1=(float)(diff0/(MaxGrayValue-MinGrayValue));

    for(int Height=0;Height

  • 8/14/2019 Advance image processing

    8/71

    }return;

    *Description: Convert int number to binaryArguments : Int number which need to convert into binary

    Returns : Nothing/

    tatic int BinaryCounter=0;nt BinaryString[8]={0,0,0,0,0,0,0,0};

    oid BinaryConversion(int number) {int remainder=0;if(number > 1);BinaryString[BinaryCounter]=remainder;BinaryCounter++;

    return;

    *Description: Performs histogram eqalizationArguments : NothingReturns : Nothing

    /

  • 8/14/2019 Advance image processing

    9/71

    oid DoHistogramEqualization(void)

    /*clean array

    */int IsZeroGrayLevel[256+4];for(int CleanConuter=0;CleanConuter

  • 8/14/2019 Advance image processing

    10/71

    float CurrentCalculatedProbabilty=(float)tNk/TotalNumberOfPixel;

    if(CurrentCalculatedProbabilty==0.0) IsZeroGrayLevel[NormalizationCounter]=1;

    ProbabilityThreshold+=CurrentCalculatedProbabilty;

    /*

    store the calulate probablities to an probdesarray*/ProbDesArray[NormalizationCounter]=CurrentCalculatedProbabilty;

    }

    /* _debug maessage to check prob density array and calculate sum of probability*/

    for(int CleanConuter=0;CleanConuter

  • 8/14/2019 Advance image processing

    11/71

    if((int)rs[Height][Width]==NormalizationCounter)rs[Height][Width]=(float)ReplaceableValue;gs[Height][Width]=bs[Height][Width]=rs[Height][Width];

    }}

    /* _Wrong approch

    rawhistogramSrc=CalculateHistrogram(rawhistogramSrc,rs);{int Height;for(int GrayLevel=0;GrayLevel

  • 8/14/2019 Advance image processing

    12/71

    *Description: Computers 8 levels of the buffered imageArguments : NothingReturns : Nothing

    /

    oid ComputeEightLevelbuffers(void)

    AllocateSpecificationWinBuffer();

    for(int Height=0;Height

  • 8/14/2019 Advance image processing

    13/71

    Description: Colored image to Gray image conversionFormula: 0.5*red+0.3*green+0.2*blue=GrayScaleValueForR=G=B

    Arguments : R,G,B values which one want to convert.Returns : Float value after conversion

    /

    oid DoHistogramSpecification(void)

    /*BinaryConversion((float)123);

    */

    float Pr[256+4];for(int NormalizationConuter=0;NormalizationConuter

  • 8/14/2019 Advance image processing

    14/71

    int TotalNoOfPix=screenWidth*screenHeight;Pr[NormalizationConuter]=(float)tNk/TotalNoOfPix;

    }

    float Sk[256+4];for(int NormalizationConuter=0;NormalizationConuter

  • 8/14/2019 Advance image processing

    15/71

    if((int)rs[Height][Width]==NormalizationConuter)rs[Height][Width]=(float)ReplaceValue;gs[Height][Width]=bs[Height][Width]=rs[Height][Width];

    }}

    ComputeEightLevelbuffers();return;

    *Description: To get the mean of the imageArguments : voidReturns : mean value

    /

    loat GetMeanOfTheImage(void)

    float Mean=0;int TotalNoOfPix=screenWidth*screenHeight;

    for(int Height=0;Height

  • 8/14/2019 Advance image processing

    16/71

    loat GetVarianceOfTheACEWindow(void)

    float Mean=GetMeanOfTheACEWindow(),Sigma=0;int TotalNoOfPix=3*3;

    for(int Height=0;Height

  • 8/14/2019 Advance image processing

    17/71

    oid DoAdaptiveContrastEnhancement(void)

    float MeanOftheWholeImage=(float)GetMeanOfTheImage();for(int Height=1;Height

  • 8/14/2019 Advance image processing

    18/71

    {; /*do not do anything*/

    }else{float temp1=(float) (MeanOftheWholeImage/GetVarianceOfTheACEWindow());float temp2=(float) ((float)rs[Height][Width]-GetMeanOfTheACEWindow());

    temp1=(float)(0.1*temp1*temp2);temp2=(float)0.8*GetMeanOfTheACEWindow();temp1=(float)(temp1+temp2);

    temp1=(float)powf(temp1,float(2));gs[Height][Width]=(float)sqrt((float)temp1);

    }/*

    bd[Height][Width]=gd[Height][Width]=rd[Height][Width];*/

    }

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    19/71

    oid AddGaussienNoise(void)

    noise_guassian(rori,rs,230,2);

    for(int Height=0;Height

  • 8/14/2019 Advance image processing

    20/71

    bs[Height][Width]=gs[Height][Width]=rs[Height][Width];

    return;

    *Description: Adds Gamma Noise to the image

    Arguments : NothingReturns : Nothing/

    oid AddGammNoise(void)

    noise_Gamma(rori,rs,230,2);

    for(int Height=0;Height

  • 8/14/2019 Advance image processing

    21/71

    oid AddExponentialNoise(void)

    noise_Exponential(rori,rs,230);for(int Height=0;Height

  • 8/14/2019 Advance image processing

    22/71

    *Description: Adds Impluse Noise to the imageArguments : NothingReturns : Nothing

    /

    oid AddImpluseNoise(void)

    noise_imp(rori,rs,0.9,10,100);for(int Height=0;Height

  • 8/14/2019 Advance image processing

    23/71

    ;/*rs[Height][Width]=(float)210;*/else

    rs[Height][Width]=(float)Width;

    bs[Height][Width]=gs[Height][Width]=rs[Height][Width];}

    return;

    *Description: Average filter by window 3x3Arguments : NothingReturns : Nothing

    /

    oid Average3x3Filter(void)

    float _3x3Window[3][3]={{0,0,0},{0,0,0},{0,0,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    24/71

    _3x3Window[0][2]=(float)rs[Height-1][Width+1];_3x3Window[1][0]=(float)rs[Height][Width-1];_3x3Window[1][1]=(float)rs[Height]

    Width];_3x3Window[1][2]=(float)rs[Height][Width+1];_3x3Window[2][0]=(float)rs[Height+1][Width-1];_3x3Window[2][1]=(float)rs[Height+1

    Width];_3x3Window[2][2]=(float)rs[Height+1][Width+1];

    float TotalGrayValue=0;for(int row=0;row

  • 8/14/2019 Advance image processing

    25/71

    _5x5Window[3][3]=(float)rs[Height+1][Width+1];_5x5Window[3][4]=(float)rs[Height+1Width+2];

    _5x5Window[4][0]=(float)rs[Height+2][Width-2];_5x5Window[4][1]=(float)rs[Height+2Width-1];

    _5x5Window[4][2]=(float)rs[Height+2][Width];_5x5Window[4][3]=(float)rs[Height+2][Width+1];_5x5Window[4][4]=(float)rs[Height+2

    Width+2];

    float TotalGrayValue=0;for(int row=0;row

  • 8/14/2019 Advance image processing

    26/71

    _7x7Window[3][0]=(float)rs[Height][Width-3];_7x7Window[3][1]=(float)rs[Height][Wid];_7x7Window[3][2]=(float)rs[Height][Width-1];

    _7x7Window[3][3]=(float)rs[Height][Width]_7x7Window[3][4]=(float)rs[Height][Width+1];_7x7Window[3][5]=(float)rs[Height]

    Width+2];_7x7Window[3][6]=(float)rs[Height][Width+3];_7x7Window[4][0]=(float)rs[Height+1][Width-3];_7x7Window[4][1]=(float)rs[Height+1

    Width-2];_7x7Window[4][2]=(float)rs[Height+1][Width-3];

    _7x7Window[4][3]=(float)rs[Height+1][Width_7x7Window[4][4]=(float)rs[Height+1][Width+1];_7x7Window[4][5]=(float)rs[Height+1Width+2];_7x7Window[4][6]=(float)rs[Height+1][Width+3];

    _7x7Window[5][0]=(float)rs[Height+2][Width-3];_7x7Window[5][1]=(float)rs[Height+2Width-2];_7x7Window[5][2]=(float)rs[Height+2][Width-1];

    _7x7Window[5][3]=(float)rs[Height+2][Width_7x7Window[5][4]=(float)rs[Height+2][Width+1];_7x7Window[5][5]=(float)rs[Height+2

    Width+2];_7x7Window[5][6]=(float)rs[Height+2][Width+3];_7x7Window[6][0]=(float)rs[Height+3][Width-3];_7x7Window[6][1]=(float)rs[Height+3

    Width-2];_7x7Window[6][2]=(float)rs[Height+3][Width-1];_7x7Window[6][3]=(float)rs[Height+3][Width

    _7x7Window[6][4]=(float)rs[Height+3][Width+1];_7x7Window[6][5]=(float)rs[Height+3Width+2];_7x7Window[6][6]=(float)rs[Height+3][Width+3];

    float TotalGrayValue=0;for(int row=0;row

  • 8/14/2019 Advance image processing

    27/71

    oid WeightedAverageFilter(void)

    float _3x3Window[3][3]={{0,0,0},{0,0,0},{0,0,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    28/71

    _3x3Window[2][2]=(float)rs[Height+1][Width+1];

    float TotalGrayValue=1;for(int row=0;row

  • 8/14/2019 Advance image processing

    29/71

    rs[Height][Width]=bs[Height][Width]=gs[Height][Width];

    return;

    *Description: Contra Harmonic filter by window 3x3

    Arguments : NothingReturns : Nothing/

    oid ContraHarmonicFilter(float ValueForQ)

    float _3x3Window[3][3]={{0,0,0},{0,0,0},{0,0,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    30/71

    nt FloatCmp(const void *temp1, const void *temp2){

    return (*(int *)temp1 - *(int *)temp2);}

    *

    Description: Median filter by window 3x3Arguments : NothingReturns : Nothing

    /

    oid MedianFilter(void)

    float _3x3Window[3][3]={{0,34,0},{0,21,0},{0,59,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    31/71

    _3x3Window[1][2]=(float)rs[Height][Width+1];_3x3Window[2][0]=(float)rs[Height+1][Width-1];_3x3Window[2][1]=(float)rs[Height+1

    Width];_3x3Window[2][2]=(float)rs[Height+1][Width+1];

    /*sort the array using quick sort function

    */qsort(_3x3Window, 9, sizeof(int), FloatCmp);

    gs[Height][Width]=(float)_3x3Window[1][1];if((float)gs[Height][Width]>(float)255) gs[Height][Width]=(float)255;if((float)gs[Height][Width]

  • 8/14/2019 Advance image processing

    32/71

    for(int Width=1;Width

  • 8/14/2019 Advance image processing

    33/71

    float _3x3Window[3][3]={{0,0,0},{0,0,0},{0,0,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    34/71

    _3x3Window[1][2]=(float)rs[Height][Width+1];_3x3Window[2][0]=(float)rs[Height+1][Width-1];_3x3Window[2][1]=(float)rs[Height+1

    Width];_3x3Window[2][2]=(float)rs[Height+1][Width+1];

    /*mean calculation

    */float TotalGrayVablue=0;for(int row=0;row

  • 8/14/2019 Advance image processing

    35/71

    if((float)rs[Height][Width]

  • 8/14/2019 Advance image processing

    36/71

    *Description: Horizontal line detectionArguments : NothingReturns : Nothing

    /

    oid HorizontalDetection(void)

    for(int Width=1;Width

  • 8/14/2019 Advance image processing

    37/71

    if((float)gs[Height][Width]>(float)128){

    /*cout

  • 8/14/2019 Advance image processing

    38/71

    oid VerticalDetection(void)

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    39/71

    )==(float)gs[Height][Width])*/

    if((float)gs[Height][Width]==(float)gs[Height+1][Width])/* ((float)gs[Height][Width]==(float)gs[Height][Width-1]))*/

    gs[Height][Width]=255.0;else gs[Height][Width]=0.0;

    }}

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    40/71

    return;

    *Description: Two or more than horizontal line detectionArguments : Nothing

    Returns : Nothing/

    oid AnotherHorizontalLineDetection(void)

    float _3x3Window[3][3]={{0,0,0},{0,0,0},{0,0,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    41/71

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    42/71

    oid Plus45DegreesDetection(void)

    float _3x3Window[3][3]={{0,0,0},{0,0,0},{0,0,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    43/71

    else if(TotalGrayValue>255)gs[Height][Width]=(float)255;else gs[Height][Width]=TotalGrayValue;

    }for(int Height=1;Height

  • 8/14/2019 Advance image processing

    44/71

    Arguments : NothingReturns : Nothing

    /

    oid RobertOperatorBasedDetection(void)

    float _3x3Window[3][3]={{0,0,0},{0,0,0},{0,0,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    45/71

    float temp2=(float)_3x3Window[2][1]-(float)_3x3Window[1][2];temp2=(float)powf(temp2,float(2));

    temp2=(float)sqrt(temp2);

    float TotalGrayValue=(float)(temp1+temp2);if(TotalGrayValue255)gs[Height][Width]=(float)255;else gs[Height][Width]=TotalGrayValue;

    /*gs[Height][Width]=(float)(powf((_3x3Window[2][2]-_3x3Window[1][1]),(float)2)+\

    (powf((_3x3Window[2][1]-_3x3Window[1][2]),(float)2)));gs[Height][Width]=(float)sqrt((float)gs[Height][Width]);if((float)gs[Height][Width]==(float)1) gs[Height][Width]=(float)255;cout

  • 8/14/2019 Advance image processing

    46/71

    TotalXGray+=_2x2windowX[row][col];TotalYGray+=_2x2windowY[row][col];

    }

    TotalXGray=float(powf(TotalXGray,(float)2));TotalXGray=(float)sqrt(TotalXGray);

    TotalYGray=float(powf(TotalYGray,(float)2));TotalYGray=(float)sqrt(TotalYGray);

    float TotalGrayValue=float(TotalXGray+TotalYGray);if(TotalGrayValue255)

    gs[Height][Width]=(float)255;else gs[Height][Width]=TotalGrayValue;

    }

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    47/71

    oid PrewittOperatorBasedDetection(void)

    float _3x3Window[3][3]={{0,0,0},{0,0,0},{0,0,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    48/71

    temp3=float(powf((temp3-temp4),(float)2));temp3=(float)sqrt(temp3);

    float TotalGrayValue=(float)(temp1+temp3);if(TotalGrayValue255)

    gs[Height][Width]=(float)255;else gs[Height][Width]=TotalGrayValue;/*

    cout

  • 8/14/2019 Advance image processing

    49/71

    _3x3WindowY[2][2]=(float)rs[Height+1][Width+1]*1;

    float TotalXGray=0,TotalYGray=0;for(int row=0;row

  • 8/14/2019 Advance image processing

    50/71

    oid SobelOperatorBaseDetection(void)

    float _3x3Window[3][3]={{0,0,0},{0,0,0},{0,0,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    51/71

    temp1=(float)sqrt(temp1);temp3=float(powf((temp3-temp4),(float)2));temp3=(float)sqrt(temp3);

    float TotalGrayValue=(float)(temp1+temp3);if(TotalGrayValue255)gs[Height][Width]=(float)255;else gs[Height][Width]=TotalGrayValue;

    /*cout

  • 8/14/2019 Advance image processing

    52/71

    _3x3WindowX[1][2]=(float)rs[Height][Width+1]*2;_3x3WindowX[2][0]=(float)rs[Height+1][Width-1]*-1;_3x3WindowX[2]

    1]=(float)rs[Height+1][Width]*0;_3x3WindowX[2][2]=(float)rs[Height+1][Width+1]*1;

    _3x3WindowY[0][0]=(float)rs[Height-1][Width-1]*-1;_3x3WindowY[0][1]=(float)rs[Heigh][Width]*-2;

    _3x3WindowY[0][2]=(float)rs[Height-1][Width+1]*-1;_3x3WindowY[1][0]=(float)rs[Height][Width-1]*0;_3x3WindowY[1][1]=(float)rs[Height]Width]*0;

    _3x3WindowY[1][2]=(float)rs[Height][Width+1]*0;_3x3WindowY[2][0]=(float)rs[Height+1][Width-1]*1;_3x3WindowY[2][1]=(float)rs[Height

    Width]*2;_3x3WindowY[2][2]=(float)rs[Height+1][Width+1]*1;

    float TotalXGray=0,TotalYGray=0;for(int row=0;row

  • 8/14/2019 Advance image processing

    53/71

    oid LogOperatorBasedDetection(void)

    float _5x5Window[5][5]={{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}};

    for(int Height=2;Height

  • 8/14/2019 Advance image processing

    54/71

    _5x5Window[3][2]=(float)rs[Height+1][Width]*-2;_5x5Window[3][3]=(float)rs[Height+1][Width+1]*-1;_5x5Window[3][4]=(float)rs[Height

    Width+2]*0;_5x5Window[4][0]=(float)rs[Height+2][Width-2]*0;_5x5Window[4][1]=(float)rs[Height+

    Width-1]*0;_5x5Window[4][2]=(float)rs[Height+2][Width]*-1;

    _5x5Window[4][3]=(float)rs[Height+2][Width+1]*0;_5x5Window[4][4]=(float)rs[Height+

    Width+2]*0;

    float TotalGrayValue=0;for(int row=0;row

  • 8/14/2019 Advance image processing

    55/71

    oid ImageSharpeningMaskOne(void)

    float _3x3Window[3][3]={{0,0,0},{0,0,0},{0,0,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    56/71

    gs[Height][Width]=(float)0;else if(TotalGrayValue>255)

    gs[Height][Width]=(float)255;else gs[Height][Width]=TotalGrayValue;

    }for(int Height=1;Height

  • 8/14/2019 Advance image processing

    57/71

    *Description: To sharp image using 3x3 mask, positive laplacianArguments : NothingReturns : Nothing

    /

    oid PositiveLaplacian(void)

    float _3x3Window[3][3]={{0,0,0},{0,0,0},{0,0,0}};

    for(int Height=1;Height

  • 8/14/2019 Advance image processing

    58/71

    _3x3Window[0][0]=(float)rs[Height-1][Width-1]*0;_3x3Window[0][1]=(float)rs[Height-Width]*1;

    _3x3Window[0][2]=(float)rs[Height-1][Width+1]*0;_3x3Window[1][0]=(float)rs[Height][Width-1]*1;_3x3Window[1][1]=(float)rs[Height]

    Width]*-4;_3x3Window[1][2]=(float)rs[Height][Width+1]*1;_3x3Window[2][0]=(float)rs[Height+1][Width-1]*0;_3x3Window[2][1]=(float)rs[Height+

    Width]*1;_3x3Window[2][2]=(float)rs[Height+1][Width+1]*0;

    float TotalGrayValue=0;for(int row=0;row

  • 8/14/2019 Advance image processing

    59/71

    for(int Width=0;Width

  • 8/14/2019 Advance image processing

    60/71

    rs[Height][Width]=(float)0;else rs[Height][Width]=(float)255;

    for(int Height=0;Height

  • 8/14/2019 Advance image processing

    61/71

    /*Mg=(float)Mg/TotalPk;

    */

    float temp1=float((Mg*Pk)-Mk);temp1=(float)powf(temp1,2.0);

    temp1=float(temp1/((Pk)*(1-Pk)));if(temp1

  • 8/14/2019 Advance image processing

    62/71

    oid ConnectedComponentBinaryImage(void)

    float _5x1Window[4]={0,0,0,0};int TagValue=0,ChangeHight=0;

    GlobleThresholding();cout

  • 8/14/2019 Advance image processing

    63/71

    if(ChangeHight) {StartHeight=2;StartWidth=2;HLimit=screenHeight-2;WLimit=screenWidth-2;

    }else

    {StartHeight=1;StartWidth=1;HLimit=screenHeight-1;WLimit=screenWidth-1;

    }for(int Height=StartHeight;Height

  • 8/14/2019 Advance image processing

    64/71

    for(int Width=StartWidth;Width

  • 8/14/2019 Advance image processing

    65/71

    {if(TagNo==(int)gs[Height][Width])

    flag=1;}

    if(flag==1)TagValue++;

    }

    cout

  • 8/14/2019 Advance image processing

    66/71

    //s componentif(_3x1Buffer[2]>(float)0){float tempBuffer=_3x1Buffer[2]-_3x1Buffer[0];tempBuffer=(tempBuffer/_3x1Buffer[2]);

    ss[Height][Width]=(float)tempBuffer*255;}else ss[Height][Width]=(float)0;

    //h componentif((float)ss[Height][Width]==(float)0)

    {hs[Height][Width]=(float)0;

    }else

    {float tempBuffer=0;float MaxMin=_3x1Buffer[2]-_3x1Buffer[0];

    if(MaxMin!=0){if((float)rs[Height][Width]==(float)_3x1Buffer[2])

    {tempBuffer=(float)gs[Height][Width]-(float)bs[Height][Width];tempBuffer=tempBuffer/MaxMin;

    }else if((float)gs[Height][Width]==(float)_3x1Buffer[2])

    {tempBuffer=(float)bs[Height][Width]-(float)rs[Height][Width];tempBuffer=tempBuffer/MaxMin;tempBuffer+=2.0;

    }else if((float)bs[Height][Width]==(float)_3x1Buffer[2])

    {tempBuffer=(float)rs[Height][Width]-(float)gs[Height][Width];tempBuffer=tempBuffer/MaxMin;tempBuffer+=4.0;

    }}

    tempBuffer=tempBuffer*60;if(tempBuffer

  • 8/14/2019 Advance image processing

    67/71

    Description: RGB to YIQ conversionArguments : NothingReturns : Nothing

    /

    oid RGBtoYIQ(void)

    AllocateHSVMemory();for(int Height=0;Height

  • 8/14/2019 Advance image processing

    68/71

    */cs[Height][Width]=ss[Height][Width]&hs[Height][Width];

    }

    return;

    *Description: Performs region Growing according to imageArguments : NothingReturns : Nothing

    /

    oid RegoinGrowing(void)

    for(int Height=0;Height

  • 8/14/2019 Advance image processing

    69/71

    /rs[Height][Width]=(float)WhatToSet;

    }for(int Height=0;Height

  • 8/14/2019 Advance image processing

    70/71

    *Description: Splitting of the image using given size of targeted splitted sectionArguments : Targeted spliting section sizeReturns : Nothing

    /

    oid Split(int Size=2)

    for(int Height=Size;Height

  • 8/14/2019 Advance image processing

    71/71

    WhatToSet=200; /*acts as a seed no 9 */else if((float)CurrentGrayLevel>=(float)225&&(float)CurrentGrayLevel