#pragma once #include #ifdef _WIN32 #define EXPORT_API __declspec(dllexport) #else #define EXPORT_API #endif using namespace cv; #define PI (3.14159265358979323846) #define PI_DIV_180 (0.017453292519943296)//¦Ð/180 #define DegToRad(x) ((x)*PI_DIV_180)//½Ç¶Èת»»Îª»¡¶È typedef struct MyPoint { int x; int y; }MyPoint; typedef struct LesionSize { MyPoint hl; MyPoint hr; MyPoint vu; MyPoint vd; }LesionSize; typedef struct MyRect { int left; int right; int top; int bottom; }MyRect; typedef struct SelfCrossRegionDetails { std::pair eliminateStartIndexPair; std::pair eliminateEndIndexPair; }SelfCrossRegionDetails; typedef struct InterecttionsDetails { int indexInContour; double distanceToLineStart; double distanceToLineEnd; }InterecttionsDetails; typedef struct InterecttionsResults { bool intersectWithLineStart; bool intersectWithLineEnd; int indexInContourIntersectionStart; int indexInContourIntersectionEnd; }InterecttionsResults; extern "C" EXPORT_API bool GetRotationTransMat(const MyPoint pointFix, const MyPoint pointMoveBef, const MyPoint pointMoveAft,double * rotMatDatas); extern "C" EXPORT_API bool RotateAndScalePoints(double* rotMatDatas, const int pointNum, MyPoint * pointsBef, MyPoint * pointsAft); extern "C" EXPORT_API bool RotatePoints(const MyPoint pointCenter, double angle, const int pointNum, MyPoint * pointsBef, MyPoint * pointsAft); extern "C" EXPORT_API bool AngleBetweenTwoLine(const MyPoint pointOrigin, const MyPoint pointAnyDir,const MyPoint pointXDir,double& angle); extern "C" EXPORT_API bool ContourArea(const MyPoint * points,const int pointNum, int& area); extern "C" EXPORT_API bool GetContourPointByPoint(const MyPoint * pointsBef, const int pointNum, MyPoint * pointsAft, int& pointNumAft); extern "C" EXPORT_API bool GetContourWithLineAA(const MyPoint * pointsBef, const int pointNum, MyPoint * pointsAft, int& pointNumAft); extern "C" EXPORT_API bool GetContourPointByPointEliminateSelfCross(const MyPoint * pointsBef, const int pointNumBef, MyPoint * pointsAft, int& pointNumAft); extern "C" EXPORT_API bool LineContourIntersection(const MyPoint * points, const int pointNum, const MyPoint lineStart, const MyPoint lineEnd, const int touchDistance, bool extended, InterecttionsResults& results); MyRect ContourBoundBox(const MyPoint* points, const int pointNum); double DistanceBetweenTwoPoints(const MyPoint pointOne, const MyPoint pointOther); double DistanceBetweenTwoRect(const MyRect rectOne, const MyRect rectOther); bool SortPointByDistanceIncrease(std::paira, std::pairb); bool SortIntersectionByDistanceToStartIncrease(InterecttionsDetails a, InterecttionsDetails b); bool SortIntersectionByDistanceToEndIncrease(InterecttionsDetails a, InterecttionsDetails b); bool AddPointsPixelByPixel(std::vector& contours, MyPoint pointToAdd, MyPoint pointPre); bool CheckIfContourSelfCrossed(std::vector contours, int curIndex, int preStartCount,int& indexOfClosePoint);