Image Filter c Image Filter c void Negative

  • Slides: 29
Download presentation

画像処理関数(Image. Filter. c) • Image. Filter. c – void Negative. Image(void) • PPM形式の入力データをネガ画像に変換 void

画像処理関数(Image. Filter. c) • Image. Filter. c – void Negative. Image(void) • PPM形式の入力データをネガ画像に変換 void Negative. Image(void) { ・・・ // PPM形式の入力データの読み込み p. RGBInput. Data = Read. Ppm(&i. Width, &i. Height, &i. Max. Value); ・・・ }

入出力関数(Image. File. IO. c) • Read. Ppm(int * i. Width, int * i. Height,

入出力関数(Image. File. IO. c) • Read. Ppm(int * i. Width, int * i. Height, int * i. Max. Value) – PPMファイルの読み込み • Write. Ppm(struct RGB * p. RGBOutput. Data, int i. Width, int i. Height, int i. Max. Value) – PPMファイルへ書き出し • Get. Axis. From. Index(int i. Width, int i. Index, int * i. X, int * i. Y) – 1次元のインデックスから2次元座標を取得 など・・・

latexで画像を添付する方法 • 以下のコマンドをレポートに貼り付け begin{figure}[htbp] begin{center} epsfile{file=○○. eps, width=1. 0hsize} caption{レポート上に表示させるタイトル} label{fig: ○○} end{center} end{figure}

latexで画像を添付する方法 • 以下のコマンドをレポートに貼り付け begin{figure}[htbp] begin{center} epsfile{file=○○. eps, width=1. 0hsize} caption{レポート上に表示させるタイトル} label{fig: ○○} end{center} end{figure} • 参考:   http: //www 002. upp. so-net. ne. jp/latex/zu. html

手順1 • Image. Filter. cの中に反転画像を作成する Reversal. Image(void)という関数を作る #include <stdio. h> #include <stdlib. h> ・・・・・・

手順1 • Image. Filter. cの中に反転画像を作成する Reversal. Image(void)という関数を作る #include <stdio. h> #include <stdlib. h> ・・・・・・ void Negative. Image(void) { int i. Width, i. Height, i. Max. Value; ・・・・・・ } void Draw. Lines(void) { int i. Width, i. Height, i. Max. Value; ・・・・・・ } void Reversal. Image(void){ } Image. Filter. c

手順2 • 関数Reversal. Imageの中で反転処理を実装 void Reversal. Image(void){ int i. Width, i. Height, i. Max.

手順2 • 関数Reversal. Imageの中で反転処理を実装 void Reversal. Image(void){ int i. Width, i. Height, i. Max. Value; //横幅のサイズ, 縦幅のサイズ, 最大輝度値 int *pi. Input. Data; //入力画像の画素値を格納 int *p. RVOutput. Data; //出力画像の画素値を格納 Image. Filter. c int I; //ループ変数 printf(“**** Reversal Image ****n”); //入力画像の読み込み pi. Input. Data = Read. Pgm(&i. Width, &i. Height, &i. Max. Value); //出力画像のメモリ確保 p. RVOutput. Data = (int *)malloc(i. Width*i. Height*sizeof(int)); //反転処理 for(i=0; i<i. Width*i. Height; i++){ p. RVOutput. Data[i] = 255 - pi. Input. Data[i]; } Free. Pgm(pi. Input. Data); //入力画像のメモリ解放 Write. Pgm(p. RVOutput. Data, i. Width, i. Height, i. Max. Value); //出力画像の書き出し Free. Pgm(p. RVOutput. Data); //出力画像のメモリ解放 }

手順3 • Image. Filter. h内でReversal. Image関数の宣言 #ifndef _IMAGEFILTER_H_ #define _IMAGEFILTER_H_ void Negative. Image(void); void

手順3 • Image. Filter. h内でReversal. Image関数の宣言 #ifndef _IMAGEFILTER_H_ #define _IMAGEFILTER_H_ void Negative. Image(void); void Draw. Lines(void); void Reversal. Image(void); #endif Image. Filter. h

手順4 • main. c内のmain()関数でReversal. Image関数 を呼び出し #include <stdio. h> #include "Image. Filter. h" main.

手順4 • main. c内のmain()関数でReversal. Image関数 を呼び出し #include <stdio. h> #include "Image. Filter. h" main. c int main(void) { // Negative. Image(); // Draw. Lines(); Reversal. Image(); return 0; } !他の関数をコメントアウトするのを忘れないようにしてください!