Search code examples
delphiopencvimage-processingpascalimagej

Incompatible types in DELPHI and Opencv


I am trying to find contour into a picture. I implement as follows but i get

Incompatible types: 'ocv.core.types_c.pCvMemStorage' and 'UWaterShedSegment.pCvMemStorage' error.

 type
      pCvMemStorage = ^TCvMemStorage;
      pCvSeq = ^TCvSeq;
    .
    .
    .
    var
      contours :  pCvMemStorage;
      first_contour :   pCvSeq;
    .
    .
    .
    cvFindContours(DistImgEq, contours, first_contour, SizeOf(TCvContour) ,CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE,cvPoint(0,0));

Solution

  • You've redeclared the type pCvMemStorage in your own unit and this is hiding the declared type in the ocv.core.types_c unit that is required by the method signature of cvFindContours.

    Remove the type declaration from your unit and, if it is not already there, add the ocv.core.types_c unit to your uses clause.