Skip to content

Commit

Permalink
added a solution file
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugichoko445 committed Apr 22, 2021
1 parent 108db66 commit 0a3b757
Show file tree
Hide file tree
Showing 13 changed files with 708 additions and 526 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
A C++ implementation of PixMix inpainting.

[Jan Herling and Wolfgang Broll, "High-Quality Real-Time Video Inpaintingwith PixMix," Vol. 20, Issue 6, pp. 866 - 879, 2014.](http://ieeexplore.ieee.org/document/6714519/)
[Jan Herling and Wolfgang Broll, "High-Quality Real-Time Video Inpaintingwith PixMix," IEEE TVCG, Vol. 20, Issue 6, pp. 866 - 879, 2014.](http://ieeexplore.ieee.org/document/6714519/)

# Features
* Inpainting only
Expand All @@ -17,11 +17,8 @@ A C++ implementation of PixMix inpainting.

# Usage
* Inputs
* MAGENTA_MASK_MODE
* 3ch color image with magenta color mask
* The other
* 3ch color image
* 1ch black and white mask image
* 3ch color image
* 1ch black and white mask image
* Output
* 3ch inpainted image

Expand All @@ -44,5 +41,6 @@ A C++ implementation of PixMix inpainting.


# Tested Environment List
* Win 10 64bit + VS2019 + OpenCV 4.5.1
* Win 10 64bit + VS2015 + OpenCV 3.3.1
* maxOS 10.13.3 + OpenCV3.3.1
31 changes: 31 additions & 0 deletions build/PixMix-Inpainting.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31025.194
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PixMix-Inpainting", "PixMix-Inpainting\PixMix-Inpainting.vcxproj", "{67A83119-5A53-4D79-8094-50825D03CF54}"
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
{67A83119-5A53-4D79-8094-50825D03CF54}.Debug|x64.ActiveCfg = Debug|x64
{67A83119-5A53-4D79-8094-50825D03CF54}.Debug|x64.Build.0 = Debug|x64
{67A83119-5A53-4D79-8094-50825D03CF54}.Debug|x86.ActiveCfg = Debug|Win32
{67A83119-5A53-4D79-8094-50825D03CF54}.Debug|x86.Build.0 = Debug|Win32
{67A83119-5A53-4D79-8094-50825D03CF54}.Release|x64.ActiveCfg = Release|x64
{67A83119-5A53-4D79-8094-50825D03CF54}.Release|x64.Build.0 = Release|x64
{67A83119-5A53-4D79-8094-50825D03CF54}.Release|x86.ActiveCfg = Release|Win32
{67A83119-5A53-4D79-8094-50825D03CF54}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {41F2EA14-3AA9-4823-99FE-47212356DD66}
EndGlobalSection
EndGlobal
159 changes: 159 additions & 0 deletions build/PixMix-Inpainting/PixMix-Inpainting.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?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>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{67a83119-5a53-4d79-8094-50825d03cf54}</ProjectGuid>
<RootNamespace>PixMixInpainting</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>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</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|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\..\bin\x64_$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\..\bin\x64_$(Configuration)\</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>
<OpenMPSupport>true</OpenMPSupport>
</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>
<OpenMPSupport>true</OpenMPSupport>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\sources\Main.cpp" />
<ClCompile Include="..\..\sources\PixMix\OneLvPixMix.cpp" />
<ClCompile Include="..\..\sources\PixMix\PixMix.cpp" />
<ClCompile Include="..\..\sources\PixMix\Utilities.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\sources\PixMix\OneLvPixMix.h" />
<ClInclude Include="..\..\sources\PixMix\PixMix.h" />
<ClInclude Include="..\..\sources\PixMix\Utilities.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
37 changes: 37 additions & 0 deletions build/PixMix-Inpainting/PixMix-Inpainting.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<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="Source Files\PixMix">
<UniqueIdentifier>{7f019908-7d0c-4bcc-ba83-dca898b5fe6f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\sources\Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\sources\PixMix\OneLvPixMix.cpp">
<Filter>Source Files\PixMix</Filter>
</ClCompile>
<ClCompile Include="..\..\sources\PixMix\PixMix.cpp">
<Filter>Source Files\PixMix</Filter>
</ClCompile>
<ClCompile Include="..\..\sources\PixMix\Utilities.cpp">
<Filter>Source Files\PixMix</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\sources\PixMix\OneLvPixMix.h">
<Filter>Source Files\PixMix</Filter>
</ClInclude>
<ClInclude Include="..\..\sources\PixMix\PixMix.h">
<Filter>Source Files\PixMix</Filter>
</ClInclude>
<ClInclude Include="..\..\sources\PixMix\Utilities.h">
<Filter>Source Files\PixMix</Filter>
</ClInclude>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions build/PixMix-Inpainting/PixMix-Inpainting.vcxproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
Binary file removed data/birds_magenta.png
Binary file not shown.
73 changes: 26 additions & 47 deletions sources/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,59 +1,38 @@
#include <iostream>
#include "PixMix/PixMix.h"

//#define MAGENTA_MASK_MODE

#ifndef MAGENTA_MASK_MODE
const std::string pathToSrcColor("../data/birds.png");
const std::string pathToDstColor("../data/birds_res.png");
const std::string pathToMask("../data/birds_mask.png");

int main()
{
cv::Mat_<cv::Vec3b> src = cv::imread(pathToSrcColor);
cv::Mat_<cv::Vec3b> dst(src.size());
cv::Mat_<uchar> mask = cv::imread(pathToMask, cv::IMREAD_GRAYSCALE);

cv::imshow("Input color image", src);
cv::imshow("Input mask image", mask);
cv::waitKey(1);

PixMix pm;
pm.init(src, mask);

pm.execute(dst, 0.05f);

cv::imwrite(pathToDstColor, dst);
cv::imshow("Output color image", dst);
cv::waitKey();

return 0;
}

#else
const std::string pathToSrcColor("../data/birds_magenta.png");
const std::string pathToDstColor("../data/birds_magenta_res.png");
const std::string pathToSrcColor("../../data/birds.png");
const std::string pathToDstColor("../../data/birds_res.png");
const std::string pathToMask("../../data/birds_mask.png");

int main()
{
cv::Mat_<cv::Vec3b> src = cv::imread(pathToSrcColor);
cv::Mat_<cv::Vec3b> dst(src.size(), src.type());
cv::Mat_<uchar> mask;

Util::createMask(src, cv::Scalar(255, 0, 255), mask);
auto color = cv::imread(pathToSrcColor, cv::IMREAD_COLOR);
auto mask = cv::imread(pathToMask, cv::IMREAD_GRAYSCALE);
cv::Mat inpainted;

cv::imshow("Input color image", src);
cv::imshow("Input color image", color);
cv::imshow("Input mask image", mask);
cv::waitKey(1);

PixMix pm;
pm.init(src, mask);

pm.execute(dst, 0.05f);

cv::imshow("Output color image", dst);
cv::waitKey();
cv::destroyAllWindows();

auto start = std::chrono::high_resolution_clock::now();
{
dr::PixMix pm;
dr::det::PixMixParams params;
params.alpha = 0.15f; // 0.0f means no spatial cost considered
params.maxItr = 5; // set to 1 to crank up the speed
params.maxRandSearchItr = 5; // set to 1 to crank up the speed
bool debugViz = true;
pm.Run(color, mask, inpainted, params, debugViz);
}
auto stop = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start);
std::cout << "Time: " << duration.count() << "ms" << std::endl;

cv::imwrite(pathToDstColor, inpainted);
cv::imshow("Inpainted color image", inpainted);
cv::waitKey();

return 0;
}
#endif
Loading

0 comments on commit 0a3b757

Please sign in to comment.