Compare commits
3 Commits
0d9c3ed470
...
e4d89ee8dc
| Author | SHA1 | Date | |
|---|---|---|---|
| e4d89ee8dc | |||
| bf95af3ef6 | |||
| bed4860776 |
@@ -61,6 +61,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ch09", "ch09", "{2BBACE58-D
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "edge_detection", "ch09\edge_detection\edge_detection.vcxproj", "{F7126457-CC07-433A-B762-C4DFB352653C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "edge", "Homework\edge\edge.vcxproj", "{85DBF128-C338-4C43-B575-87C1B8CD2EFA}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "YCbCrHist", "Homework\YCbCrHist\YCbCrHist.vcxproj", "{2DB82859-6BEC-40B4-A8CA-BFA2C60145B0}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ch11", "ch11", "{94FE4669-77AC-4D41-8E24-F5DEDEAC930F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thershhold", "ch11\thershhold\thershhold.vcxproj", "{12A25565-0007-412B-9490-9AA28305272D}"
|
||||
@@ -235,6 +239,22 @@ Global
|
||||
{F7126457-CC07-433A-B762-C4DFB352653C}.Release|x64.Build.0 = Release|x64
|
||||
{F7126457-CC07-433A-B762-C4DFB352653C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{F7126457-CC07-433A-B762-C4DFB352653C}.Release|x86.Build.0 = Release|Win32
|
||||
{85DBF128-C338-4C43-B575-87C1B8CD2EFA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{85DBF128-C338-4C43-B575-87C1B8CD2EFA}.Debug|x64.Build.0 = Debug|x64
|
||||
{85DBF128-C338-4C43-B575-87C1B8CD2EFA}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{85DBF128-C338-4C43-B575-87C1B8CD2EFA}.Debug|x86.Build.0 = Debug|Win32
|
||||
{85DBF128-C338-4C43-B575-87C1B8CD2EFA}.Release|x64.ActiveCfg = Release|x64
|
||||
{85DBF128-C338-4C43-B575-87C1B8CD2EFA}.Release|x64.Build.0 = Release|x64
|
||||
{85DBF128-C338-4C43-B575-87C1B8CD2EFA}.Release|x86.ActiveCfg = Release|Win32
|
||||
{85DBF128-C338-4C43-B575-87C1B8CD2EFA}.Release|x86.Build.0 = Release|Win32
|
||||
{2DB82859-6BEC-40B4-A8CA-BFA2C60145B0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2DB82859-6BEC-40B4-A8CA-BFA2C60145B0}.Debug|x64.Build.0 = Debug|x64
|
||||
{2DB82859-6BEC-40B4-A8CA-BFA2C60145B0}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{2DB82859-6BEC-40B4-A8CA-BFA2C60145B0}.Debug|x86.Build.0 = Debug|Win32
|
||||
{2DB82859-6BEC-40B4-A8CA-BFA2C60145B0}.Release|x64.ActiveCfg = Release|x64
|
||||
{2DB82859-6BEC-40B4-A8CA-BFA2C60145B0}.Release|x64.Build.0 = Release|x64
|
||||
{2DB82859-6BEC-40B4-A8CA-BFA2C60145B0}.Release|x86.ActiveCfg = Release|Win32
|
||||
{2DB82859-6BEC-40B4-A8CA-BFA2C60145B0}.Release|x86.Build.0 = Release|Win32
|
||||
{12A25565-0007-412B-9490-9AA28305272D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{12A25565-0007-412B-9490-9AA28305272D}.Debug|x64.Build.0 = Debug|x64
|
||||
{12A25565-0007-412B-9490-9AA28305272D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
@@ -299,6 +319,8 @@ Global
|
||||
{E0970C66-807B-4090-83C4-C71227BD2AFF} = {610D1B36-71E3-4C3D-B0CE-2C563B0504A6}
|
||||
{F920D051-F9B5-43C2-ACF7-C5DE9B18B20C} = {E583E257-9FCE-4A4B-A554-8514F982D1BF}
|
||||
{F7126457-CC07-433A-B762-C4DFB352653C} = {2BBACE58-DAC1-4D1E-85FC-3A3E9F789D9B}
|
||||
{85DBF128-C338-4C43-B575-87C1B8CD2EFA} = {E583E257-9FCE-4A4B-A554-8514F982D1BF}
|
||||
{2DB82859-6BEC-40B4-A8CA-BFA2C60145B0} = {E583E257-9FCE-4A4B-A554-8514F982D1BF}
|
||||
{12A25565-0007-412B-9490-9AA28305272D} = {94FE4669-77AC-4D41-8E24-F5DEDEAC930F}
|
||||
{8F873187-A5F8-4D02-ABE9-BF652FE53BC3} = {94FE4669-77AC-4D41-8E24-F5DEDEAC930F}
|
||||
{9BD9A147-29ED-4F6C-8BFD-71F03E56332C} = {94FE4669-77AC-4D41-8E24-F5DEDEAC930F}
|
||||
|
||||
144
Homework/YCbCrHist/YCbCrHist.vcxproj
Normal file
144
Homework/YCbCrHist/YCbCrHist.vcxproj
Normal file
@@ -0,0 +1,144 @@
|
||||
<?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>{2db82859-6bec-40b4-a8ca-bfa2c60145b0}</ProjectGuid>
|
||||
<RootNamespace>YCbCrHist</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" />
|
||||
<Import Project="..\..\OPENCV4110_debug.props" />
|
||||
</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" />
|
||||
<Import Project="..\..\OPENCV4110_release.props" />
|
||||
</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" />
|
||||
<Import Project="..\..\OPENCV4110_debug.props" />
|
||||
</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" />
|
||||
<Import Project="..\..\OPENCV4110_release.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<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>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\..\resources\images\box.png" />
|
||||
<Image Include="..\..\resources\images\circuit.bmp" />
|
||||
<Image Include="..\..\resources\images\lena.jpg" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
33
Homework/YCbCrHist/YCbCrHist.vcxproj.filters
Normal file
33
Homework/YCbCrHist/YCbCrHist.vcxproj.filters
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="소스 파일">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="헤더 파일">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="리소스 파일">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\..\resources\images\lena.jpg">
|
||||
<Filter>리소스 파일</Filter>
|
||||
</Image>
|
||||
<Image Include="..\..\resources\images\box.png">
|
||||
<Filter>리소스 파일</Filter>
|
||||
</Image>
|
||||
<Image Include="..\..\resources\images\circuit.bmp">
|
||||
<Filter>리소스 파일</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
BIN
Homework/YCbCrHist/YCbCrHist.zip
Normal file
BIN
Homework/YCbCrHist/YCbCrHist.zip
Normal file
Binary file not shown.
BIN
Homework/YCbCrHist/fallback.png
(Stored with Git LFS)
Normal file
BIN
Homework/YCbCrHist/fallback.png
(Stored with Git LFS)
Normal file
Binary file not shown.
86
Homework/YCbCrHist/main.cpp
Normal file
86
Homework/YCbCrHist/main.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
#include "opencv2/opencv.hpp"
|
||||
#include <iostream>
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
Mat getCbCrHist(const Mat& src, const int* channels);
|
||||
Mat getHSVHist(const Mat& src, const int* channels);
|
||||
void cvtCartesian2PolarCV_32F(const Mat& src, Mat& dst);
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
Mat src;
|
||||
if (argc > 1)
|
||||
src = imread(argv[1], IMREAD_COLOR);
|
||||
else
|
||||
src = imread("fallback.png", IMREAD_COLOR);
|
||||
if (src.empty()) {
|
||||
cerr << "Image load failed" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Mat ycrcb(src.rows, src.cols, src.type());
|
||||
Mat hsv(src.rows, src.cols, src.type());
|
||||
cvtColor(src, ycrcb, COLOR_BGR2YCrCb);
|
||||
cvtColor(src, hsv, COLOR_BGR2HSV);
|
||||
|
||||
int channels_Cb_Cr[] = { 1, 2 };
|
||||
Mat Cb_CrHist = getCbCrHist(ycrcb, channels_Cb_Cr);
|
||||
int channels_HSV[] = { 1, 0 };
|
||||
Mat HSHist = getHSVHist(hsv, channels_HSV);
|
||||
Mat HSPolar(src.rows, src.cols, src.type());
|
||||
cvtCartesian2PolarCV_32F(HSHist, HSPolar);
|
||||
|
||||
imshow("src", src);
|
||||
Cb_CrHist.convertTo(Cb_CrHist, CV_8U);
|
||||
imshow("Histogram in Cb-Cr cartesian coordinates", Cb_CrHist);
|
||||
HSHist.convertTo(HSHist, CV_8U);
|
||||
// resize(HSHist, HSHist, Size(512, 512));
|
||||
imshow("Histogram in H-S cartesian coordinates", HSHist);
|
||||
HSPolar.convertTo(HSPolar, CV_8U);
|
||||
imshow("Histogram in H-S polar coordinates", HSPolar);
|
||||
|
||||
waitKey();
|
||||
destroyAllWindows();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Mat getCbCrHist(const Mat& src, const int *channels) {
|
||||
Mat hist;
|
||||
int cr_bins = 512, cb_bins = 512;
|
||||
int histSize[] = { cr_bins, cb_bins };
|
||||
float cr_range[] = { 0, 256 };
|
||||
float cb_range[] = { 0, 256 };
|
||||
const float* ranges[] = { cr_range, cb_range };
|
||||
calcHist(&src, 1, channels, noArray(), hist, 2, histSize, ranges);
|
||||
|
||||
return hist;
|
||||
}
|
||||
|
||||
Mat getHSVHist(const Mat& src, const int* channels) {
|
||||
Mat hist;
|
||||
int x_bins = 256, y_bins = 180;
|
||||
int histSize[] = { x_bins, y_bins };
|
||||
float x_range[] = { 0, 256 };
|
||||
float y_range[] = { 0, 180 };
|
||||
const float* ranges[] = { x_range, y_range };
|
||||
calcHist(&src, 1, channels, noArray(), hist, 2, histSize, ranges);
|
||||
|
||||
return hist;
|
||||
}
|
||||
|
||||
void cvtCartesian2PolarCV_32F(const cv::Mat& src, cv::Mat& dst) {
|
||||
int max = std::max(src.rows, src.cols);
|
||||
dst = cv::Mat::zeros(max * 2, max * 2, src.type());
|
||||
|
||||
for (int h = 0; h < src.rows; ++h) {
|
||||
for (int s = 0; s < src.cols; ++s) {
|
||||
float theta = (s / (float)src.cols) * 2.f * CV_PI;
|
||||
|
||||
int x = static_cast<int>(max + h * std::cos(theta));
|
||||
int y = static_cast<int>(max + h * std::sin(theta) * -1); // opencv<63><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD> y<><79><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>
|
||||
|
||||
dst.at<float>(y, x) = src.at<float>(h, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Homework/YCbCrHist/스크린샷 2025-04-27 014722.png
(Stored with Git LFS)
Normal file
BIN
Homework/YCbCrHist/스크린샷 2025-04-27 014722.png
(Stored with Git LFS)
Normal file
Binary file not shown.
139
Homework/edge/edge.vcxproj
Normal file
139
Homework/edge/edge.vcxproj
Normal file
@@ -0,0 +1,139 @@
|
||||
<?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>{85dbf128-c338-4c43-b575-87c1b8cd2efa}</ProjectGuid>
|
||||
<RootNamespace>edge</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" />
|
||||
<Import Project="..\..\OPENCV4110_debug.props" />
|
||||
</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" />
|
||||
<Import Project="..\..\OPENCV4110_release.props" />
|
||||
</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" />
|
||||
<Import Project="..\..\OPENCV4110_debug.props" />
|
||||
</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" />
|
||||
<Import Project="..\..\OPENCV4110_release.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<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>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
Homework/edge/edge.vcxproj.filters
Normal file
22
Homework/edge/edge.vcxproj.filters
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="소스 파일">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="헤더 파일">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="리소스 파일">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
41
Homework/edge/main.cpp
Normal file
41
Homework/edge/main.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include <iostream>
|
||||
#include "opencv2/opencv.hpp"
|
||||
|
||||
int main() {
|
||||
cv::VideoCapture camera(0);
|
||||
if (!camera.isOpened()) {
|
||||
std::cerr << "isOpened()" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
std::uint32_t fps = camera.get(cv::CAP_PROP_FPS);
|
||||
cv::Mat src;
|
||||
|
||||
while (cv::waitKey(1000 / fps) != 27) {
|
||||
camera >> src;
|
||||
if (src.empty()) break;
|
||||
cv::imshow("preview", src);
|
||||
}
|
||||
cv::cvtColor(src, src, cv::COLOR_BGR2GRAY);
|
||||
|
||||
cv::Mat dx, dy, fmag, mag, phase;
|
||||
|
||||
cv::Sobel(src, dx, CV_32FC1, 1, 0);
|
||||
cv::Sobel(src, dy, CV_32FC1, 0, 1);
|
||||
|
||||
cv::magnitude(dx, dy, fmag);
|
||||
fmag.convertTo(mag, CV_8UC1);
|
||||
|
||||
cv::phase(dx, dy, phase, true);
|
||||
cv::normalize(phase, phase, 0, 255, cv::NORM_MINMAX);
|
||||
phase.convertTo(phase, CV_8UC1);
|
||||
|
||||
cv::Mat edge = mag > 150;
|
||||
|
||||
cv::imshow("src", src);
|
||||
cv::imshow("mag", mag);
|
||||
cv::imshow("edge", edge);
|
||||
cv::imshow("phase", phase);
|
||||
|
||||
cv::waitKey();
|
||||
cv::destroyAllWindows();
|
||||
}
|
||||
@@ -99,8 +99,6 @@ int mosaic() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const
|
||||
|
||||
Mat dst(src.rows, src.cols, src.type());
|
||||
|
||||
for (int j = 0; j < src.rows; j++) {
|
||||
|
||||
Reference in New Issue
Block a user