Exemple #1
0
Fichier : p3.c Projet : kota395/ip
void Process3(Image*dst,Image*src,int magni){
  int x,y;
  for(y=0;y<dst->H;y++)
    for(x=0;x<dst->W;x++){
      IElem(dst,x,y,0) = SmoothExpansion(dst,src,x/magni,y/magni,0);
      IElem(dst,x,y,1) = SmoothExpansion(dst,src,x/magni,y/magni,1);
      IElem(dst,x,y,2) = SmoothExpansion(dst,src,x/magni,y/magni,2);
      /* IElem(dst,x,y,0) == dst->data[(y*dst->W+x)*3+c] */
    }
}
Exemple #2
0
Fichier : p3.c Projet : kota395/ip
void Process(Image*dst,Image*src){//処理本体
  int x,y;
  for(y=0;y<src->H;y++)
    for(x=0;x<src->W;x++){
      int rr=y<src->H*2/3;
      int gg=x<src->W*2/3 && src->H/3<y;
      int bb=src->W/3<x && src->H/3<y;
      IElem(dst,x,y,0)=rr ? IElem(src,x,y,0) : 0;
      IElem(dst,x,y,1)=gg ? IElem(src,x,y,1) : 0;
      IElem(dst,x,y,2)=bb ? IElem(src,x,y,2) : 0;
    }
}
Exemple #3
0
 double ImageSSD(Image*im,int x1,int y1, Image*im2,int x2,int y2){
   int i,j,W=7;
   double sr=0,sg=0,sb=0,dr,dg,db;
   for(i=-W;i<=W;i++) for(j=-W;j<=W;j++){
     dr  = IElem(im, x1+j, y1+i, 0) - IElem(im2, x2+j , y2+i, 0);
     dg  = IElem(im, x1+j, y1+i, 1) - IElem(im2, x2+j , y2+i, 1);
     db  = IElem(im, x1+j, y1+i, 2) - IElem(im2, x2+j , y2+i, 2);
     sr += dr*dr;
     sg += dg*dg;
     sb += db*db;
   }
   return sr+sg+sb;
 }
Exemple #4
0
Fichier : p3.c Projet : kota395/ip
void Process2(Image*dst,Image*src,int RGB){//処理本体
#define RED 100
#define GREEN 10
#define BLUE 1
  int x,y,rr,gg,bb;
  //printf("RGB:%d\n",RGB);
  rr = RGB / RED;   if(RGB >= 100)RGB -= RED;
  gg = RGB / GREEN; if(RGB >= 10) RGB -= GREEN;
  bb = RGB;
  //printf("Red  :%d\nGreen:%d\nBule :%d\n",rr,gg,bb);
  for(y=0;y<src->H;y++)
    for(x=0;x<src->W;x++){
      IElem(dst,x,y,0)=rr ? IElem(src,x,y,0) : 0;
      IElem(dst,x,y,1)=gg ? IElem(src,x,y,1) : 0;
      IElem(dst,x,y,2)=bb ? IElem(src,x,y,2) : 0;
    }
}