Announcement

Collapse
No announcement yet.

calling a C dll

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • calling a C dll

    I want to call from PB opencv (intel image library) routines

    I am not an expert in C
    here is the C dll

    void cvResize( const CvMat* src, CvMat* dst, int interpolation=CV_INTER_LINEAR );
    src
    Source image.
    dst
    Destination image.
    interpolation

    here is the structure of data

    CvMat // 2D array
    |-- int type; // elements type (uchar,short,int,float,double) and flags
    |-- int step; // full row length in bytes
    |-- int rows, cols; // dimensions
    |-- int height, width; // alternative dimensions reference
    |-- union data;
    |-- uchar* ptr; // data pointer for an unsigned char matrix
    |-- short* s; // data pointer for a short matrix
    |-- int* i; // data pointer for an integer matrix
    |-- float* fl; // data pointer for a float matrix
    |-- double* db; // data pointer for a double matrix

    1. how I construct the data type equivalent to CvMat
    2. how I call the arguments in the PB routine

    3. how I pass the argument int interpolation=CV_INTER_LINEAR
    from PB to C dll

    I would like something like

    sub resize_PB(interpolation,matrix_initial() as long,matrix_final() as long)

    thanks in advance
    lucien Kovalson



    ------------------

  • #2
    1. how I construct the DATA type equivalent to CvMat
    Code:
    'CvMat                      // 2D array
    'I can't see 2D array here it just sructure
    UNION Dat '  |-- UNION DATA; // we cant use reserved PB word "DATA"
                 '// So rename it to Dat. below I'll show it as xxx->yyyy
     PTRs AS BYTE PTR  '|-- uchar*  PTR;     // DATA pointer for an unsigned char matrix
                       '            PTR ->PTRs
     s AS INTEGER PTR  '|-- short*  s;       // DATA pointer for a short matrix
     i AS INTEGER PTR  '|-- INT*    i;       // DATA pointer for an integer matrix
     fl AS DOUBLE PTR  '|-- float*  fl;      // DATA pointer for a float matrix
     db AS EXTENDED PTR'|-- DOUBLE* db;      // DATA pointer for a double matrix
    END UNION
    '
    TYPE CvMat
      Typ AS INTEGER   'type -> Typ  |-- int   type;          // elements type (uchar,short,int,float,double) and flags
      Steps AS INTEGER 'step-> Steps |-- int   step;          // full row length in bytes
      rows  AS INTEGER '             |-- int   rows, cols;    // dimensions
      cols  AS INTEGER
      height AS INTEGER'             |-- int   height, width; // alternative dimensions reference
      widt   AS INTEGER'width -> widt
      Dat
    END TYPE
    2. how I CALL the arguments IN the PB routine
    'db' in structure CvMat you can call like CvMat.db

    3. how I pass the argument INT interpolation=CV_INTER_LINEAR
    FROM PB TO C DLL
    %CV_INTER_LINEAR=something 'just put '%' before name and thats it
    %interpolation=%CV_INTER_LINEAR

    I would like something like
    SUB resize_PB(interpolation,matrix_initial() AS LONG,matrix_final() AS LONG)
    Code:
    DECLARE SUB resize_PB LIB "YourDLL" ALIAS "resize_PB" _
        ((A AS something ,B AS LONG,C AS LONG ) EXPORT

    Sy,

    ------------------
    -=Alex=-
    -=Alex=-

    Comment

    Working...
    X