t 2 2 t 2 t F ( ) p- 2 2 F 2 G F ( ) 2 2 F 2 G F ( ) 2 2 2

Similar documents
I J

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

comment.dvi

double float

P05.ppt

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

新版明解C言語 実践編

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –

6 6.1 sound_wav_files flu00.wav.wav 44.1 khz 1/44100 spwave Text with Time spwave t T = N t N 44.1 khz t = 1 sec j t f j {f 0, f 1, f 2,, f N 1

AHPを用いた大相撲の新しい番付編成

DA100データアクイジションユニット通信インタフェースユーザーズマニュアル

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology

ex01.dvi

新・明解C言語 実践編

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose

1.ppt

2: 3: A, f, φ f(t = A sin(2πft + φ = A sin(ωt + φ ω 2πf 440Hz A ( ( 4 ( 5 f(t = sin(2πf 1t + sin(2πf 2 t = 2 sin(2πt(f 1 + f 2 /2 cos(2πt(f 1 f

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡

r07.dvi

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h>

ohp07.dvi

p = 1, 2, cos 2n + p)πj = cos 2nπj 2n + p)πj, sin = sin 2nπj 7.1) f j = a ) 0 + a p + a n+p cos 2nπj p=1 p=0 1 + ) b n+p p=0 sin 2nπj 1 2 a 0 +

Łñ“’‘‚2004

プリント


実験 7-1 画像処理基礎 2 1 目的 画像をコンピュータ上で処理するサイの基本事項について学ぶ 画像の変換 画像フィルタ 画像の特徴抽出とパターン分類などの具体的なプログラミングを試みることにより ディジタル画像処理の基本的な手順 手法及びシステム構成について理解する 2 解説 前回の実験と同様

C言語によるアルゴリズムとデータ構造

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

ex01.dvi

新・明解C言語 ポインタ完全攻略

thesis.dvi

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡

lexex.dvi

9 8 7 (x-1.0)*(x-1.0) *(x-1.0) (a) f(a) (b) f(a) Figure 1: f(a) a =1.0 (1) a 1.0 f(1.0)


2008 ( 13 ) C LAPACK 2008 ( 13 )C LAPACK p. 1

実際の株価データを用いたオプション料の計算

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

untitled

tuat1.dvi


II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y

double 2 std::cin, std::cout 1.2 C fopen() fclose() C++ std::fstream 1-3 #include <fstream> std::fstream fout; int a = 123; fout.open( "data.t

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1

joho09.ppt

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou

‚æ4›ñ

1-4 int a; std::cin >> a; std::cout << "a = " << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >>

LIFO(last in first out, ) 1 FIFO(first in first out, ) 2 2 PUSH POP : 1

C

main

r03.dvi

Microsoft Word - C.....u.K...doc

A/B (2010/10/08) Ver kurino/2010/soft/soft.html A/B

BW BW

データ構造とアルゴリズム論

ohp03.dvi

untitled

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n

j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E

class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =

compiler-text.dvi

O(N) ( ) log 2 N

XMPによる並列化実装2

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

r3.dvi

エラー処理・分割コンパイル・コマンドライン引数

memo

(search: ) [1] ( ) 2 (linear search) (sequential search) 1

r08.dvi

Java学習教材

第5回お試しアカウント付き並列プログラミング講習会

上達Java解答.doc

program.dvi

2 P.S.P.T. P.S.P.T. wiki 26

PowerPoint Presentation

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

2

Condition DAQ condition condition 2 3 XML key value

Java Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225

Microsoft PowerPoint - kougi9.ppt

C B

新・明解Java入門

programmingII2019-v01

pptx

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics;

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

Cプログラミング1(再) 第2回

コンピュータ概論

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1

untitled

P03.ppt

:30 12:00 I. I VI II. III. IV. a d V. VI

Javaセキュアコーディングセミナー東京 第3回 入出力(File, Stream)と例外時の動作 演習解説

スライド 1

卒 業 研 究 報 告.PDF

1 ( ) 1.1 (convert.sh) (18GHz 26GHz) C (convert.c, convert1.c) mesure-ryudai convert.sh #!/bin/sh # file1 file1= ls -1 $1 # file1 data for data in $fi

ohp08.dvi

Java演習(4) -- 変数と型 --

Transcription:

1 2 2 0 1 2 2 2 2 2 2 2 2.1 2 2 F={f ij }, G {g ij } t f ij t g ij = 1 f ij < t g ij = 0 t p- p S 0 S p = S 0 /S t p 2 t 1

t 2 2 t 2 t 2 2 3 3 1 2 F ( ) p- 2 2 F 2 G 3 2 2 F ( ) 2 2 F 2 G 3 3 2 F ( ) 2 2 2

F 2 G 3 4 2 F ( ) 2 2 F 2 G 3 5 2 F ( ) 2 2 F 2 G 4 2. "s21-3d.data" 180 160 140 120 100 80 60 40 20 250 200 0 0 20 40 60 80 100 120 140 0 50 150 100 1: 1 2: 1 3D 3

0 3500 "s21-2dhis.data" 3000 2500 2000 1500 1000 500 0 50 100 150 200 250 300 3: 1 "s22-3d.data" 180 160 140 120 100 80 60 40 20 0 50 100 150 200 350 300 250 200 150 100 50 250 0 4: 3 5: 2 3D 7000 "s22-2dhis.data" 6000 5000 4000 3000 2000 1000 0 0 50 100 150 200 250 300 6: 2 4

4.1 3 1. 7: p- - 1 ( :13% :108) 8: p- - 2 ( :12% :101),,. 9: p- - 1( :30%) 10: p- - 2( :30%) 11: p- - 1( :50%) 12: p- - 2( :50%) 5

13: p- - 1( :80%) 14: p- - 2( :80%) 4.2 3 2 15: 1 16: 2 4.3 3 3 17: 1 6

3500 3000 "s21-33-statistic.data" u 1:2 "s21-33-statistic.data" u 1:3 40000 35000 2500 30000 histogram 2000 1500 25000 20000 15000 bibun-histogram 1000 10000 500 5000 0 0 50 100 150 200 250 300 0 18: 1 ( ) ( ) 19: 2 7000 6000 "s22-33-statistic.data" u 1:2 "s22-33-statistic.data" u 1:3 80000 70000 5000 60000 histogram 4000 3000 50000 40000 30000 bibun-histogram 2000 20000 1000 10000 0 0 0 50 100 150 200 250 300 20: 2 ( ) ( ) 7

4.4 3 4 3500 "s21-34statistic.data" u 1:2 "s21-34statistic.data" u 1:3 3000 2500 2000 1500 1000 500 21: - 1 0 0 50 100 150 200 250 300 22: 1 7000 "s22-34statistic.data" u 1:2 "s22-34statistic.data" u 1:3 6000 5000 4000 3000 2000 1000 0 0 50 100 150 200 250 300 23: - 2 24: 2 8

4.5 3 5 4 25: - 1 26: - 2 16 27: - 1 28: - 2 64 29: - 1 30: - 2 9

4.6 3 1 1: 3 1 1 /* ################ 2 # 2 - p # 3 ################# */ 4 5 #include<s t d i o. h> 6 #include<s t d l i b. h> 7 #include<time. h> 8 #include<math. h> 9 #define MAX 1000 10 11 int main ( int argc, char argv [ ] ) 12 { 13 /* */ 14 FILE f i n, fout, f s t a t i s t i c ; 15 char l i n e [MAX] ; 16 int i, j, k, width, height, max ; /*,, */ 17 int f, g ; 18 c l o c k t s t a r t, end ; 19 int per =0; /* */ 20 int gazousuu =0, menseki =0; 21 int histogram, sum=0,tmp=0, s i k i i t i =0; 22 23 /* #################### FILE OPEN ######################### */ 24 i f ( argc!=3){ 25 p r i n t f ( Argument Error. Try Again \n ) ; return ; 26 } 27 28 i f ( ( f i n=fopen ( argv [ 1 ], r ))==NULL){ /* INPUT FILE */ 29 f p r i n t f ( s t d e r r, %s : cannot f i n d %s \n, argv [ 0 ], argv [ 1 ] ) ; 30 return ; 31 } 32 33 i f ( ( f o u t=fopen ( argv [ 2 ], w ))==NULL){ /* OUTPUT FILE */ 34 f p r i n t f ( s t d e r r, %s : cannot open %s \n, argv [ 0 ], argv [ 2 ] ) ; 35 return ; 36 } 37 /* */ 38 i f ( ( f s t a t i s t i c=fopen ( p t a i l s t a t i s t i c. data, a ) ) ==NULL){ 39 f p r i n t f ( s t d e r r, Cannot open s t a t i s t i c f i l e \n ) ; 40 return ; 41 } 42 43 /* #################### FILE HEADER ####################### */ 44 i =0; j =0; 45 while ( 1 ) { 46 f g e t s ( l i n e,max, f i n ) ; j ++; 47 i f ( l i n e [ 0 ]! = # ){ /* */ 48 f p r i n t f ( stdout, %s, l i n e ) ; 49 i ++; 50 i f ( i ==2){ /*2 = */ 51 s s c a n f ( l i n e, %d %d,&width,& h e i g h t ) ; /* */ 52 } 53 i f ( i ==3){ /*3 = */ 54 s s c a n f ( l i n e, %d,&max ) ; /* */ 10

55 } 56 i f ( i!=3) 57 f p r i n t f ( fout, %s, l i n e ) ; /* */ 58 else { 59 f p r i n t f ( fout, 1\n ) ; 60 break ; /*3 w h i l e */ 61 } 62 } 63 else { /* */ 64 i f ( j ==10) break ; /* */ 65 else continue ; 66 } 67 } 68 69 /* ################### PREPARE MEMORY ##################### */ 70 f =(int ) malloc ( s i z e o f ( int ) h e i g h t ) ; 71 g=(int ) malloc ( s i z e o f ( int ) h e i g h t ) ; 72 i f ( f==null g==null){ 73 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 74 } 75 for ( i =0; i <h e i g h t ; i ++){ 76 f [ i ]=( int ) malloc ( s i z e o f ( int ) width ) ; 77 g [ i ]=( int ) malloc ( s i z e o f ( int ) width ) ; 78 i f ( f [ i ]==NULL g [ i ]==NULL){ 79 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 80 } 81 } 82 83 histogram=(int ) malloc ( s i z e o f ( int ) max ) ; 84 i f ( histogram==null){ 85 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 86 } 87 for ( i =0; i <(max+1); i ++){ /* */ 88 histogram [ i ]=0; 89 } 90 /* #################### READ DATA ######################## */ 91 for ( i =0; i <h e i g h t ; i ++){ 92 for ( j =0; j<width ; j ++){ 93 f s c a n f ( f i n, %d,& f [ i ] [ j ] ) ; 94 g [ i ] [ j ]= f [ i ] [ j ] ; /* g[i][j] */ 95 } 96 } 97 98 /* ################## MAIN PROCESING #################### */ 99 p r i n t f ( p \n ) ; 100 /* */ 101 p r i n t f ( : ) ; 102 s c a n f ( %d,& per ) ; 103 s t a r t=c l o c k ( ) ; 104 105 f p r i n t f ( f s t a t i s t i c, %s,%d,, argv [ 1 ], per ) ; 106 107 /* */ 108 for ( i =0; i <h e i g h t ; i ++){ 109 for ( j =0; j<width ; j ++){ 110 histogram [ f [ i ] [ j ]]++; 111 } 112 } 11

113 114 gazousuu=h e i g h t width ; 115 p r i n t f ( : %d\n, gazousuu ) ; 116 117 f p r i n t f ( f s t a t i s t i c, %d,, gazousuu ) ; 118 119 gazousuu=(int ) ( gazousuu per 0. 0 1 ) ; /* */ 120 p r i n t f ( : %d\n, gazousuu ) ; 121 122 f p r i n t f ( f s t a t i s t i c, %d,, gazousuu ) ; 123 124 i =0; menseki =0; 125 while ( menseki < gazousuu && i <(max+1)){ 126 /* */ 127 menseki +=histogram [ i ] ; 128 i ++; 129 } 130 s i k i i t i =i 1; 131 132 p r i n t f ( : %d\n, s i k i i t i ) ; 133 f p r i n t f ( f s t a t i s t i c, %d,, s i k i i t i ) ; 134 135 for ( i =0; i <h e i g h t ; i ++){ 136 for ( j =0; j<width ; j ++){ 137 i f ( g [ i ] [ j ]< s i k i i t i ) 138 g [ i ] [ j ]=0; 139 else 140 g [ i ] [ j ]=1; 141 } 142 } 143 144 end=c l o c k ( ) ; 145 p r i n t f ( TIME: %.6 l f s e c \n, ( double ) ( end s t a r t )/CLOCKS PER SEC ) ; 146 147 f p r i n t f ( f s t a t i s t i c, %.4 l f \n, ( double ) ( end s t a r t )/CLOCKS PER SEC ) ; 148 /* #################### WRITE DATA # #################### */ 149 k=0; 150 for ( i =0; i <h e i g h t ; i ++){ 151 for ( j =0; j<width ; j ++){ 152 k++; 153 f p r i n t f ( fout, %3d, g [ i ] [ j ] ) ; /* */ 154 i f ( k==17){ 155 f p r i n t f ( fout, \n ) ; 156 k=0; 157 } 158 } 159 } 160 /* ################### CLOSE FILE ####################### */ 161 f c l o s e ( f o u t ) ; 162 f c l o s e ( f i n ) ; 163 f c l o s e ( f s t a t i s t i c ) ; 164 return 0 ; 165 } 4.7 3 2 12

2: 3 2 1 /* ################ 2 # 2 - # 3 ################# */ 4 5 #include<s t d i o. h> 6 #include<time. h> 7 #include<s t d l i b. h> 8 #include<math. h> 9 #define MAX 1000 10 #define SPACE 5 11 int main ( int argc, char argv [ ] ) 12 { 13 /* */ 14 FILE f i n, fout, f s t a t i s t i c ; 15 char l i n e [MAX] ; 16 int i, j, k, width, height, max ; /*,, */ 17 int f, g ; 18 c l o c k t s t a r t, end ; 19 int histogram, yamamax=0, s i k i i t i =0; 20 int tmp=0,tmp1=0, maxleft =0, maxright =0,min=0; 21 /* #################### FILE OPEN ######################### */ 22 i f ( argc!=3){ 23 p r i n t f ( Argument Error. Try Again \n ) ; return ; 24 } 25 26 i f ( ( f i n=fopen ( argv [ 1 ], r ))==NULL){ /* INPUT FILE */ 27 f p r i n t f ( s t d e r r, %s : cannot f i n d %s \n, argv [ 0 ], argv [ 1 ] ) ; 28 return ; 29 } 30 31 i f ( ( f o u t=fopen ( argv [ 2 ], w ))==NULL){ /* OUTPUT FILE */ 32 f p r i n t f ( s t d e r r, %s : cannot open %s \n, argv [ 0 ], argv [ 2 ] ) ; 33 return ; 34 } 35 /* */ 36 i f ( ( f s t a t i s t i c=fopen ( m o d e m e t h o d s t a t i s t i c. data, a ))==NULL ){ 37 f p r i n t f ( s t d e r r, Cannot open s t a t i s t i c f i l e \n ) ; 38 return ; 39 } 40 /* #################### FILE HEADER ####################### */ 41 i =0; j =0; 42 while ( 1 ) { 43 f g e t s ( l i n e,max, f i n ) ; j ++; 44 i f ( l i n e [ 0 ]! = # ){ /* */ 45 f p r i n t f ( stdout, %s, l i n e ) ; 46 i ++; 47 i f ( i ==2){ /*2 = */ 48 s s c a n f ( l i n e, %d %d,&width,& h e i g h t ) ; /* */ 49 } 50 i f ( i ==3){ /*3 = */ 51 s s c a n f ( l i n e, %d,&max ) ; /* */ 52 } 53 i f ( i!=3) 54 f p r i n t f ( fout, %s, l i n e ) ; /* */ 55 else { 56 f p r i n t f ( fout, 1\n ) ; 57 break ; /*3 w h i l e */ 13

58 } 59 } 60 else { /* */ 61 i f ( j ==10) break ; /* */ 62 else continue ; 63 } 64 } 65 66 /* ################### PREPARE MEMORY ##################### */ 67 f =(int ) malloc ( s i z e o f ( int ) h e i g h t ) ; 68 g=(int ) malloc ( s i z e o f ( int ) h e i g h t ) ; 69 i f ( f==null g==null){ 70 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 71 } 72 for ( i =0; i <h e i g h t ; i ++){ 73 f [ i ]=( int ) malloc ( s i z e o f ( int ) width ) ; 74 g [ i ]=( int ) malloc ( s i z e o f ( int ) width ) ; 75 i f ( f [ i ]==NULL g [ i ]==NULL){ 76 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 77 } 78 } 79 80 histogram=(int ) malloc ( s i z e o f ( int ) (max+1)); 81 i f ( histogram==null){ 82 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 83 } 84 for ( i =0; i <(max+1); i ++){ /* */ 85 histogram [ i ]=0; 86 } 87 /* #################### READ DATA ######################## */ 88 for ( i =0; i <h e i g h t ; i ++){ 89 for ( j =0; j<width ; j ++){ 90 f s c a n f ( f i n, %d,& f [ i ] [ j ] ) ; 91 g [ i ] [ j ]= f [ i ] [ j ] ; 92 } 93 } 94 95 /* ################## MAIN PROCESING #################### */ 96 p r i n t f ( \n ) ; 97 s t a r t=c l o c k ( ) ; 98 f p r i n t f ( f s t a t i s t i c, %s,, argv [ 1 ] ) ; 99 for ( i =0; i <h e i g h t ; i ++){ /* */ 100 for ( j =0; j<width ; j ++){ 101 histogram [ f [ i ] [ j ]]++; 102 } 103 } 104 /* ( ) */ 105 yamamax=0; j =0; 106 for ( i =0; i <(max+1); i ++){ 107 i f ( j<histogram [ i ] ) { 108 j=histogram [ i ] ; 109 yamamax=i ; 110 } 111 } 112 f p r i n t f ( f s t a t i s t i c, %d,,yamamax ) ; 113 114 /* */ 115 /* */ 14

116 tmp=1; 117 for ( i=yamamax ; i >1; i ){ 118 i f ( histogram [ i ]< histogram [ i 1] && 119 f a b s ( histogram [ i ] histogram [ i 1])>SPACE){ 120 tmp=i ; 121 break ; 122 } 123 } 124 f p r i n t f ( f s t a t i s t i c, %d,,tmp ) ; 125 /*0 */ 126 maxleft =0; j =0; 127 for ( i =0; i <tmp ; i ++){ 128 i f ( histogram [ i ]>= j ){ 129 j=histogram [ i ] ; 130 maxleft=i ; 131 } 132 } 133 f p r i n t f ( f s t a t i s t i c, %d,, maxleft ) ; 134 /* */ 135 tmp1=max ; 136 for ( i=yamamax ; i <(max+1); i ++){ 137 i f ( histogram [ i ]< histogram [ i +1] && 138 f a b s ( histogram [ i ] histogram [ i +1])>SPACE){ 139 tmp1=i ; 140 break ; 141 } 142 } 143 f p r i n t f ( f s t a t i s t i c, %d,, tmp1 ) ; 144 /* t m p 1 */ 145 maxright=max ; j =0; 146 for ( i=tmp1+1; i <max+1; i ++){ 147 i f ( histogram [ i ]>= j ){ 148 j=histogram [ i ] ; 149 maxright=i ; 150 } 151 } 152 f p r i n t f ( f s t a t i s t i c, maxrihgt:%d,, maxright ) ; 153 154 i f ( histogram [ maxleft ]> histogram [ maxright ] ) { 155 f p r i n t f ( f s t a t i s t i c, Saiyou :%d,, maxleft ) ; 156 s i k i i t i =(int ) ( ( yamamax+maxleft ) / 2 ) ; 157 } 158 else i f ( histogram [ maxleft ]< histogram [ maxright ] ) { 159 f p r i n t f ( f s t a t i s t i c, Saiyou%d,, maxright ) ; 160 s i k i i t i =(int ) ( ( yamamax+maxright ) / 2 ) ; 161 } 162 else { 163 i f ( ( yamamax maxleft )>=(maxright yamamax ) ) { 164 f p r i n t f ( f s t a t i s t i c, Saiyou : %d,, maxleft ) ; 165 s i k i i t i =(int ) ( ( yamamax+maxleft ) / 2 ) ; 166 } else { 167 f p r i n t f ( f s t a t i s t i c, Saiyou : %d,, maxright ) ; 168 s i k i i t i =(int ) ( ( yamamax+maxright ) / 2 ) ; 169 } 170 } 171 172 f p r i n t f ( f s t a t i s t i c, s i k i t i :%d,, s i k i i t i ) ; 173 15

174 for ( i =0; i <h e i g h t ; i ++){ 175 for ( j =0; j<width ; j ++){ 176 i f ( g [ i ] [ j ]<= s i k i i t i ) 177 g [ i ] [ j ]=0; 178 else 179 g [ i ] [ j ]=1; 180 } 181 } 182 183 end=c l o c k ( ) ; 184 p r i n t f ( TIME: %.6 l f s e c \n, ( double ) ( end s t a r t )/CLOCKS PER SEC ) ; 185 f p r i n t f ( f s t a t i s t i c, %.4 l f \n, ( double ) ( end s t a r t )/CLOCKS PER SEC ) ; 186 /* #################### WRITE DATA # #################### */ 187 k=0; 188 for ( i =0; i <h e i g h t ; i ++){ 189 for ( j =0; j<width ; j ++){ 190 k++; 191 f p r i n t f ( fout, %3d, g [ i ] [ j ] ) ; /* */ 192 i f ( k==17){ 193 f p r i n t f ( fout, \n ) ; 194 k=0; 195 } 196 } 197 } 198 /* ################### CLOSE FILE ####################### */ 199 f c l o s e ( f o u t ) ; 200 f c l o s e ( f i n ) ; 201 f c l o s e ( f s t a t i s t i c ) ; 202 return ; 203 } 4.8 3 3 3: 3 3 1 /* ################ 2 # 2 - # 3 ################# */ 4 5 #include<s t d i o. h> 6 #include<s t d l i b. h> 7 #include<time. h> 8 #include<math. h> 9 #define MAX 1000 10 11 int main ( int argc, char argv [ ] ) 12 { 13 /* */ 14 FILE f i n, fout, f s t a t i s t i c ; 15 char l i n e [MAX] ; 16 int i, j, k, width, height, max ; /*,, */ 17 int f, g ; 18 c l o c k t s t a r t, end ; 19 int bibun [ 8 ], histogram, sum=0,tmp=0, s i k i i t i =0; /* */ 20 int h i s ; /* */ 21 /* #################### FILE OPEN ######################### */ 16

22 i f ( argc!=3){ 23 p r i n t f ( Argument Error. Try Again \n ) ; return ; 24 } 25 i f ( ( f i n=fopen ( argv [ 1 ], r ))==NULL){ /* INPUT FILE */ 26 f p r i n t f ( s t d e r r, %s : cannot f i n d %s \n, argv [ 0 ], argv [ 1 ] ) ; 27 return ; 28 } 29 i f ( ( f o u t=fopen ( argv [ 2 ], w ))==NULL){ /* OUTPUT FILE */ 30 f p r i n t f ( s t d e r r, %s : cannot open %s \n, argv [ 0 ], argv [ 2 ] ) ; 31 return ; 32 } 33 i f ( ( f s t a t i s t i c=fopen ( b i b u n s t a t i s t i c. data, a ))==NULL){ 34 f p r i n t f ( s t d e r r, Cannot open s t a t i s t i c f i l e \n ) ; 35 return ; 36 } 37 /* #################### FILE HEADER ####################### */ 38 i =0; j =0; 39 while ( 1 ) { 40 f g e t s ( l i n e,max, f i n ) ; j ++; 41 i f ( l i n e [ 0 ]! = # ){ /* */ 42 f p r i n t f ( stdout, %s, l i n e ) ; 43 i ++; 44 i f ( i ==2){ /*2 = */ 45 s s c a n f ( l i n e, %d %d,&width,& h e i g h t ) ; /* */ 46 } 47 i f ( i ==3){ /*3 = */ 48 s s c a n f ( l i n e, %d,&max ) ; /* */ 49 } 50 i f ( i!=3) 51 f p r i n t f ( fout, %s, l i n e ) ; /* */ 52 else { 53 f p r i n t f ( fout, 1\n ) ; 54 break ; /*3 w h i l e */ 55 } 56 } 57 else { /* */ 58 i f ( j ==10) break ; /* */ 59 else continue ; 60 } 61 } 62 63 /* ################### PREPARE MEMORY ##################### */ 64 f =(int ) malloc ( s i z e o f ( int ) h e i g h t ) ; 65 g=(int ) malloc ( s i z e o f ( int ) h e i g h t ) ; 66 i f ( f==null g==null){ 67 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 68 } 69 for ( i =0; i <h e i g h t ; i ++){ 70 f [ i ]=( int ) malloc ( s i z e o f ( int ) width ) ; 71 g [ i ]=( int ) malloc ( s i z e o f ( int ) width ) ; 72 i f ( f [ i ]==NULL g [ i ]==NULL){ 73 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 74 } 75 } 76 77 histogram=(int ) malloc ( s i z e o f ( int ) (max+1)); 78 h i s =(int ) malloc ( s i z e o f ( int ) (max+1)); 79 i f ( histogram==null h i s==null){ 17

80 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 81 } 82 for ( i =0; i <(max+1); i ++){ 83 histogram [ i ]=0; h i s [ i ]=0; 84 } 85 /* #################### READ DATA ######################## */ 86 for ( i =0; i <h e i g h t ; i ++){ 87 for ( j =0; j<width ; j ++){ 88 f s c a n f ( f i n, %d,& f [ i ] [ j ] ) ; 89 g [ i ] [ j ]= f [ i ] [ j ] ; 90 } 91 } 92 93 /* ################## MAIN PROCESING #################### */ 94 f p r i n t f ( f s t a t i s t i c, #%s \n, argv [ 1 ] ) ; 95 p r i n t f ( \n ) ; 96 s t a r t=c l o c k ( ) ; 97 /* 8 */ 98 for ( i =0; i <h e i g h t ; i ++){ 99 for ( j =0; j<width ; j ++){ 100 h i s [ f [ i ] [ j ]]++; 101 } 102 } 103 104 for ( i =1; i <height 1; i ++){ 105 for ( j =1; j<width 1; j ++){ 106 bibun [0]= f a b s ( f [ i ] [ j ] f [ i 1][ j 1 ] ) ; 107 bibun [1]= f a b s ( f [ i ] [ j ] f [ i 1][ j ] ) ; 108 bibun [2]= f a b s ( f [ i ] [ j ] f [ i 1][ j + 1 ] ) ; 109 bibun [3]= f a b s ( f [ i ] [ j ] f [ i ] [ j 1 ] ) ; 110 bibun [4]= f a b s ( f [ i ] [ j ] f [ i ] [ j + 1 ] ) ; 111 bibun [5]= f a b s ( f [ i ] [ j ] f [ i +1][ j 1 ] ) ; 112 bibun [6]= f a b s ( f [ i ] [ j ] f [ i +1][ j ] ) ; 113 bibun [7]= f a b s ( f [ i ] [ j ] f [ i +1][ j + 1 ] ) ; 114 for ( k=0;k<8;k++){ 115 sum+=bibun [ k ] ; 116 } 117 histogram [ f [ i ] [ j ]]+=sum ; /* */ 118 sum=0; 119 } 120 } 121 122 for ( i =0; i <(max+1); i ++){ 123 f p r i n t f ( f s t a t i s t i c, %5d %7d %7d\n, i, h i s [ i ], histogram [ i ] ) ; 124 } 125 126 tmp=0; 127 for ( i =0; i <(max+1); i ++){ 128 i f (tmp<histogram [ i ] ) { 129 tmp=histogram [ i ] ; /* */ 130 s i k i i t i =i ; /* */ 131 } 132 } 133 p r i n t f ( :%5d\n, s i k i i t i ) ; /* */ 134 f p r i n t f ( f s t a t i s t i c, #%d\n, s i k i i t i ) ; 135 136 for ( i =1; i <height 1; i ++){ 137 for ( j =1; j<width ; j ++){ 18

138 i f ( g [ i ] [ j ]<= s i k i i t i ) 139 g [ i ] [ j ]=0; 140 else 141 g [ i ] [ j ]=1; 142 } 143 } 144 /* */ 145 for ( i =0; i <width ; i ++){ 146 i f ( g [ 0 ] [ i ]<= s i k i i t i ) 147 g [ 0 ] [ i ]=0; 148 else 149 g [ 0 ] [ i ]=1; 150 151 i f ( g [ height 1][ i ]<= s i k i i t i ) 152 g [ height 1][ i ]=0; 153 else 154 g [ height 1][ i ]=1; 155 } 156 for ( i =0; i <h e i g h t ; i ++){ 157 i f ( g [ i ][0] <= s i k i i t i ) 158 g [ i ] [ 0 ] = 0 ; 159 else 160 g [ i ] [ 0 ] = 1 ; 161 162 i f ( g [ i ] [ width 1]<= s i k i i t i ) 163 g [ i ] [ width 1]=0; 164 else 165 g [ i ] [ width 1]=1; 166 } 167 168 end=c l o c k ( ) ; 169 p r i n t f ( TIME: %.6 l f s e c \n, ( double ) ( end s t a r t )/CLOCKS PER SEC ) ; 170 f p r i n t f ( f s t a t i s t i c, #time :%.6 l f \n\n, ( double ) ( end s t a r t )/CLOCKS PER SEC ) ; 171 /* #################### WRITE DATA # #################### */ 172 k=0; 173 for ( i =0; i <h e i g h t ; i ++){ 174 for ( j =0; j<width ; j ++){ 175 k++; 176 f p r i n t f ( fout, %3d, g [ i ] [ j ] ) ; /* */ 177 i f ( k==17){ 178 f p r i n t f ( fout, \n ) ; 179 k=0; 180 } 181 } 182 } 183 /* ################### CLOSE FILE ####################### */ 184 f c l o s e ( f o u t ) ; 185 f c l o s e ( f i n ) ; 186 f c l o s e ( f s t a t i s t i c ) ; 187 return ; 188 } 4.9 3 4 4: 3 4 19

1 /* ################ 2 # 2 - # 3 ################# */ 4 5 #include<s t d i o. h> 6 #include<s t d l i b. h> 7 #include<time. h> 8 #include<math. h> 9 #define MAX 1000 10 11 int main ( int argc, char argv [ ] ) 12 { 13 /* r */ 14 FILE f i n, fout, f s t a t i s t i c ; 15 char l i n e [MAX] ; 16 int i, j, k, width, height, max ; /*,, */ 17 int f, g ; 18 c l o c k t s t a r t, end ; 19 int histogram, s i k i i t i =0; 20 int c l a s s l n u m =0, class rnum =0; 21 int c l a s s l a v e =0, c l a s s r a v e =0; 22 int c l a s s l b u n =0, c l a s s r b u n =0; 23 double tmp1=0,tmp2=0; 24 double bun max =0.; 25 /* #################### FILE OPEN ######################### */ 26 i f ( argc!=3){ 27 p r i n t f ( Argument Error. Try Again \n ) ; return ; 28 } 29 30 i f ( ( f i n=fopen ( argv [ 1 ], r ))==NULL){ /* INPUT FILE */ 31 f p r i n t f ( s t d e r r, %s : Cannot f i n d \n, argv [ 1 ] ) ; 32 return ; 33 } 34 35 i f ( ( f o u t=fopen ( argv [ 2 ], w ))==NULL){ /* OUTPUT FILE */ 36 f p r i n t f ( s t d e r r, %s : Cannot open \n, argv [ 2 ] ) ; 37 return ; 38 } 39 i f ( ( f s t a t i s t i c=fopen ( h b m e t h o d s t a t i s t i c. data, a ))==NULL){ 40 f p r i n t f ( s t d e r r, Cannot open s t a t i s t i c f i l e \n ) ; 41 return ; 42 } 43 /* #################### FILE HEADER ####################### */ 44 i =0; j =0; 45 while ( 1 ) { 46 f g e t s ( l i n e,max, f i n ) ; j ++; 47 i f ( l i n e [ 0 ]! = # ){ /* */ 48 f p r i n t f ( stdout, %s, l i n e ) ; 49 i ++; 50 i f ( i ==2){ /*2 = */ 51 s s c a n f ( l i n e, %d %d,&width,& h e i g h t ) ; /* */ 52 } 53 i f ( i ==3){ /*3 = */ 54 s s c a n f ( l i n e, %d,&max ) ; /* */ 55 } 56 i f ( i!=3) 57 f p r i n t f ( fout, %s, l i n e ) ; /* */ 58 else { 20

59 f p r i n t f ( fout, 1\n ) ; 60 break ; /*3 w h i l e */ 61 } 62 } 63 else { /* */ 64 i f ( j ==10) break ; /* */ 65 else continue ; 66 } 67 } 68 69 /* ################### PREPARE MEMORY ##################### */ 70 f =(int ) malloc ( s i z e o f ( int ) h e i g h t ) ; 71 g=(int ) malloc ( s i z e o f ( int ) h e i g h t ) ; 72 i f ( f==null g==null){ 73 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 74 } 75 for ( i =0; i <h e i g h t ; i ++){ 76 f [ i ]=( int ) malloc ( s i z e o f ( int ) width ) ; 77 g [ i ]=( int ) malloc ( s i z e o f ( int ) width ) ; 78 i f ( f [ i ]==NULL g [ i ]==NULL){ 79 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 80 } 81 } 82 83 histogram=(int ) malloc ( s i z e o f ( int ) (max+1)); 84 i f ( histogram==null){ 85 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 86 } 87 for ( i =0; i <max ; i ++){ /* */ 88 histogram [ i ]=0; 89 } 90 /* #################### READ DATA ######################## */ 91 for ( i =0; i <h e i g h t ; i ++){ 92 for ( j =0; j<width ; j ++){ 93 f s c a n f ( f i n, %d,& f [ i ] [ j ] ) ; 94 g [ i ] [ j ]= f [ i ] [ j ] ; 95 } 96 } 97 98 /* ################## MAIN PROCESING #################### */ 99 p r i n t f ( \n ) ; 100 s t a r t=c l o c k ( ) ; 101 for ( i =0; i <h e i g h t ; i ++){ /* */ 102 for ( j =0; j<width ; j ++){ 103 histogram [ f [ i ] [ j ]]++; 104 } 105 } 106 f p r i n t f ( f s t a t i s t i c, #%s \n, argv [ 1 ] ) ; 107 /*2 */ 108 for ( i =0; i <(max+1); i ++){ 109 c l a s s l n u m=class rnum =0; 110 c l a s s l a v e=c l a s s r a v e =0; 111 112 for ( j =0; j<i ; j ++){ 113 c l a s s l n u m+=histogram [ j ] ; 114 } 115 116 class rnum=( h e i g h t width) c l a s s l n u m ; 21

117 118 i f ( c l a s s l n u m==0) c l a s s l n u m =1; 119 i f ( class rnum==0) class rnum =1; 120 121 122 /* */ 123 for ( j =0; j<i ; j ++){ 124 c l a s s l a v e+=histogram [ j ] j ; 125 } 126 c l a s s l a v e=c l a s s l a v e / c l a s s l n u m ; 127 128 for ( j=i ; j <(max+1); j ++){ 129 c l a s s r a v e+=histogram [ j ] j ; 130 } 131 c l a s s r a v e=c l a s s r a v e / class rnum ; 132 133 134 tmp1=1. c l a s s l n u m class rnum pow ( ( c l a s s l a v e c l a s s r a v e ), 2 ) ; 135 tmp2=1. pow ( ( c l a s s l n u m+class rnum ), 2 ) ; 136 137 f p r i n t f ( f s t a t i s t i c, %5d %7d %15.5 l f \n, i, histogram [ i ], tmp1/tmp2 ) ; 138 139 i f ( bun max<(tmp1/tmp2 ) ) { 140 bun max=(tmp1/tmp2 ) ; 141 s i k i i t i =i ; 142 } 143 } 144 145 p r i n t f ( %d\n, s i k i i t i ) ; 146 f p r i n t f ( f s t a t i s t i c, #%d\n, s i k i i t i ) ; 147 148 for ( i =0; i <h e i g h t ; i ++){ 149 for ( j =0; j<width ; j ++){ 150 i f ( f [ i ] [ j ]>= s i k i i t i ) 151 g [ i ] [ j ]=1; 152 else 153 g [ i ] [ j ]=0; 154 } 155 } 156 157 end=c l o c k ( ) ; 158 p r i n t f ( TIME: %.6 l f s e c \n, ( double ) ( end s t a r t )/CLOCKS PER SEC ) ; 159 f p r i n t f ( f s t a t i s t i c, #%.5 l f \n\n, ( double ) ( end s t a r t )/CLOCKS PER SEC ) ; 160 /* #################### WRITE DATA # #################### */ 161 k=0; 162 for ( i =0; i <h e i g h t ; i ++){ 163 for ( j =0; j<width ; j ++){ 164 k++; 165 f p r i n t f ( fout, %3d, g [ i ] [ j ] ) ; /* */ 166 i f ( k==17){ 167 f p r i n t f ( fout, \n ) ; 168 k=0; 169 } 170 } 171 } 172 /* ################### CLOSE FILE ####################### */ 173 f c l o s e ( f o u t ) ; 174 f c l o s e ( f i n ) ; 22

175 f c l o s e ( f s t a t i s t i c ) ; 176 return ; 177 } 4.10 3 5 5: 3 5 1 /* ################ 2 # 2 - # 3 ################# */ 4 5 #include<s t d i o. h> 6 #include<s t d l i b. h> 7 #include<math. h> 8 #include<time. h> 9 10 #define MAX 1000 11 void hb method ( int x1, int y1, int x2, int y2 ) ; 12 13 FILE f i n, fout, f s t a t i s t i c ; /* */ 14 int max, width, h e i g h t ; /*,, */ 15 int f, g ; 16 int histogram ; 17 int s i k i i t i =0; 18 int main ( int argc, char argv [ ] ) 19 { 20 21 char l i n e [MAX] ; 22 int i, j, k ; 23 c l o c k t s t a r t, end ; 24 int yoko jump =0, tate jump =0; 25 int x1, y1, x2, y2, tate, yoko, amari y, amari t ; 26 /* #################### FILE OPEN ######################### */ 27 i f ( argc!=3){ 28 p r i n t f ( Argument Error. Try Again \n ) ; return ; 29 } 30 31 i f ( ( f i n=fopen ( argv [ 1 ], r ))==NULL){ /* INPUT FILE */ 32 f p r i n t f ( s t d e r r, %s : cannot f i n d %s \n, argv [ 0 ], argv [ 1 ] ) ; 33 return ; 34 } 35 36 i f ( ( f o u t=fopen ( argv [ 2 ], w ))==NULL){ /* OUTPUT FILE */ 37 f p r i n t f ( s t d e r r, %s : cannot open %s \n, argv [ 0 ], argv [ 2 ] ) ; 38 return ; 39 } 40 i f ( ( f s t a t i s t i c=fopen ( 3 5 s t a t i s t i c. data, a ))==NULL ){ 41 f p r i n t f ( s t d e r r, Cannot open s t a t i s t i c f i l e \n ) ; 42 return ; 43 } 44 /* #################### FILE HEADER ####################### */ 45 i =0; j =0; 46 while ( 1 ) { 47 f g e t s ( l i n e,max, f i n ) ; j ++; 48 i f ( l i n e [ 0 ]! = # ){ /* */ 23

