用哪一種函數來畫直方圖較好 |
尚未結案
|
pefer
一般會員 發表:2 回覆:0 積分:0 註冊:2003-11-30 發送簡訊給我 |
|
minjiu
中階會員 發表:27 回覆:119 積分:69 註冊:2002-06-26 發送簡訊給我 |
|
auslk
初階會員 發表:35 回覆:77 積分:32 註冊:2003-02-17 發送簡訊給我 |
沒錯!
小弟猜是不是您應該要直方圖的使用方法ㄅ! 以下小弟已寫好的用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] ; } } } |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |