123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #pragma once
- #include <opencv2/opencv.hpp>
- #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<int, int> eliminateStartIndexPair;
- std::pair<int, int> 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::pair<double, MyPoint>a, std::pair<double, MyPoint>b);
- bool SortIntersectionByDistanceToStartIncrease(InterecttionsDetails a, InterecttionsDetails b);
- bool SortIntersectionByDistanceToEndIncrease(InterecttionsDetails a, InterecttionsDetails b);
- bool AddPointsPixelByPixel(std::vector<MyPoint>& contours, MyPoint pointToAdd, MyPoint pointPre);
- bool CheckIfContourSelfCrossed(std::vector<MyPoint> contours, int curIndex, int preStartCount,int& indexOfClosePoint);
|