Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
1aad484c
Commit
1aad484c
authored
Jul 25, 2014
by
Bellaktris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first inpainting code
parent
cb207705
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
150 additions
and
7 deletions
+150
-7
CMakeLists.txt
modules/xphoto/CMakeLists.txt
+2
-2
xphoto.hpp
modules/xphoto/include/opencv2/xphoto.hpp
+1
-0
inpainting.hpp
modules/xphoto/include/opencv2/xphoto/inpainting.hpp
+76
-0
inpainting.cpp
modules/xphoto/samples/inpainting.cpp
+71
-0
inpainting.cpp
modules/xphoto/src/inpainting.cpp
+0
-0
dct_image_denoising.cpp
modules/xphoto/test/dct_image_denoising.cpp
+0
-5
No files found.
modules/xphoto/CMakeLists.txt
View file @
1aad484c
set
(
the_description
"Addon to basic photo module"
)
ocv_warnings_disable
(
CMAKE_CXX_FLAGS -Wundef
)
ocv_define_module
(
xphoto opencv_core opencv_imgproc OPTIONAL opencv_photo opencv_highgui
)
\ No newline at end of file
ocv_define_module
(
xphoto opencv_core opencv_imgproc opencv_stitching OPTIONAL opencv_photo opencv_highgui
)
\ No newline at end of file
modules/xphoto/include/opencv2/xphoto.hpp
View file @
1aad484c
...
...
@@ -44,6 +44,7 @@
#define __OPENCV_EDGEDETECTION_HPP__
#include "opencv2/xphoto.hpp"
#include "opencv2/xphoto/inpainting.hpp"
#include "opencv2/xphoto/simple_color_balance.hpp"
#include "opencv2/xphoto/dct_image_denoising.hpp"
#endif
modules/xphoto/include/opencv2/xphoto/inpainting.hpp
0 → 100644
View file @
1aad484c
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef __OPENCV_INPAINTING_HPP__
#define __OPENCV_INPAINTING_HPP__
/*
* inpainting.hpp
*
* Created on: Jul 22, 2014
* Author: Yury Gitman
*/
#include <opencv2/core.hpp>
/*! \namespace cv
Namespace where all the C++ OpenCV functionality resides
*/
namespace
cv
{
//! various inpainting algorithms
enum
{
INPAINT_SHIFTMAP
=
0
};
/*! The function reconstructs the selected image area from known area.
* \param src : source image.
* \param mask : inpainting mask, 8-bit 1-channel image. Zero pixels indicate the area that needs to be inpainted.
* \param dst : destination image.
* \param algorithmType : inpainting method.
*/
CV_EXPORTS_W
void
inpaint
(
const
Mat
&
src
,
const
Mat
&
mask
,
Mat
&
dst
,
const
int
algorithmType
);
}
#endif // __OPENCV_INPAINTING_HPP__
\ No newline at end of file
modules/xphoto/samples/inpainting.cpp
0 → 100644
View file @
1aad484c
#include "opencv2/xphoto.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/imgproc/types_c.h"
const
char
*
keys
=
{
"{i || input image name}"
"{m || mask image name}"
"{o || output image name}"
};
int
main
(
int
argc
,
const
char
**
argv
)
{
bool
printHelp
=
(
argc
==
1
);
printHelp
=
printHelp
||
(
argc
==
2
&&
std
::
string
(
argv
[
1
])
==
"--help"
);
printHelp
=
printHelp
||
(
argc
==
2
&&
std
::
string
(
argv
[
1
])
==
"-h"
);
if
(
printHelp
)
{
printf
(
"
\n
This sample demonstrates shift-map image inpainting
\n
"
"Call:
\n
"
" inpainting -i=<string> -m=<string> [-o=<string>]
\n\n
"
);
return
0
;
}
cv
::
CommandLineParser
parser
(
argc
,
argv
,
keys
);
if
(
!
parser
.
check
()
)
{
parser
.
printErrors
();
return
-
1
;
}
std
::
string
inFilename
=
parser
.
get
<
std
::
string
>
(
"i"
);
std
::
string
maskFilename
=
parser
.
get
<
std
::
string
>
(
"m"
);
std
::
string
outFilename
=
parser
.
get
<
std
::
string
>
(
"o"
);
cv
::
Mat
src
=
cv
::
imread
(
inFilename
,
-
1
);
if
(
src
.
empty
()
)
{
printf
(
"Cannot read image file: %s
\n
"
,
inFilename
.
c_str
()
);
return
-
1
;
}
cv
::
Mat
mask
=
cv
::
imread
(
maskFilename
,
0
);
if
(
mask
.
empty
()
)
{
printf
(
"Cannot read image file: %s
\n
"
,
maskFilename
.
c_str
()
);
return
-
1
;
}
cv
::
Mat
res
(
src
.
size
(),
src
.
type
());
cv
::
inpaint
(
src
,
mask
,
res
,
cv
::
INPAINT_SHIFTMAP
);
if
(
outFilename
==
""
)
{
cv
::
namedWindow
(
"denoising result"
,
1
);
cv
::
imshow
(
"denoising result"
,
res
);
cv
::
waitKey
(
0
);
}
else
cv
::
imwrite
(
outFilename
,
res
);
return
0
;
}
\ No newline at end of file
modules/xphoto/src/inpainting.cpp
0 → 100644
View file @
1aad484c
This diff is collapsed.
Click to expand it.
modules/xphoto/test/dct_image_denoising.cpp
View file @
1aad484c
...
...
@@ -20,11 +20,6 @@ namespace cvtest
cv
::
String
previousResultName
=
dir
+
cv
::
format
(
"results/%02d.png"
,
i
+
1
);
cv
::
Mat
previousResult
=
cv
::
imread
(
previousResultName
,
1
);
cv
::
Mat
sqrError
=
(
src
-
previousResult
).
mul
(
src
-
previousResult
);
cv
::
Scalar
mse
=
cv
::
sum
(
sqrError
)
/
cv
::
Scalar
::
all
(
sqrError
.
total
()
*
sqrError
.
channels
()
);
double
psnr
=
10
*
log10
(
3
*
255
*
255
/
(
mse
[
0
]
+
mse
[
1
]
+
mse
[
2
]));
cv
::
Mat
currentResult
,
fastNlMeansResult
;
cv
::
dctDenoising
(
src
,
currentResult
,
sigma
[
i
],
psize
[
i
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment