|
|
|
|
|
 |
|
 |
void __fastcall TForm1::OpenImage1Click(TObject *Sender)
{
OpenPictureDialog1->Execute();
resim->LoadFromFile(OpenPictureDialog1->FileName);
Canvas->Draw(20,20,resim);
//_---------------------------------------------------resim alındı.
byte *ptr;
int **Hist;
Hist=new int*[3];
for(int i=0;i<3;i++)
Hist[i]=new int[256];
for(int i=0;i<3;i++)
for(int j=0;j<256;j++)
Hist[i][j]=0;
//-----------------------------------histogramını bulan kısım.her renk değeri için bir histogram buluyor.
for(int k=0;k<256;k++){
for(int i=0;i<resim->Height;i++){
ptr=(Byte*)resim->ScanLine[i];
for(int j=0;j<resim->Width;j++){
if(k==ptr[3*j])
Hist[0][k]++;
if(k==ptr[3*j+1])
Hist[1][k]++;
if(k==ptr[3*j+2])
Hist[2][k]++;
} } } |
|
 |
|
 |
|
|
|
|
|
|
|
|