diff --git a/FastROI/ConsoleExample/ConsoleExample1.cpp b/FastROI/ConsoleExample/ConsoleExample1.cpp index 925c409..dfdc23a 100644 --- a/FastROI/ConsoleExample/ConsoleExample1.cpp +++ b/FastROI/ConsoleExample/ConsoleExample1.cpp @@ -3,6 +3,8 @@ #include #include +#include +#include #include "fastRect.h" @@ -13,12 +15,18 @@ int main() double angle = 0; cv::Mat result(cv::Size(4000, 4000), CV_8UC3); + std::chrono::high_resolution_clock::time_point _start; + + _start = std::chrono::high_resolution_clock::now(); + int count = 0; while (true) { - result = cv::Scalar(0, 0, 0); - std::vector> vertical_lines = fast::rectROI(2000, 2000, angle, 1000, 1000, false, 40); + + + std::vector> vertical_lines = fast::rectROI(2000, 2000, angle, 1000, 1000, false, 50); + for (auto vertical_line : vertical_lines) { for (auto calPoint : vertical_line) { if (calPoint.x < 0 || calPoint.x >= 4000 || calPoint.y < 0 || calPoint.y >= 4000) @@ -28,6 +36,7 @@ int main() } } + cv::imshow("result", result); if (cv::waitKey(1) == 27)break; if (angle++ > 360) angle = 0; diff --git a/FastROI/lib/Debug/calPoint.h b/FastROI/lib/Debug/calPoint.h new file mode 100644 index 0000000..22d4683 --- /dev/null +++ b/FastROI/lib/Debug/calPoint.h @@ -0,0 +1,21 @@ +#pragma once + +#ifndef HV_CAL_POINT +#define HV_CAL_POINT + +#include + +#pragma pack(push, 1) + +namespace fast { + struct calPoint { + double x; + double y; + }; +} + +static_assert(std::is_standard_layout_v); +#pragma pack(pop) + + +#endif \ No newline at end of file diff --git a/FastROI/lib/Debug/fastROI.dll b/FastROI/lib/Debug/fastROI.dll new file mode 100644 index 0000000..997521d Binary files /dev/null and b/FastROI/lib/Debug/fastROI.dll differ diff --git a/FastROI/lib/Debug/fastROI.lib b/FastROI/lib/Debug/fastROI.lib new file mode 100644 index 0000000..f36a0c0 Binary files /dev/null and b/FastROI/lib/Debug/fastROI.lib differ diff --git a/FastROI/lib/Debug/fastRect.h b/FastROI/lib/Debug/fastRect.h new file mode 100644 index 0000000..99f13d0 --- /dev/null +++ b/FastROI/lib/Debug/fastRect.h @@ -0,0 +1,19 @@ +#pragma once + +#ifndef FAST_RECT +#define FAST_RECT + +#include +#include + +#include "macro.h" +#include "calPoint.h" + +namespace fast { + FAST_API_EXPORT std::vector> rectROI(int centerx, int centery, double angle, int range, int distance, bool direction, int skip_pixels); +} + + + + +#endif \ No newline at end of file diff --git a/FastROI/lib/Debug/macro.h b/FastROI/lib/Debug/macro.h new file mode 100644 index 0000000..4f139c8 --- /dev/null +++ b/FastROI/lib/Debug/macro.h @@ -0,0 +1,20 @@ +#pragma once + + +#include + +#ifndef FAST_MACRO +#define FAST_MACRO + + +#if FAST_API +#define FAST_API_EXPORT __declspec(dllexport) +#else +#define FAST_API_EXPORT __declspec(dllimport) +#endif + + +#define HVERROR(name, message) \ +std::string name;name += "error:";name += __func__;name += ":";name += std::to_string(__LINE__);name += ":";name += message;throw std::runtime_error(name);\ + +#endif \ No newline at end of file diff --git a/FastROI/lib/Release/calPoint.h b/FastROI/lib/Release/calPoint.h new file mode 100644 index 0000000..22d4683 --- /dev/null +++ b/FastROI/lib/Release/calPoint.h @@ -0,0 +1,21 @@ +#pragma once + +#ifndef HV_CAL_POINT +#define HV_CAL_POINT + +#include + +#pragma pack(push, 1) + +namespace fast { + struct calPoint { + double x; + double y; + }; +} + +static_assert(std::is_standard_layout_v); +#pragma pack(pop) + + +#endif \ No newline at end of file diff --git a/FastROI/lib/Release/fastROI.dll b/FastROI/lib/Release/fastROI.dll new file mode 100644 index 0000000..85d5428 Binary files /dev/null and b/FastROI/lib/Release/fastROI.dll differ diff --git a/FastROI/lib/Release/fastROI.lib b/FastROI/lib/Release/fastROI.lib new file mode 100644 index 0000000..f36a0c0 Binary files /dev/null and b/FastROI/lib/Release/fastROI.lib differ diff --git a/FastROI/lib/Release/fastRect.h b/FastROI/lib/Release/fastRect.h new file mode 100644 index 0000000..99f13d0 --- /dev/null +++ b/FastROI/lib/Release/fastRect.h @@ -0,0 +1,19 @@ +#pragma once + +#ifndef FAST_RECT +#define FAST_RECT + +#include +#include + +#include "macro.h" +#include "calPoint.h" + +namespace fast { + FAST_API_EXPORT std::vector> rectROI(int centerx, int centery, double angle, int range, int distance, bool direction, int skip_pixels); +} + + + + +#endif \ No newline at end of file diff --git a/FastROI/lib/Release/macro.h b/FastROI/lib/Release/macro.h new file mode 100644 index 0000000..4f139c8 --- /dev/null +++ b/FastROI/lib/Release/macro.h @@ -0,0 +1,20 @@ +#pragma once + + +#include + +#ifndef FAST_MACRO +#define FAST_MACRO + + +#if FAST_API +#define FAST_API_EXPORT __declspec(dllexport) +#else +#define FAST_API_EXPORT __declspec(dllimport) +#endif + + +#define HVERROR(name, message) \ +std::string name;name += "error:";name += __func__;name += ":";name += std::to_string(__LINE__);name += ":";name += message;throw std::runtime_error(name);\ + +#endif \ No newline at end of file