-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
3,688 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.8.34322.80 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slpx", "slpx.vcxproj", "{E7CAEA1F-E022-4750-9A92-35A864BE3A47}" | ||
EndProject | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slpxTest", "..\slpxTest\slpxTest.vcxproj", "{09698AF7-4C36-41EF-ACD1-968B4EA1B230}" | ||
EndProject | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "solver", "..\solver\solver.vcxproj", "{BE122505-7DD2-418A-9760-BDFEA39DA9DC}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E7CAEA1F-E022-4750-9A92-35A864BE3A47}.Debug|x64.ActiveCfg = Debug|x64 | ||
{E7CAEA1F-E022-4750-9A92-35A864BE3A47}.Debug|x64.Build.0 = Debug|x64 | ||
{E7CAEA1F-E022-4750-9A92-35A864BE3A47}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{E7CAEA1F-E022-4750-9A92-35A864BE3A47}.Debug|x86.Build.0 = Debug|Win32 | ||
{E7CAEA1F-E022-4750-9A92-35A864BE3A47}.Release|x64.ActiveCfg = Release|x64 | ||
{E7CAEA1F-E022-4750-9A92-35A864BE3A47}.Release|x64.Build.0 = Release|x64 | ||
{E7CAEA1F-E022-4750-9A92-35A864BE3A47}.Release|x86.ActiveCfg = Release|Win32 | ||
{E7CAEA1F-E022-4750-9A92-35A864BE3A47}.Release|x86.Build.0 = Release|Win32 | ||
{09698AF7-4C36-41EF-ACD1-968B4EA1B230}.Debug|x64.ActiveCfg = Debug|x64 | ||
{09698AF7-4C36-41EF-ACD1-968B4EA1B230}.Debug|x64.Build.0 = Debug|x64 | ||
{09698AF7-4C36-41EF-ACD1-968B4EA1B230}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{09698AF7-4C36-41EF-ACD1-968B4EA1B230}.Debug|x86.Build.0 = Debug|Win32 | ||
{09698AF7-4C36-41EF-ACD1-968B4EA1B230}.Release|x64.ActiveCfg = Release|x64 | ||
{09698AF7-4C36-41EF-ACD1-968B4EA1B230}.Release|x64.Build.0 = Release|x64 | ||
{09698AF7-4C36-41EF-ACD1-968B4EA1B230}.Release|x86.ActiveCfg = Release|Win32 | ||
{09698AF7-4C36-41EF-ACD1-968B4EA1B230}.Release|x86.Build.0 = Release|Win32 | ||
{BE122505-7DD2-418A-9760-BDFEA39DA9DC}.Debug|x64.ActiveCfg = Debug|x64 | ||
{BE122505-7DD2-418A-9760-BDFEA39DA9DC}.Debug|x64.Build.0 = Debug|x64 | ||
{BE122505-7DD2-418A-9760-BDFEA39DA9DC}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{BE122505-7DD2-418A-9760-BDFEA39DA9DC}.Debug|x86.Build.0 = Debug|Win32 | ||
{BE122505-7DD2-418A-9760-BDFEA39DA9DC}.Release|x64.ActiveCfg = Release|x64 | ||
{BE122505-7DD2-418A-9760-BDFEA39DA9DC}.Release|x64.Build.0 = Release|x64 | ||
{BE122505-7DD2-418A-9760-BDFEA39DA9DC}.Release|x86.ActiveCfg = Release|Win32 | ||
{BE122505-7DD2-418A-9760-BDFEA39DA9DC}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {9F9AF750-97E5-4738-8CC3-6D740B248016} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|Win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<VCProjectVersion>17.0</VCProjectVersion> | ||
<Keyword>Win32Proj</Keyword> | ||
<ProjectGuid>{e7caea1f-e022-4750-9a92-35a864be3a47}</ProjectGuid> | ||
<RootNamespace>slpx</RootNamespace> | ||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v143</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v143</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v143</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v143</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Label="Shared"> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<IncludePath>D:\OpenCV\opencv\build\include;$(IncludePath)</IncludePath> | ||
<LibraryPath>D:\OpenCV\opencv\build\x64\vc16\lib;$(LibraryPath)</LibraryPath> | ||
<OutDir>..</OutDir> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<IncludePath>D:\OpenCV\opencv\build\include;$(IncludePath)</IncludePath> | ||
<LibraryPath>D:\OpenCV\opencv\build\x64\vc16\lib;$(LibraryPath)</LibraryPath> | ||
<OutDir>..</OutDir> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<SDLCheck>true</SDLCheck> | ||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<ConformanceMode>true</ConformanceMode> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<ConformanceMode>true</ConformanceMode> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<SDLCheck>true</SDLCheck> | ||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<ConformanceMode>true</ConformanceMode> | ||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<AdditionalDependencies>opencv_world490d.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<ConformanceMode>true</ConformanceMode> | ||
<AdditionalIncludeDirectories>D:\OpenCV\opencv\build\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
<DebugInformationFormat>None</DebugInformationFormat> | ||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<AdditionalDependencies>opencv_world490.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="slpx.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="slpxHeader.h" /> | ||
<ClInclude Include="ImageData.h" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#ifndef HERDER_H | ||
#define HEADER_H | ||
|
||
#include <opencv2/opencv.hpp> | ||
#include <vector> | ||
#include <string> | ||
#include <chrono> | ||
#include <conio.h> | ||
#include <direct.h> | ||
#include <io.h> | ||
#include <opencv2/imgproc/imgproc.hpp> | ||
#include <opencv2/core/core.hpp> | ||
#include <opencv2/highgui/highgui.hpp> | ||
#include <windows.h> | ||
#include <sys/stat.h> | ||
#include <fstream> | ||
#include <iomanip> | ||
#include <ctime> | ||
#include <sstream> | ||
#include <random> | ||
#include <cstdlib> | ||
|
||
#include <windows.h> | ||
#include <iostream> | ||
#include <string> | ||
#include <locale> | ||
#include <codecvt> // For wstring_convert | ||
|
||
#include "ImageData.h" | ||
|
||
using namespace cv; | ||
using namespace std; | ||
using namespace chrono; | ||
|
||
struct Vec3bComparator { | ||
bool operator() (const Vec3b& lhs, const Vec3b& rhs) const { | ||
if (lhs[0] != rhs[0]) return lhs[0] < rhs[0]; | ||
if (lhs[1] != rhs[1]) return lhs[1] < rhs[1]; | ||
return lhs[2] < rhs[2]; | ||
} | ||
}; | ||
struct PointPairComparator { | ||
bool operator()(const pair<Point2f, Point2f>& a, const pair<Point2f, Point2f>& b) const { | ||
if (a.first.x != b.first.x) return a.first.x < b.first.x; | ||
if (a.first.y != b.first.y) return a.first.y < b.first.y; | ||
if (a.second.x != b.second.x) return a.second.x < b.second.x; | ||
return a.second.y < b.second.y; | ||
} | ||
}; | ||
struct PathBezierPoints { | ||
Point2f PS; | ||
Point2f PC; | ||
Point2f PE; | ||
PathBezierPoints(Point2f S, Point2f R, Point2f E) : PS(S), PC(R), PE(E){} | ||
}; | ||
|
||
int main(int argc, char* argv[]); | ||
|
||
void COLORMODE(int mode, Mat& src); | ||
void getDistinctColors(const Mat& image); | ||
void replaceColorsWithBlack(Mat& image, const set<Vec3b, Vec3bComparator>& colorsToReplace); | ||
int pxlCount(const Mat& image, const set<Vec3b, Vec3bComparator>& distinctColors, int sx, int sy, int fx, int fy); | ||
int pxlCount(const Mat& image, Scalar s, int sx, int sy, int fx, int fy); | ||
bool directoryExists(const std::string& dirName); | ||
int saveImagesToFolder(string folderName); | ||
void SetConsoleColor(int color); | ||
string getCurrentDateTime(); | ||
bool fileExists(const std::string& filename); | ||
void linearRegression(const std::vector<Point2f>& points, double& m, double& c); | ||
string getPositionStr(int p); | ||
|
||
vector<Point2f> findRotatedPart(const Mat& objectPart, const Mat& image, Mat& imageToDraw); | ||
double getMinDist(Point2f& p, int captchaNum, double progress); | ||
void sortValues(std::tuple<int, double> arr[], int size); | ||
void drawQuadraticBezier(Mat& image, Point2f start, Point2f control, Point2f end, Scalar color, int thickness); | ||
Point2f quadraticBezierDerivative(Point2f start, Point2f control, Point2f end, float t); | ||
void drawQuadraticBezierWithArrow(Mat& image, Point2f start, Point2f control, Point2f end, Scalar color, int thickness); | ||
|
||
|
||
Point2f getQuadraticBezierPoint(const Point2f& ps, const Point2f& pc, const Point2f pe, double t); | ||
void clusterPoints(std::vector<cv::Point2f>& points, double threshold); | ||
void TemplateMatching(const Mat& img, const Mat& templ, double threshold); | ||
std::vector<std::tuple<cv::Mat, cv::Point>> getSubImages(const cv::Mat& image, int subImageWidth, int subImageHeight, int step); | ||
double distance(cv::Point2f p1, cv::Point2f p2); | ||
bool isApproxRectangle(cv::Point2f A, cv::Point2f B, cv::Point2f C, cv::Point2f D, double expectedWidth, double expectedHeight, double tolerance); | ||
cv::Scalar interpolateScalar(const cv::Scalar& start, const cv::Scalar& end, double t); | ||
void removeDuplicatePoints(vector<Point2f>& obj, vector<Point2f>& scene); | ||
|
||
|
||
//void logP(const std::string& message, int value); | ||
void drawLineThroughPoint(cv::Mat& image, cv::Point point, double angle); | ||
|
||
cv::Mat calculateHomography(const std::vector<cv::Point2f>& srcPoints, const std::vector<cv::Point2f>& dstPoints); | ||
cv::Mat customFindHomography(const std::vector<cv::Point2f>& srcPoints, const std::vector<cv::Point2f>& dstPoints, int maxIterations = 2000, double reprojectionThreshold = 3.0); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
#include <iostream> | ||
#include <bitset> | ||
#include "Header.h" | ||
|
||
void SetConsoleColor(int color) { | ||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); | ||
SetConsoleTextAttribute(hConsole, color); | ||
} | ||
std::string intToBinaryString(int number) { | ||
std::string binary = std::bitset<32>(number).to_string(); | ||
return binary; | ||
} | ||
|
||
std::string insertSpacesAtIndexes(const std::string& binaryStr, const std::vector<int>& indexes) { | ||
std::string spacedBinary = binaryStr; | ||
int offset = 0; | ||
|
||
for (int index : indexes) { | ||
if (index + offset <= spacedBinary.size()) { | ||
spacedBinary.insert(index + offset, " "); | ||
offset++; | ||
} | ||
} | ||
|
||
return spacedBinary; | ||
} | ||
|
||
void printResult(int res) { | ||
|
||
std::bitset<32> binary(res); | ||
|
||
std::string binaryStr = intToBinaryString(res); | ||
|
||
std::vector<int> spaceIndexes = { 2, 14, 24, 29 }; | ||
|
||
cout << res << endl; | ||
std::string spacedBinary = insertSpacesAtIndexes(binaryStr, spaceIndexes); | ||
std::cout << spacedBinary << std::endl; | ||
|
||
cout << "Answer: " << (res & 0b111) + 1 << endl; | ||
cout << "Resemblance: " << (((res >> 8) & 0b1111111111)) << "" << endl; | ||
cout << "Duration: " << (((res >> 17) & 0b111111111111)) << "ms." << endl; | ||
|
||
} | ||
int main(){ | ||
|
||
|
||
int arr[] = { 1, 0, 0, 123123 }; | ||
int size = sizeof(arr) / sizeof(int); | ||
|
||
int res = execute(arr, size); | ||
|
||
//int res = execute(arr, size); | ||
|
||
//for (int i = 0; i < 100; i++) { | ||
//SetConsoleColor(i); | ||
//cout << i << " TESTTESTTESTTESTTEST" << endl; | ||
//} | ||
//SetConsoleColor(7); | ||
|
||
printResult(res); | ||
getchar(); | ||
return 0; | ||
|
||
} |
Oops, something went wrong.