- 432 名前:デフォルトの名無しさん [2008/06/23(月) 14:03:54 ]
- [1] 授業単元:画像処理 [2] 環境 [2.1] OS:Linux [2.2] 言語:C言語
#include <stdio.h> #include <stdlib.h> int main( int argc , char *argv[] ) { unsigned short int ipi[256][32]; unsigned short int ipo[256][32]; FILE *fpi,*fpo; int i,j; if((fpi=fopen( "logo.gray" ,"rb")) == NULL) { printf("file open error\n"); exit(-1); } fread(ipi[0],sizeof(unsigned short int),256*32,fpi); fclose(fpi); for (j=0 ;j <256 ; j++){ for (i=0 ;i <32 ; i++){ if(127>ipi[j][i]){ ipo[j][i]=0; } else{ ipo[j][i]=255; } } } if((fpo=fopen( argv[2] ,"wb")) == NULL) { printf("file open error\n"); exit(-1); } fwrite(ipo[0],sizeof(unsigned short int),256*32,fpo); fclose(fpo); logo-bin.gray の境界点を抽出した画像を作成するプログラムを作成せよ。
|

|