線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2942
推到 Plurk!
推到 Facebook!

用哪一種函數來畫直方圖較好

尚未結案
pefer
一般會員


發表:2
回覆:0
積分:0
註冊:2003-11-30

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-12-01 00:08:03 IP:61.71.xxx.xxx 未訂閱
請教delphi用哪一種函數來畫直方圖較好
------
pefer huang
minjiu
中階會員


發表:27
回覆:119
積分:69
註冊:2002-06-26

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-12-02 09:24:43 IP:218.164.xxx.xxx 未訂閱
用TChart(在Additional頁面裡)這個元件來畫吧~~
auslk
初階會員


發表:35
回覆:77
積分:32
註冊:2003-02-17

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-12-20 06:37:24 IP:219.68.xxx.xxx 未訂閱
沒錯!  小弟猜是不是您應該要直方圖的使用方法ㄅ!     以下小弟已寫好的用BCB直方圖分析圖像的程式碼,可提供您轉成你要的..  
 
//主程式    void __fastcall TForm1::GrayLevel1Click(TObject *Sender)
{
 // 顯示直方圖
  int x = Image1->Width;
  int y = Image1->Height;
  int i, j;
  int *f = new int[3 * x * y];
  double color[4][257];
  int temp[256];      image_to_array(Image3, f);    // 讀取圖片至陣列      histo_image(color, x, y, f);
  for(i = 0; i < 256; i  )
  {
     Form1->Series1->Add((double)(color[0][i]));
     Form2->Series1->Add((double)(color[1][i]));
     Form3->Series1->Add((double)(color[2][i]));
     Form4->Series1->Add((double)(color[3][i])); 
  }
  Form1->Show();
  Form2->Show();
  Form3->Show();
  Form4->Show();
  delete f;
}        //副程式 
void histo_image(double color[][257], int s_width, int s_height, int *source)
{
  int gray;
  int x, y, i, j;
  // color[3] 為灰階 color[2]為紅色 color[1]為綠色 color[0]藍色
 // 陣列初始化
  for(i = 0; i < 4; i  )
    for(j = 0; j < 257; j  )
      color[i][j] = 0;      for(y = 0; y < s_height; y  )
  {
    for(x = 0; x < s_width * 3; x = x   3)
    {
      color[0][ source[x 3*s_width*y] ]  ;
      color[1][ source[x 3*s_width*y 1] ]  ;
      color[2][ source[x 3*s_width*y 2] ]  ;
      gray =
        (source[x   3 * s_width * y] * 28  
         source[x   3 * s_width * y   1] * 151   source[x   3 * s_width * y  
                                                        2] * 77) / 256;
      color[3][gray]  ;
    }
  }
}        
系統時間:2024-04-19 16:24:38
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!