49 f p r i n t f ( stdout, %s, l i n e ) ; 50 i ++; 51 i f ( i ==2){ /*2 = */ 52 s s c a n f ( l i n e, %d %d,&width,& h e i g h t ) ; /* */ 53 } 54 i f ( i ==3){ /*3 = */ 55 s s c a n f ( l i n e, %d,&max ) ; /* */ 56 } 57 i f ( i!=3) 58 f p r i n t f ( fout, %s, l i n e ) ; /* */ 59 else { 60 f p r i n t f ( fout, 1\n ) ; 61 break ; /*3 w h i l e */ 62 } 63 } 64 else { /* */ 65 i f ( j ==10) break ; /* */ 66 else continue ; 67 } 68 } 69 /* ################### PREPARE MEMORY ##################### */ 70 /* */ 71 f =(int ) malloc ( s i z e o f ( int ) h e i g h t ) ; 72 g=(int ) malloc ( s i z e o f ( int ) h e i g h t ) ; 73 i f ( f==null g==null){ 74 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 75 } 76 for ( i =0; i <h e i g h t ; i ++){ 77 f [ i ]=( int ) malloc ( s i z e o f ( int ) width ) ; 78 g [ i ]=( int ) malloc ( s i z e o f ( int ) width ) ; 79 i f ( f [ i ]==NULL g [ i ]==NULL){ 80 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 81 } 82 } 83 /* */ 84 histogram=(int ) malloc ( s i z e o f ( int ) (max+1)); 85 i f ( histogram==null){ 86 p r i n t f ( Memory Error. Try Again. \ n ) ; return ; 87 } 88 for ( i =0; i <(max+1); i ++){ 89 histogram [ i ]=0; 90 } 91 92 /* #################### READ DATA ######################## */ 93 for ( i =0; i <h e i g h t ; i ++){ 94 for ( j =0; j<width ; j ++){ 95 f s c a n f ( f i n, %d,& f [ i ] [ j ] ) ; 96 g [ i ] [ j ]= f [ i ] [ j ] ; 97 } 98 } 99 100 /* ################## MAIN PROCESING #################### */ 101 p r i n t f ( \n ) ; 102 f p r i n t f ( f s t a t i s t i c, #%s \n#width=%d, h e i g h t=%d\n, argv [ 1 ], width, h e i g h t ) ; 103 p r i n t f ( \n ) ; 104 p r i n t f ( : ) ; s c a n f ( %d,& t a t e ) ; 105 p r i n t f ( : ) ; s c a n f ( %d,&yoko ) ; 106 i f ( tate <=0) /* Floating Exception Error */ 24

107 t a t e =1; 108 i f ( yoko<=0) 109 yoko =1; 110 111 i f ( t a t e==1 && yoko==1){ 112 hb method ( 0, 0, width, h e i g h t ) ; 113 return ; 114 } 115 116 117 yoko jump=width / t a t e ; 118 amari y=width%t a t e ; 119 120 tate jump=h e i g h t /yoko ; 121 amari t=h e i g h t%yoko ; 122 123 124 p r i n t f ( : %d\n, tate jump ) ; 125 p r i n t f ( : %d\n, yoko jump ) ; 126 f p r i n t f ( f s t a t i s t i c, #%d,%d,%d,%d\n, yoko, tate, yoko jump, tate jump ) ; 127 s t a r t=c l o c k ( ) ; 128 for ( i =0; i <h e i g h t ; i=i+tate jump ){ 129 y1=i ; y2=y1+tate jump ; 130 i f ( y2+amari t>=h e i g h t ){ 131 y2=h e i g h t ; i=h e i g h t ; 132 } 133 134 for ( j =0; j<width ; j=j+yoko jump ){ 135 x1=j ; 136 x2=x1+yoko jump ; 137 138 i f ( x2+amari y>=width ){ 139 x2=width ; j=width ; 140 } 141 p r i n t f ( (%4d%4d)(%4d%4d ),\ n, x1, y1, x2, y2 ) ; 142 f p r i n t f ( f s t a t i s t i c, %5d %5d %5d %5d, x1, y1, x2, y2 ) ; 143 hb method ( x1, y1, x2, y2 ) ; 144 145 } 146 } 147 148 p r i n t f ( \n ) ; 149 end=c l o c k ( ) ; 150 p r i n t f ( TIME: %.6 l f s e c \n, ( double ) ( end s t a r t )/CLOCKS PER SEC ) ; 151 f p r i n t f ( f s t a t i s t i c, #%.6 l f \n\n, ( double ) ( end s t a r t )/CLOCKS PER SEC ) ; 152 /* #################### WRITE DATA # #################### */ 153 k=0; 154 for ( i =0; i <h e i g h t ; i ++){ 155 for ( j =0; j<width ; j ++){ 156 k++; 157 f p r i n t f ( fout, %3d, g [ i ] [ j ] ) ; /* */ 158 i f ( k==17){ 159 f p r i n t f ( fout, \n ) ; 160 k=0; 161 } 162 } 163 } 164 /* ################### CLOSE FILE ####################### */ 25

165 f c l o s e ( f o u t ) ; 166 f c l o s e ( f i n ) ; 167 return ; 168 } 169 170 /* ################################################## */ 171 172 void hb method ( int x1, int y1, int x2, int y2 ){ 173 174 int i =0, j =0; 175 int c l a s s l n u m =0, class rnum =0, c l a s s l a v e =0, c l a s s r a v e =0; 176 double tmp1=0.,tmp2 =0.; 177 double bun max =0.; 178 int height1 =0, width1 =0; 179 180 h e i g h t 1=y2 y1 ; width1=x2 x1 ; 181 182 for ( i =0; i <max+1; i ++){ 183 histogram [ i ]=0; 184 } 185 186 p r i n t f ( \n ) ; 187 188 for ( i=y1 ; i <y2 ; i ++){ /* */ 189 for ( j=x1 ; j<x2 ; j ++){ 190 histogram [ f [ i ] [ j ]]++; 191 } 192 } 193 /*2 */ 194 for ( i =0; i <(max+1); i ++){ 195 c l a s s l n u m=class rnum =0; 196 c l a s s l a v e=c l a s s r a v e =0; 197 198 for ( j =0; j<i ; j ++){ 199 c l a s s l n u m+=histogram [ j ] ; 200 } 201 202 class rnum=( height1 width1) c l a s s l n u m ; 203 204 i f ( c l a s s l n u m==0) c l a s s l n u m =1; 205 i f ( class rnum==0) class rnum =1; 206 207 208 /* */ 209 for ( j =0; j<i ; j ++){ 210 c l a s s l a v e+=histogram [ j ] j ; 211 } 212 c l a s s l a v e=c l a s s l a v e / c l a s s l n u m ; 213 214 for ( j=i ; j <(max+1); j ++){ 215 c l a s s r a v e+=histogram [ j ] j ; 216 } 217 c l a s s r a v e=c l a s s r a v e / class rnum ; 218 219 220 tmp1=1. c l a s s l n u m class rnum pow ( ( c l a s s l a v e c l a s s r a v e ), 2 ) ; 221 tmp2=1. pow ( ( c l a s s l n u m+class rnum ), 2 ) ; 222 26

223 i f ( bun max<(tmp1/tmp2 ) ) { 224 bun max=(tmp1/tmp2 ) ; 225 s i k i i t i =i ; 226 } 227 } 228 229 p r i n t f ( %d\n, s i k i i t i ) ; 230 f p r i n t f ( f s t a t i s t i c, %5d\n, s i k i i t i ) ; 231 for ( i=y1 ; i <y2 ; i ++){ 232 for ( j=x1 ; j<x2 ; j ++){ 233 i f ( f [ i ] [ j ]> s i k i i t i ) 234 g [ i ] [ j ]=1; 235 else 236 g [ i ] [ j ]=0; 237 } 238 } 239 return ; 240 } 5 5.1 31: (FILE OPEN) (FILE HEADER) (PRE- PARE MEMORY) (READ DATA) (MAIN PROCCESSING)( ) (WRITE DATA) (CLOSE FILE) 3 1 3-1 0 27

3 2 2 H max H 2 T l Y l T r Y r : :2 :H max : 0 T l :H max :T r (H max ) 2 (H 2 ) (H max ) 14 2 R R T L T r T l T r 0 T l 32: 3 2 Y l T r Y r Y l Y r R 2 H max H 2 3 3 f ij 8 2 28

3 4 3 4 0 2 i(i=1,2) ω i M, σ 2 M r σ 2 W = ω 1σ 2 1 + ω 2σ 2 2 ω 1 + ω 2 (1) σ 2 B = ω 1(M 1 + M r ) 2 + ω 2 (M 2 M 1 ) 2 ω 1 + ω 2 = ω 1ω 2 (M 1 M 2 ) 2 (ω 1 + ω 2 ) 2 (2) σ 2 T σ2 r = σ 2 w + σ 2 B σb 2 σw 2 = σ 2 B σ 2 T σ2 B (3) σ T σ 2 B 3 5 3 5 3 3 9 W,H t s m = (int)(w/t), n = (int)(h/s), r t = W %t, r s = H%s( ) 33: 3 5 1 1 3 4 4 3 4 29

hb_method 2 5.2 3 1 3 5 3 1 3-1,. 1 100 2 110. 1 13%, 2 12%. 108,101 S /S (%) (s) 13 1 108 0.0000 12 2 101 0.0000 10 1 48 0.0000 2 91 0.0000 20 1 163 0.0000 2 121 0.0000 30 1 164 0.0000 2 124 0.0000 40 1 165 0.0000 2 125 0.0100 50 1 166 0.0000 2 127 0.0000 60 1 167 0.0000 2 128 0.0000 70 1 168 0.0000 2 129 0.0000 80 2 169 0.0000 3 130 0.0000 90 2 171 0.0000 3 132 0.0000 1: p- 30

3 2 H max H 2 T l Y l T r Y r : :2 :H max : 0 T l :H max :T r H max T l Y l T r Y r H 2 (s) 1 106 167 155 45 255 255 45 0.0000 2 86 128 115 45 255 255 45 0.0000 2: 1 167 45 106 2 2 128 45 3 3 1 167 0.0100 2 128 0.0100 3: 3 4 31

1 102 0.0000 2 95 0.0100 4: 3 1 2 3 5 2 4 16 64 (4 ) 2 ( ) ( ) 1 101 69 (0,0) (101,69) 96 (0.0000) (101,0) (202,69) 110 (0,69) (101,138) 123 (101,69) (202,138) 106 2 160 120 (0,0) (160,120) 102 (0.0000) (160,0) (320,120) 102 (0,120) (160,240) 97 (160,120) (320,240) 102 5: : 4 5.3 3 1 3 5 3 1 p 2 32

3 3 2 2 1 4 3 3 2 3 4 ( 1 2 ) 3 5 2 6 33