-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[GSoC 2017] Obstruction Free #1233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.x
Are you sure you want to change the base?
Changes from 3 commits
6d30fce
0486e04
1499141
378a595
1d8d33a
05434ce
1974f45
a18e2ec
63c641d
f466e47
5d453cf
c694e46
0bca4ca
0b426a2
fdac8cd
5835871
e9c6f9c
9a0caa8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
set(the_description "Addon to basic photo module") | ||
ocv_define_module(xphoto opencv_core opencv_imgproc WRAP python) | ||
ocv_define_module(xphoto opencv_core opencv_imgproc opencv_highgui WRAP python) | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/*M/////////////////////////////////////////////////////////////////////////////////////// | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This long header should be replaced with a short one:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you very much for pointing it out. I will modify the header part. |
||
// | ||
// 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_OBSTRUCTION_FREE_HPP__ | ||
#define __OPENCV_OBSTRUCTION_FREE_HPP__ | ||
|
||
/** @file | ||
@date June 18, 2017 | ||
@author Binbin Xu | ||
*/ | ||
|
||
#include <opencv2/core.hpp> | ||
|
||
namespace cv | ||
{ | ||
namespace xphoto | ||
{ | ||
|
||
//! @addtogroup xphoto | ||
//! @{ | ||
|
||
|
||
/** @brief The function implements a general obstruction free approach that can remove occlusions and reflections from input image sequences without manual masks. | ||
|
||
See the original paper @cite Xue2015ObstructionFree for more details. | ||
|
||
@param srcImgs source image sequences, involving translation motions. | ||
@param dst Obstruction-removed destination image, corresponding to the reference image, with the same size and type. In general, the reference image is the center frame of the input image. | ||
@param mask mask (CV_8UC1), where zero pixels indicate area to be estimated to be occlusions. | ||
*/ | ||
CV_EXPORTS void obstructionFree(const std::vector <Mat> &srcImgs, Mat &dst, Mat &mask); | ||
|
||
//! @} | ||
|
||
} | ||
} | ||
|
||
#endif // __OPENCV_INPAINTING_HPP__ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/*M/////////////////////////////////////////////////////////////////////////////////////// | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same about the outdated long license header. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you very much for pointing it out. I will modify the header part accordingly. |
||
// | ||
// 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'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 Intel Corporation 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_OBSTRUCTION_FREE_CPP__ | ||
#define __OPENCV_OBSTRUCTION_FREE_CPP__ | ||
#ifdef __cplusplus | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you very much for pointing it out. I will remove this line. |
||
|
||
#include <vector> | ||
#include <iostream> | ||
|
||
#include <opencv2/xphoto.hpp> | ||
|
||
#include <opencv2/core.hpp> | ||
#include <opencv2/imgproc.hpp> | ||
#include <opencv2/highgui.hpp> | ||
|
||
namespace cv | ||
{ | ||
namespace xphoto | ||
{ | ||
void obstructionFree(const std::vector <Mat> &srcImgs, Mat &dst, Mat &mask){ | ||
size_t frameNumber = srcImgs.size(); | ||
size_t reference_number = (frameNumber-1)/2;; | ||
dst.create( srcImgs[reference_number].size(), srcImgs[reference_number].type() ); | ||
mask = Mat::zeros(dst.rows,dst.cols,CV_8UC1); | ||
|
||
|
||
/////////construct image pyramids////// | ||
int pyramid_level=3; | ||
std::vector<Mat> video_coarseLeve; | ||
for (size_t frame_i=0; frame_i<frameNumber; frame_i++){ | ||
Mat temp, temp_gray; | ||
temp=srcImgs[frame_i].clone(); | ||
cvtColor(temp, temp_gray, COLOR_RGB2GRAY); | ||
for (int i=0; i<pyramid_level; i++){ | ||
pyrDown( temp_gray, temp_gray ); | ||
} | ||
video_coarseLeve.push_back(temp_gray.clone()); | ||
} | ||
} | ||
} | ||
} | ||
#endif // __OPENCV_PCALIB_CPP__ | ||
#endif // cplusplus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need
higui
here? We are trying to reduce dependencies for each module.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for pointing it out. You are right.
highgui
was used originally for showing the processed images. I will remove this dependency to the sample file.