--- In [email protected], "sidra111222" <sidra111...@...> wrote:
>
> hello evrybody I need a help 
> I must do a model C witch calcult a vector motion to 2 blokcs in 2 frame 
> védion succes for exemple n and n+1 i don't know how can I start
>
good morning I need help I do a code witch I mus calcluate a vector motion 
between to blocks of picture and return coordone of it I do it like a matrix 
but I havent' a good result so can anu bady help me this is my code:
/***************************************************************************************************///
// (u,v) est la position du MB ds la fenêtre de recherche                       
                    //
// (i,j) est la position des pixels ds le MB recherché                          
                   //
//  M, N : dimensions de la fenêtre de recherche. Ici M=N= 2p+1 où p est le 
déplacement maximum.  //
//  MB_L,MB_H dimensions d'un MB.                                               
                 //
//  P pas de déplacement                                                        
                //
//*********************************************************************************************//

void SAD(int **Y_CUR,int **Y_PREV,int M,int N, int MB_L,int MB_H,int p)
{
        int i,j,u,v;
        int k = p*MB_H;
        int mvx,mvy;
        int sad;
    int sadmin = MAXINT;        /*on initialise le SAD par une valeur grande*/
    mvx=0;
    mvy=0;
//M= (2*p+MB_H);N=(2*p+MB_L
            for (u=0; u<=M; u++)
            {
                for (v=0; v<=N; v++) 
                {
                    sad = 0;;;
                  for (i=0; i<MB_L; i++) 
                  {
                   for (j=0; j<MB_H; j++) 
                  
                       sad = sad + ABS(Y_CUR[i][j]- Y_PREV[i+u][j+v]);
                     
                  
                  }
                      if (sad < sadmin) 
                         {
                             sadmin = sad; 
                             mvx = u; 
                             mvy = v;
                          
                          }
                        
                printf("\n (MVX,MVY) =(%d,%d)\n",mvx,mvy);
                  } 
          
           }
           
           
 }

Reply via email to