|
9 | 9 | //
|
10 | 10 | // License Agreement
|
11 | 11 | // For Open Source Computer Vision Library
|
| 12 | +// (3-clause BSD License) |
12 | 13 | //
|
13 |
| -// Copyright (C) 2000-2008, Intel Corporation, all rights reserved. |
| 14 | +// Copyright (C) 2000-2019, Intel Corporation, all rights reserved. |
14 | 15 | // Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
|
| 16 | +// Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved. |
| 17 | +// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. |
| 18 | +// Copyright (C) 2015-2016, OpenCV Foundation, all rights reserved. |
| 19 | +// Copyright (C) 2015-2016, Itseez Inc., all rights reserved. |
15 | 20 | // Third party copyrights are property of their respective owners.
|
16 | 21 | //
|
| 22 | +// Redistribution and use in source and binary forms, with or without modification, |
| 23 | +// are permitted provided that the following conditions are met: |
| 24 | +// |
17 | 25 | // * Redistribution's of source code must retain the above copyright notice,
|
18 | 26 | // this list of conditions and the following disclaimer.
|
19 | 27 | //
|
20 | 28 | // * Redistribution's in binary form must reproduce the above copyright notice,
|
21 | 29 | // this list of conditions and the following disclaimer in the documentation
|
22 | 30 | // and/or other materials provided with the distribution.
|
23 | 31 | //
|
24 |
| -// * The name of Intel Corporation may not be used to endorse or promote products |
25 |
| -// derived from this software without specific prior written permission. |
| 32 | +// * Neither the names of the copyright holders nor the names of the contributors |
| 33 | +// may be used to endorse or promote products derived from this software |
| 34 | +// without specific prior written permission. |
26 | 35 | //
|
27 | 36 | // This software is provided by the copyright holders and contributors "as is" and
|
28 | 37 | // any express or implied warranties, including, but not limited to, the implied
|
|
46 | 55 | #include <fstream>
|
47 | 56 | #include <time.h>
|
48 | 57 | #include <functional>
|
| 58 | +#include <string> |
| 59 | +#include <tuple> |
49 | 60 |
|
50 | 61 | #include "opencv2/xphoto.hpp"
|
51 | 62 |
|
|
62 | 73 | #include "annf.hpp"
|
63 | 74 | #include "advanced_types.hpp"
|
64 | 75 |
|
| 76 | +#include "inpainting_fsr.impl.hpp" |
| 77 | + |
65 | 78 | namespace cv
|
66 | 79 | {
|
67 | 80 | namespace xphoto
|
@@ -298,17 +311,9 @@ namespace xphoto
|
298 | 311 | }
|
299 | 312 | }
|
300 | 313 |
|
301 |
| - /*! The function reconstructs the selected image area from known area. |
302 |
| - * \param src : source image. |
303 |
| - * \param mask : inpainting mask, 8-bit 1-channel image. Zero pixels indicate the area that needs to be inpainted. |
304 |
| - * \param dst : destination image. |
305 |
| - * \param algorithmType : inpainting method. |
306 |
| - */ |
307 |
| - void inpaint(const Mat &src, const Mat &mask, Mat &dst, const int algorithmType) |
| 314 | + static |
| 315 | + void inpaint_shiftmap(const Mat &src, const Mat &mask, Mat &dst, const int algorithmType) |
308 | 316 | {
|
309 |
| - CV_Assert( mask.channels() == 1 && mask.depth() == CV_8U ); |
310 |
| - CV_Assert( src.rows == mask.rows && src.cols == mask.cols ); |
311 |
| - |
312 | 317 | switch ( src.type() )
|
313 | 318 | {
|
314 | 319 | case CV_8SC1:
|
@@ -399,8 +404,25 @@ namespace xphoto
|
399 | 404 | CV_Error_( CV_StsNotImplemented,
|
400 | 405 | ("Unsupported source image format (=%d)",
|
401 | 406 | src.type()) );
|
402 |
| - break; |
403 | 407 | }
|
404 | 408 | }
|
| 409 | + |
| 410 | +void inpaint(const Mat &src, const Mat &mask, Mat &dst, const int algorithmType) |
| 411 | +{ |
| 412 | + CV_Assert(!src.empty()); |
| 413 | + CV_Assert(!mask.empty()); |
| 414 | + CV_CheckTypeEQ(mask.type(), CV_8UC1, ""); |
| 415 | + CV_Assert(src.rows == mask.rows && src.cols == mask.cols); |
| 416 | + |
| 417 | + switch (algorithmType) |
| 418 | + { |
| 419 | + case xphoto::INPAINT_SHIFTMAP: |
| 420 | + return inpaint_shiftmap(src, mask, dst, algorithmType); |
| 421 | + case xphoto::INPAINT_FSR_BEST: |
| 422 | + case xphoto::INPAINT_FSR_FAST: |
| 423 | + return inpaint_fsr(src, mask, dst, algorithmType); |
| 424 | + } |
| 425 | + CV_Error_(Error::StsNotImplemented, ("Unsupported inpainting algorithm type (=%d)", algorithmType)); |
405 | 426 | }
|
406 |
| -} |
| 427 | + |
| 428 | +}} // namespace |
0 commit comments