Einzelnen Beitrag anzeigen

alf.stefan

Registriert seit: 11. Apr 2003
88 Beiträge
 
Delphi 7 Professional
 
#1

C/C++ umsetzung nach Delphi

  Alt 4. Nov 2008, 07:57
Hallo zusammen

Ich bin dabei die Funktionalität von openCV in Delphi zu erweitern. Jetzt bin ich auf ein Problem gestoßen. Und zwar cvMat

in der doku zu cxCore steht

Zitat:
CvMat

Multi-channel matrix

typedef struct CvMat
{
int type; /* CvMat signature (CV_MAT_MAGIC_VAL), element type and flags */
int step; /* full row length in bytes */

int* refcount; /* underlying data reference counter */

union
{
uchar* ptr;
short* s;
int* i;
float* fl;
double* db;
} data; /* data pointers */

#ifdef __cplusplus
union
{
int rows;
int height;
};

union
{
int cols;
int width;
};
#else
int rows; /* number of rows */
int cols; /* number of columns */
#endif

} CvMat;
in OpenCv.pas das ich benutze steht

Delphi-Quellcode:
  

 CV_MAT_TYPE_MASK = 31;
 CV_MAT_MAGIC_VAL = $42420000;
 CV_MAT_CONT_FLAG_SHIFT = 9;
 CV_MAT_CONT_FLAG = 1 shl CV_MAT_CONT_FLAG_SHIFT;

 CV_MAT_CN_MASK = 3 shl 3;
 CV_MAT_DEPTH_MASK = 7;


TMatData = record
               ptr: PUCHAR;
             end;

  CvMat = record
            type_ : Integer;
            step : Integer;
            refcount : PInteger;
            data : TMatData;
            rows : Integer;
            cols : Integer;
          end;
  TCvMat = CvMat;
wenn ich jetzt eine matrizze erzeuge in etwa so
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
var

  mat : pcvMat;
  refcount : integer;

begin
    mat := cvCreateMat(3,2, 8);
    refcount := mat.refcount^;
    ShowMessage(intToStr(refcount));
end;
und mir die Matrize anschaue dann ist
mat $392A00
mat^ (1111638024, 4, $392A60, ($1), 3746432, 3)

wobei 1111638024 $42424008 als hex ist und mit CV_MAT_MAGIC_VAL verundet 8 ergibt, was ja auch sinn macht als type_
die 4 als step
$392A60 ist dann ja wohl der der poinnter auf refcount und da steht dann in mat^.refcount^ 1 drin!
bis hierher ist ja noch alles mehr oder weniger begreiflich
aber was ist denn das ($1)?
das soll ein Pointer auf die daten der Matrix sein! Und da kommt dann auch ein Fehler.
3746432 sind auch nicht meine eingetragenen reihen!
komischerweise erscheint der reihen wert dann als col wert als letztes element.

Kann damit jemand was anfangen und mir etwas weiterhelfen??


Gruß stefan
  Mit Zitat antworten Zitat