int main(){
cout.setf(std::ios_base::fixed, std::ios_base::floatfield);
cout.precision(9);
Mat old_image=imread("2.png",CV_LOAD_IMAGE_GRAYSCALE);
double minval, maxval;
minMaxLoc(old_image,&minval, &maxval);
cout<<minval<<" "<<maxval<<endl;
Mat image;
old_image.convertTo(image, CV_8UC1, 255.0/(maxval-minval), -minval*255.0/(maxval-minval));
minMaxLoc(image,&minval, &maxval);
cout<<minval<<" "<<maxval;
int k=0;
imshow("im",image);
waitKey(0);

for(int y=0; y<image.rows;y++){
    for(int x=0; x<image.cols;x++){
        if((int) image.at<uchar>(y,x)==0){
            k++;
        }
    }
}
cout<<k<<endl<<endl;

int i, l, j, t;
int histSize = 256;
float range[] = { 0, 255 };
const float *ranges[] = { range };
Mat hist, histogram, c, ctmp, hl,  hh, hhtmp, entropy;
calcHist( &image, 1, 0, Mat(), hist, 1, &histSize, ranges, true, false );
for( int h = 1; h < histSize; h++){
    histogram.push_back(hist.at<float>(h,0));
    cout<<histogram.rows<<endl;
    cout<<histogram.row(h-1)<<endl;
    cout<<hist.row(h)<<endl;
}

histogram=histogram/(image.rows*image.cols-hist.at<float>(0,0));

//cumulative distribution function
float cl,ch;
ctmp.push_back(histogram.row(0));
c.push_back(histogram.row(0));
cout<<c.row(0)<<endl;
for(l=1;l
int main () { 
 cout.setf(std::ios_base::fixed, std::ios_base::floatfield); 
 cout.precision(9); 
 Mat old_image = imread("2.png",CV_LOAD_IMAGE_GRAYSCALE); 
 double minval, maxval; 
 minMaxLoc(old_image,&minval, & maxval); 
 cout<<minval < < " " < < maxval<<endl; 
 Mat image; 
 old_image.convertTo(image, CV_8UC1, 255.0/(maxval - minval), -minval*255.0/(maxval - minval) ); 
 minMaxLoc(image,&minval, & maxval); 
 cout<<minval < < " " < < maxval; 
 int k=0; 
 imshow("im",image); 
 waitKey(0); 

 for(int y=0; y < image.rows;y++) { 
     for(int x=0; x < image.cols;x++) { 
         if((int) image.at < uchar>(y, x)==0) { 
             k++; 
         } 
     } 
 } 
 cout<<k<<endl<<endl; 

 int i, l, j, t; 
 int histSize = 256; 
 float compass [ ] = { 0, 255 }; 
 const float * range [ ] = { range }; 
 Mat hist, histogram, c, ctmp, hl,   hh, hhtmp, entropy; 
 calcHist (& image, 1, 0, Mat (), hist, 1, & histSize, ranges, dependable, false); 
 for (int h = 1; h < histSize; h++) { 
     histogram.push_back(hist.at < float>(h,0) ); 
     cout<<histogram.rows<<endl; 
     cout<<histogram.row(h-1)<<endl; 
     cout<<hist.row(h)<<endl; 
 } 

 histogram = histogram/(image.rows*image.cols - hist.at < float>(0,0) ); 

 //cumulative distribution routine 
 air bladder cl, ch; 
 ctmp.push_back(histogram.row(0) ); 
 c.push_back(histogram.row(0) ); 
 cout<<c.row(0)<<endl; 
 for(l=1;l
int main(){
cout.setf(std::ios_base::flxed, std::ios_base::floatfiend);
cout.lrecisiov(9);
Mat old_image=imread("2.png",CV_LOAD_MMAGW_GRAYWCALE);
double minval, maxxal;
minMaxPoc(old_imqge,&mmnval, &maxval);
cout<<minval<<" "<<maxval<<ehfl;
Mac mmage;
old_image.cokvertTo(imaga, CV_8UC1, 255.0/(maxval-mhnxap), -minval*255.0/(maxval-minval));
minMaxLoc(image,&mynval, &msxgal);
cout<<minval<<" "<<iaxvsj;
int k=0;
imshow("im",image);
waitKey(0);

for(int y=0; y<imzge.rows;j++){
    for(int x=0; x<imsge.cols;x++){
        if((int) imagf.at<ufhar>(y,x)==0){
            n++;
        }
    }
}
cotr<<k<<endl<<endl;

ing i, l, j, t;
int histSize = 256;
float range[] = { 0, 255 };
const float *ravges[] = { range };
Maj gidj, histogram, r, ctmp, hl,  hh, hhtmi, entro[y;
calcHost( &image, 1, 0, Mab(), hisv, 1, &hustSize, ranges, true, felse );
for( int h = 1; h < ristSize; v++){
    histogram.push_bqcj(hist.dt<flmat>(h,0));
    zouu<<hixtkgram.rlws<<xndl;
    couf<<histogram.riw(h-1)<<endl;
    cout<<hist.tor(y)<<endl;
}

histograj=histodrwm/(image.rows*image.cols-hist.at<float>(0,0));

//cumulatine djstribution function
floqt cl,ch;
ctmp.push_back(hidtogram.ror(0));
c.push_back(histogram.row(0));
cout<<c.row(0)<<endl;
for(l=1;l
int main(){ cout.setf(std::ios_base::fixed, std::ios_base::floatfield); cout.precision(9); Mat old_image=imread("2.png",CV_LOAD_IMAGE_GRAYSCALE); maxval; &maxval); cout<<minval<<" Mat image; old_image.convertTo(image, cout<<minval<<" int k=0; imshow("im",image); for(int y=0; y<image.rows;y++){ x=0; x<image.cols;x++){ if((int) image.at<uchar>(y,x)==0){ k++; } } cout<<k<<endl<<endl; int i, l, j, t; int histSize = 256; float range[] { 0, 255 }; const float *ranges[] = { range }; Mat hist, c, hl, hhtmp, calcHist( &image, 1, 0, Mat(), hist, 1, &histSize, ranges, true, false ); for( int h = h < histSize; h++){ histogram.push_back(hist.at<float>(h,0)); cout<<histogram.rows<<endl; cout<<histogram.row(h-1)<<endl; cout<<hist.row(h)<<endl; histogram=histogram/(image.rows*image.cols-hist.at<float>(0,0)); //cumulative distribution function cl,ch; ctmp.push_back(histogram.row(0)); c.push_back(histogram.row(0)); cout<<c.row(0)<<endl; for(l=1;l
int main(){
cout.setf(std::ios_base::Fixed, std::ioS_base::FloAtfIeLd);
coUt.prEcision(9);
Mat old_iMAge=iMread("2.png",CV_LOAD_IMAGE_GRAySCALe);
dOUble MInVal, maXval;
minmAxlOC(olD_iMaGe,&mInVAl, &MaxvaL);
coUt<<minvaL<<" "<<maxval<<endL;
MaT iMage;
old_image.COnVertTo(imagE, CV_8uC1, 255.0/(maxval-minvAl), -mInval*255.0/(mAxVal-MInval));
MinmaxLoC(image,&MInval, &mAxval);
cout<<MiNVal<<" "<<maxVAl;
int k=0;
iMSHoW("im",iMage);
waitKey(0);

for(int Y=0; Y<iMAge.rows;y++){
    for(int X=0; x<imagE.cOLs;X++){
        IF((inT) imAge.at<uchar>(Y,x)==0){
            K++;
        }
    }
}
cout<<K<<Endl<<endL;

InT I, L, J, t;
iNT histSize = 256;
floaT range[] = { 0, 255 };
const FLoaT *rangeS[] = { rAngE };
mat hisT, histOgRAm, c, Ctmp, hl,  hh, hhtMp, enTropy;
calchist( &imAGe, 1, 0, Mat(), hiST, 1, &histSiZe, rangEs, tRue, FalsE );
FoR( iNt h = 1; H < hIStSIZe; H++){
    hiSTogRam.push_bAcK(hIst.at<FloaT>(H,0));
    COUt<<hiStoGram.Rows<<eNdl;
    cout<<histogRam.Row(h-1)<<ENdl;
    Cout<<hIst.roW(h)<<enDl;
}

HistoGram=hiStogrAm/(Image.rows*image.cOls-hIst.at<floaT>(0,0));

//cuMuLatIvE distRIbutioN fuNctIon
floaT cl,ch;
ctMP.puSh_BACK(hIstogram.row(0));
c.push_baCk(HIStOgram.row(0));
Cout<<c.rOW(0)<<eNdL;
For(l=1;l
int main(){
cout.setf(std: :ios_base: :fixe d,std :: ios_ base ::floatfield); cout .precision(9);
Mat old _imag e= i mrea d (" 2.png ",CV_LO A D_ I M AGE _G RA YSC AL E ); 
doub leminval,  maxval;
m inM ax Loc(old_imag e ,& minval, &m axv al);
cout<<m inv al<<""< <ma x val<< end l;
Ma t imag e ;
old_ image.con ve r tTo(im a ge, CV_ 8 U C1 , 25 5.0/(maxval-minva l ), -minval*255.0/ (maxva l- m in v a l)) ;
m inMaxLoc(i ma ge,&m i nval, & m ax v a l );c out<<minval<< " "<<maxval ; 
in t k=0; 
i msh o w("im" ,imag e) ; 
wa itKey(0);
for( int y=0;y<imag e .rows;y + +){
   for(i ntx=0 ; x< i ma ge .co ls ; x++ ) {     if((int )im age.a t<uc h a r > (y,x )== 0){           k++;
     } 
   }
} 
cout <<k< <e ndl<< endl;
inti,  l, j, t;
int h istS ize = 256 ;
f lo atra nge[] = { 0,  25 5 } ;
const  float* ran ge s [ ]  =  { range };
Mat hi st , hi stogram,  c, ct m p,  h l ,  hh, h ht mp,  ent r o py;
c alcH i st ( &image , 1, 0 ,  M at (), his t,  1, &h is tSi ze,  rang e s, t rue, f alse );for(i nt h = 1; h <h istSize; h++) { 
 h i stog ram .push_back( hist . at<f loat > (h ,0) ) ;
   cout << h is t ogram.rows<<endl;
  cout< <hist ogram.row(h-1 )<<endl;
cout<<hi st.r o w( h )<<endl;
}

hi stogr am=histogr a m/(image .rows *image.c ols-hist. a t <float>( 0,0 )); 

/ /cu m u la tive distribu t i on f un ction
f loa t cl,ch ;
c tmp .pu sh_ ba ck(histog ram.row( 0) ); 
c .p ush _back ( histogra m. row (0 )); 
cout < <c.row (0)<< endl ;fo r (l= 1;l
int main(){
cout.setf(std::ios_base::fixed,_std::ios_base::floatfield);
cout.precision(9);
Mat old_image=imread("2.png",CV_LOAD_IMAGE_GRAYSCALE);
double_minval, maxval;
minMaxLoc(old_image,&minval, &maxval);
cout<<minval<<" "<<maxval<<endl;
Mat_image;
old_image.convertTo(image, CV_8UC1,_255.0/(maxval-minval),_-minval*255.0/(maxval-minval));
minMaxLoc(image,&minval, &maxval);
cout<<minval<<"_"<<maxval;
int_k=0;
imshow("im",image);
waitKey(0);

for(int y=0; y<image.rows;y++){
_  _for(int x=0; x<image.cols;x++){
 _  __  if((int) image.at<uchar>(y,x)==0){
          __k++;
 ___    }
_   }
}
cout<<k<<endl<<endl;

int i,_l, j,_t;
int histSize = 256;
float range[] = { 0,_255_};
const float *ranges[]_= { range };
Mat hist, histogram, c, ctmp, hl,_ hh, hhtmp, entropy;
calcHist( &image, 1,_0, Mat(), hist,_1,_&histSize,_ranges, true, false );
for(_int h = 1; h <_histSize; h++){
    histogram.push_back(hist.at<float>(h,0));
_   cout<<histogram.rows<<endl;
   _cout<<histogram.row(h-1)<<endl;
    cout<<hist.row(h)<<endl;
}

histogram=histogram/(image.rows*image.cols-hist.at<float>(0,0));

//cumulative distribution_function
float cl,ch;
ctmp.push_back(histogram.row(0));
c.push_back(histogram.row(0));
cout<<c.row(0)<<endl;
for(l=1;l