AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

cv.dll in Delphi benutzen

Ein Thema von meg91 · begonnen am 4. Mai 2007 · letzter Beitrag vom 8. Mai 2007
Antwort Antwort
Seite 3 von 3     123   
Benutzerbild von DGL-luke
DGL-luke

Registriert seit: 1. Apr 2005
Ort: Bad Tölz
4.149 Beiträge
 
Delphi 2006 Professional
 
#21

Re: cv.dll in Delphi benutzen

  Alt 8. Mai 2007, 13:05
Hallo,

ich hab auch einige unwichtige Nebenbeschäftigungen zum Open-Source-programmieren (Schule, Job, Führerschein, Baustelle daheim... alles nix wichtiges, aber muss halt auch gemacht werden ). Ich hab bis jetzt die cvtypes.pas zu 50% übersetzt, sonst noch nix.

Eigentlich ist es auch nicht schwierig, das selbst zu machen: auf "typedef struct xyz {}" wird eben "xyz = record ... end;".

Ich poste hier mal was ich schon hab:

Delphi-Quellcode:
unit cvtypes;

interface

{
#ifndef _CVTYPES_H_
#define _CVTYPES_H_
}


{$IFNDEF _CVTYPES_H_}
  {$DEFINE _CVTYPES_H_}
{$ENDIF}

{
#ifndef SKIP_INCLUDES
  #include <assert.h>
  #include <stdlib.h>
#endif
}

//no translation

type
(*
/* spatial and central moments */
typedef struct CvMoments
{
    double  m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */
    double  mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */
    double  inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */
}
CvMoments;
*)


// spatial and central moments
  CvMoments = record
    m00, m10, m01, m20, m11, m02, m30, m21, m12, m03: Double; ///* spatial moments */
    enmu20, mu11, mu02, mu30, mu21, mu12, mu03: Double; ///* central moments */d;
    inv_sqrt_m00: Double; ///* m00 != 0 ? 1/sqrt(m00) : 0 */
  end;

(*
/* Hu invariants */
typedef struct CvHuMoments
{
    double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /* Hu invariants */
}
CvHuMoments;
*)


// Hu invariants
  CvHuMoment = record
    hu1, hu2, hu3, hu4, hu5, hu6, hu7: Double; ///* Hu invariants */
  end;

//**************************** Connected Component **************************//

(*typedef struct CvConnectedComp
{
    double area;    /* area of the connected component  */
    CvScalar value; /* average color of the connected component */
    CvRect rect;    /* ROI of the component  */
    CvSeq* contour; /* optional component boundary
                      (the contour might have child contours corresponding to the holes)*/
}
CvConnectedComp;
*)

  CvConnectedComp = record
    Area: Double;
    value: CvScalar;
    rect: CvRect;
    contour: ^CvSeq;
  end;
(*

/*
Internal structure that is used for sequental retrieving contours from the image.
It supports both hierarchical and plane variants of Suzuki algorithm.
*/
typedef struct _CvContourScanner* CvContourScanner;
*)

  CvContourScanner = ^_CvCountourScanner;
(*

/* contour retrieval mode */
#define CV_RETR_EXTERNAL 0
#define CV_RETR_LIST    1
#define CV_RETR_CCOMP    2
#define CV_RETR_TREE    3
*)


const
  CV_RETR_EXTERNAL = 0;
  CV_RETR_LIST = 1;
  CV_RETR_CCOMP = 2;
  CV_RETR_TREE = 3;
(*
/* contour approximation method */
#define CV_CHAIN_CODE              0
#define CV_CHAIN_APPROX_NONE        1
#define CV_CHAIN_APPROX_SIMPLE      2
#define CV_CHAIN_APPROX_TC89_L1    3
#define CV_CHAIN_APPROX_TC89_KCOS  4
#define CV_LINK_RUNS                5
*)

  CV_CHAIN_CODE = 0;
  CV_CHAIN_APPROX_NONE = 1;
  CV_CHAIN_APPROX_SIMPLE = 2;
  CV_CHAIN_APPROX_TC89_L1 = 3;
  CV_CHAIN_APPROX_TC89_KCOS = 4;
  CV_LINK_RUNS = 5;
(*

/* Freeman chain reader state */
typedef struct CvChainPtReader
{
    CV_SEQ_READER_FIELDS()
    char      code;
    CvPoint  pt;
    char      deltas[8][2];
}
CvChainPtReader;
*)

type
  CvChainPtReader = record
    //CV_SEQ_READER_FIELDS() //Makro/#define - muss ersetzt werden
    Code: Char;
    pt: CvPoint;
    deltas: array[0..7,0..1] of Char;
  end;
