// MaxFilter.v 局所最大値フィルタ

#define C_SIZE 1  // キャッシュの大きさ

module Maxfilter(in:input,out:output)
int in on pixel cache C_SIZE;
int out on pixel;
{
  parallel{
    int i,j;
    int max = 0;

    // 注目画素と近傍画素のうち、最も大きな濃度値を
    // 持つものを出力画像の画素値とする
    for(i = -C_SIZE; i < C_SIZE+1; i++){
      for(j = -C_SIZE; j < C_SIZE+1; j++){
	if(max < in[i][j])
	  max = in[i][j];
      }
    }
    out[][] = max;
  }
}

フィルタリングメインフローへ戻る

VIOS トップページ