1
/*M///////////////////////////////////////////////////////////////////////////////////////
3
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
5
// By downloading, copying, installing or using the software you agree to this license.
6
// If you do not agree to this license, do not download, install,
7
// copy or use the software.
11
// For Open Source Computer Vision Library
13
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15
// Third party copyrights are property of their respective owners.
17
// Redistribution and use in source and binary forms, with or without modification,
18
// are permitted provided that the following conditions are met:
20
// * Redistribution's of source code must retain the above copyright notice,
21
// this list of conditions and the following disclaimer.
23
// * Redistribution's in binary form must reproduce the above copyright notice,
24
// this list of conditions and the following disclaimer in the documentation
25
// and/or other materials provided with the distribution.
27
// * The name of the copyright holders may not be used to endorse or promote products
28
// derived from this software without specific prior written permission.
30
// This software is provided by the copyright holders and contributors "as is" and
31
// any express or implied warranties, including, but not limited to, the implied
32
// warranties of merchantability and fitness for a particular purpose are disclaimed.
33
// In no event shall the Intel Corporation or contributors be liable for any direct,
34
// indirect, incidental, special, exemplary, or consequential damages
35
// (including, but not limited to, procurement of substitute goods or services;
36
// loss of use, data, or profits; or business interruption) however caused
37
// and on any theory of liability, whether in contract, strict liability,
38
// or tort (including negligence or otherwise) arising in any way out of
39
// the use of this software, even if advised of the possibility of such damage.
43
#ifndef __OPENCV_SUPERRES_HPP__
44
#define __OPENCV_SUPERRES_HPP__
46
#include "opencv2/core.hpp"
47
#include "opencv2/superres/optical_flow.hpp"
50
@defgroup superres Super Resolution
52
The Super Resolution module contains a set of functions and classes that can be used to solve the
53
problem of resolution enhancement. There are a few methods implemented, most of them are descibed in
54
the papers @cite Farsiu03 and @cite Mitzel09 .
63
//! @addtogroup superres
66
class CV_EXPORTS FrameSource
69
virtual ~FrameSource();
71
virtual void nextFrame(OutputArray frame) = 0;
72
virtual void reset() = 0;
75
CV_EXPORTS Ptr<FrameSource> createFrameSource_Empty();
77
CV_EXPORTS Ptr<FrameSource> createFrameSource_Video(const String& fileName);
78
CV_EXPORTS Ptr<FrameSource> createFrameSource_Video_CUDA(const String& fileName);
80
CV_EXPORTS Ptr<FrameSource> createFrameSource_Camera(int deviceId = 0);
82
/** @brief Base class for Super Resolution algorithms.
84
The class is only used to define the common interface for the whole family of Super Resolution
87
class CV_EXPORTS SuperResolution : public cv::Algorithm, public FrameSource
90
/** @brief Set input frame source for Super Resolution algorithm.
92
@param frameSource Input frame source
94
void setInput(const Ptr<FrameSource>& frameSource);
96
/** @brief Process next frame from input and return output result.
98
@param frame Output result
100
void nextFrame(OutputArray frame);
103
/** @brief Clear all inner buffers.
105
virtual void collectGarbage();
107
//! @brief Scale factor
109
virtual int getScale() const = 0;
110
/** @copybrief getScale @see getScale */
111
virtual void setScale(int val) = 0;
113
//! @brief Iterations count
114
/** @see setIterations */
115
virtual int getIterations() const = 0;
116
/** @copybrief getIterations @see getIterations */
117
virtual void setIterations(int val) = 0;
119
//! @brief Asymptotic value of steepest descent method
121
virtual double getTau() const = 0;
122
/** @copybrief getTau @see getTau */
123
virtual void setTau(double val) = 0;
125
//! @brief Weight parameter to balance data term and smoothness term
126
/** @see setLabmda */
127
virtual double getLabmda() const = 0;
128
/** @copybrief getLabmda @see getLabmda */
129
virtual void setLabmda(double val) = 0;
131
//! @brief Parameter of spacial distribution in Bilateral-TV
133
virtual double getAlpha() const = 0;
134
/** @copybrief getAlpha @see getAlpha */
135
virtual void setAlpha(double val) = 0;
137
//! @brief Kernel size of Bilateral-TV filter
138
/** @see setKernelSize */
139
virtual int getKernelSize() const = 0;
140
/** @copybrief getKernelSize @see getKernelSize */
141
virtual void setKernelSize(int val) = 0;
143
//! @brief Gaussian blur kernel size
144
/** @see setBlurKernelSize */
145
virtual int getBlurKernelSize() const = 0;
146
/** @copybrief getBlurKernelSize @see getBlurKernelSize */
147
virtual void setBlurKernelSize(int val) = 0;
149
//! @brief Gaussian blur sigma
150
/** @see setBlurSigma */
151
virtual double getBlurSigma() const = 0;
152
/** @copybrief getBlurSigma @see getBlurSigma */
153
virtual void setBlurSigma(double val) = 0;
155
//! @brief Radius of the temporal search area
156
/** @see setTemporalAreaRadius */
157
virtual int getTemporalAreaRadius() const = 0;
158
/** @copybrief getTemporalAreaRadius @see getTemporalAreaRadius */
159
virtual void setTemporalAreaRadius(int val) = 0;
161
//! @brief Dense optical flow algorithm
162
/** @see setOpticalFlow */
163
virtual Ptr<cv::superres::DenseOpticalFlowExt> getOpticalFlow() const = 0;
164
/** @copybrief getOpticalFlow @see getOpticalFlow */
165
virtual void setOpticalFlow(const Ptr<cv::superres::DenseOpticalFlowExt> &val) = 0;
170
virtual void initImpl(Ptr<FrameSource>& frameSource) = 0;
171
virtual void processImpl(Ptr<FrameSource>& frameSource, OutputArray output) = 0;
176
Ptr<FrameSource> frameSource_;
180
/** @brief Create Bilateral TV-L1 Super Resolution.
182
This class implements Super Resolution algorithm described in the papers @cite Farsiu03 and
185
Here are important members of the class that control the algorithm, which you can set after
186
constructing the class instance:
188
- **int scale** Scale factor.
189
- **int iterations** Iteration count.
190
- **double tau** Asymptotic value of steepest descent method.
191
- **double lambda** Weight parameter to balance data term and smoothness term.
192
- **double alpha** Parameter of spacial distribution in Bilateral-TV.
193
- **int btvKernelSize** Kernel size of Bilateral-TV filter.
194
- **int blurKernelSize** Gaussian blur kernel size.
195
- **double blurSigma** Gaussian blur sigma.
196
- **int temporalAreaRadius** Radius of the temporal search area.
197
- **Ptr\<DenseOpticalFlowExt\> opticalFlow** Dense optical flow algorithm.
199
CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1();
200
CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1_CUDA();
207
#endif // __OPENCV_SUPERRES_HPP__