(*

/* initializes 8-element array for fast access to 3x3 neighborhood of a pixel */
#define  CV_INIT_3X3_DELTAS( deltas, step, nch )            \
    ((deltas)[0] =  (nch),  (deltas)[1] = -(step) + (nch),  \
    (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch),  \
    (deltas)[4] = -(nch),  (deltas)[5] =  (step) - (nch),  \
    (deltas)[6] =  (step), (deltas)[7] =  (step) + (nch))
*)


//moved to implementation

(*

/* Contour tree header */
typedef struct CvContourTree
{
    CV_SEQUENCE_FIELDS()
    CvPoint p1;            /* the first point of the binary tree root segment */
    CvPoint p2;            /* the last point of the binary tree root segment */
}
CvContourTree;

*)

  CvContourTree = record
    //CV_SEQUENCE_FIELDS() //macro! has to be included
    p1: CvPoint; ///* the first point of the binary tree root segment */
    p2: CvPoint; ///* the last point of the binary tree root segment */
  end;

(*

/* Finds a sequence of convexity defects of given contour */
typedef struct CvConvexityDefect
{
    CvPoint* start; /* point of the contour where the defect begins */
    CvPoint* end; /* point of the contour where the defect ends */
    CvPoint* depth_point; /* the farthest from the convex hull point within the defect */
    float depth; /* distance between the farthest point and the convex hull */
}
CvConvexityDefect;

*)

  CvConvexityDefect = record
    start: ^CvPoint;
    _end: ^CvPoint;
    depth_point: CvPoint;
    depth: float;
  end;
(*

/************ Data structures and related enumerations for Planar Subdivisions ************/

typedef size_t CvSubdiv2DEdge;
*)

  CvSubdiv2DEdge = size_t;
(*

#define CV_QUADEDGE2D_FIELDS()    \
    int flags;                    \
    struct CvSubdiv2DPoint* pt[4]; \
    CvSubdiv2DEdge  next[4];

#define CV_SUBDIV2D_POINT_FIELDS()\
    int            flags;      \
    CvSubdiv2DEdge first;      \
    CvPoint2D32f  pt;

*)

//will need to directly include these
(*

#define CV_SUBDIV2D_VIRTUAL_POINT_FLAG (1 << 30)
*)

const
  CV_SUBDIV2D_VIRTUAL_POINT_FLAG = (1 shl 30);
(*

typedef struct CvQuadEdge2D
{
    CV_QUADEDGE2D_FIELDS()
}
CvQuadEdge2D;

*)


type
  CvQuadEdge2D = record
    //CV_QUADEDGE2D_FIELDS:
    flags: Integer;
    pt: array[0..3] of ^CvSubdiv2DPoint;
    next: array[0..3] of CvSubdiv2DEdge;
  end;

type
  CV_INIT_DELTAS = array[0..7] of Integer;

procedure CV_INIT_3X3_DELTAS(var CV_INIT_DELTAS; step, nch: Integer);

implementation
(*
/* initializes 8-element array for fast access to 3x3 neighborhood of a pixel */
#define  CV_INIT_3X3_DELTAS( deltas, step, nch )            \
    ((deltas)[0] =  (nch),  (deltas)[1] = -(step) + (nch),  \
    (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch),  \
    (deltas)[4] = -(nch),  (deltas)[5] =  (step) - (nch),  \
    (deltas)[6] =  (step), (deltas)[7] =  (step) + (nch))
*)


procedure CV_INIT_3X3_DELTAS(var CV_INIT_DELTAS; step, nch: Integer);
begin
  deltas[0] := nch;
  deltas[1] := -step+nch;
  deltas[2] := -step;
  deltas[3] := -step-nch;
  deltas[4] := -nch;
  deltas[5] := step-nch;
  deltas[6] := step;
  deltas[7] := step+nch;
end;

end.
PS: Hoffe, das faltet sich ordentlich zusammen.
Lukas Erlacher
Suche Grafiktablett. Spenden/Gebrauchtangebote willkommen.
Gotteskrieger gesucht!
For it is the chief characteristic of the religion of science that it works. - Isaac Asimov, Foundation I, Buch 1
  Mit Zitat antworten Zitat
Benutzerbild von meg91
meg91

Registriert seit: 25. Apr 2006
131 Beiträge
 
Turbo Delphi für Win32
 
#22

Re: cv.dll in Delphi benutzen

  Alt 8. Mai 2007, 13:25
das sollte jetzt nich ungeduldig wirken, ich wollte einfach nur den Stand der Dinge wissen.
ich bin euch ja sehr dankbar, dass ihr euch die Arbeit für mich macht
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 3 von 3     123   


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:49 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz