Changeset 193 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Jan 20, 1999, 2:54:14 PM (27 years ago)
Author:
ercodmgr
Message:

aper: centrage pave autour pix + brillant (cmv 20/1/99)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/piacmd.cc

    r189 r193  
    881881//|      : la = "a" niveau de print
    882882//|      : c  = la surface pour la photometrie est un carre (defaut=cercle)
     883//|      : C  = recentrage du pave sur le pixel le + brillant  (defaut=non)
    883884//| tokens[2] = options graphiques
    884885//| Return: 0 si Ok, <0 sinon.
     
    888889int typ_fond=1, rmin=0, rmax, npt_gliss=4, lp=0;
    889890float fondimpos=0., fondbord=0., fondautre;
    890 bool cercle = true;
     891bool cercle=true, centre=false;
    891892string opt="";
    892893string dummy; string dum;
     
    910911    if(dum.length()>2) sscanf(dum.c_str(),",l%d",&lp);
    911912  }
    912   if(strstr(dummy.c_str(),",c")) {
    913     cercle = false;
    914   }
     913  if(strstr(dummy.c_str(),",c")) cercle = false;
     914  if(strstr(dummy.c_str(),",C")) centre = true;
    915915}
    916916
     
    953953if(rmin>=rmax)
    954954  {cout<<"rayon mini="<<rmin<<">= rmax="<<rmax<<endl; return(-11);}
     955if(centre) {  // Recentrage autour du pixel le + brillant?
     956  int xcnew=-1, ycnew=-1; float pxnew=-1.e20,pxold=-1.e20,px;
     957  for(int j=yc-rmax;j<=yc+rmax;j++) {
     958    if(j<0 || j>=img->YSize()) continue;
     959    for(int i=xc-rmax;i<=xc+rmax;i++) {
     960      if(i<0 || i>=img->XSize()) continue;
     961      px = (*img)(i,j);
     962      if(i==xc && j==yc) pxold = px;
     963      if((xcnew==-1 && ycnew==-1) || px>=pxnew) {xcnew=i; ycnew=j; pxnew=px;}
     964      // cout<<"xcnew,ycnew,pxnew="<<xcnew<<" "<<ycnew<<" "<<pxnew<<endl;
     965  } }
     966  if(lp>1) cout<<"Re-centrage(x,y,px): old=("<<xc<<","<<yc<<","<<pxold<<")"
     967               <<" -> new=("<<xcnew<<","<<ycnew<<","<<pxnew<<")"<<endl;
     968  if(xcnew!=-1 && ycnew!=-1 && pxnew>pxold) {xc=xcnew; yc=ycnew;}
     969}
    955970int x0=xc-rmax, y0=yc-rmax, x1=xc+rmax, y1=yc+rmax;
    956971if(x0<0||y0<0||x1>=img->XSize()||y1>=img->YSize())
     
    964979if(lp>1)
    965980  cout<<"photom_ouv[cercle="<<cercle<<",typ="<<typ_fond<<"]: pav["
    966       <<dx<<","<<dy<<" ("<<dxym
    967       <<"] xc,yc="<<xc<<","<<yc<<"] ic,jc="<<ic<<","<<jc<<endl
    968       <<"] (fond="<<fondimpos<<") pxmil="<<(*pav)(ic,ic)
     981      <<dx<<","<<dy<<","<<dxym
     982      <<"] xc,yc=["<<xc<<","<<yc<<"] ic,jc="<<ic<<","<<jc<<endl
     983      <<"          (fond="<<fondimpos<<") pxmil="<<(*pav)(ic,ic)
    969984      <<" -> Rph de "<<rmin<<" a "<<rmax<<endl;
    970985
Note: See TracChangeset for help on using the changeset viewer.