Path: blob/master/modules/superres/include/opencv2/superres.hpp
16358 views
/*M///////////////////////////////////////////////////////////////////////////////////////1//2// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.3//4// By downloading, copying, installing or using the software you agree to this license.5// If you do not agree to this license, do not download, install,6// copy or use the software.7//8//9// License Agreement10// For Open Source Computer Vision Library11//12// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.13// Copyright (C) 2009, Willow Garage Inc., all rights reserved.14// Third party copyrights are property of their respective owners.15//16// Redistribution and use in source and binary forms, with or without modification,17// are permitted provided that the following conditions are met:18//19// * Redistribution's of source code must retain the above copyright notice,20// this list of conditions and the following disclaimer.21//22// * Redistribution's in binary form must reproduce the above copyright notice,23// this list of conditions and the following disclaimer in the documentation24// and/or other materials provided with the distribution.25//26// * The name of the copyright holders may not be used to endorse or promote products27// derived from this software without specific prior written permission.28//29// This software is provided by the copyright holders and contributors "as is" and30// any express or implied warranties, including, but not limited to, the implied31// warranties of merchantability and fitness for a particular purpose are disclaimed.32// In no event shall the Intel Corporation or contributors be liable for any direct,33// indirect, incidental, special, exemplary, or consequential damages34// (including, but not limited to, procurement of substitute goods or services;35// loss of use, data, or profits; or business interruption) however caused36// and on any theory of liability, whether in contract, strict liability,37// or tort (including negligence or otherwise) arising in any way out of38// the use of this software, even if advised of the possibility of such damage.39//40//M*/4142#ifndef OPENCV_SUPERRES_HPP43#define OPENCV_SUPERRES_HPP4445#include "opencv2/core.hpp"46#include "opencv2/superres/optical_flow.hpp"4748/**49@defgroup superres Super Resolution5051The Super Resolution module contains a set of functions and classes that can be used to solve the52problem of resolution enhancement. There are a few methods implemented, most of them are described in53the papers @cite Farsiu03 and @cite Mitzel09 .5455*/5657namespace cv58{59namespace superres60{6162//! @addtogroup superres63//! @{6465class CV_EXPORTS FrameSource66{67public:68virtual ~FrameSource();6970virtual void nextFrame(OutputArray frame) = 0;71virtual void reset() = 0;72};7374CV_EXPORTS Ptr<FrameSource> createFrameSource_Empty();7576CV_EXPORTS Ptr<FrameSource> createFrameSource_Video(const String& fileName);77CV_EXPORTS Ptr<FrameSource> createFrameSource_Video_CUDA(const String& fileName);7879CV_EXPORTS Ptr<FrameSource> createFrameSource_Camera(int deviceId = 0);8081/** @brief Base class for Super Resolution algorithms.8283The class is only used to define the common interface for the whole family of Super Resolution84algorithms.85*/86class CV_EXPORTS SuperResolution : public cv::Algorithm, public FrameSource87{88public:89/** @brief Set input frame source for Super Resolution algorithm.9091@param frameSource Input frame source92*/93void setInput(const Ptr<FrameSource>& frameSource);9495/** @brief Process next frame from input and return output result.9697@param frame Output result98*/99void nextFrame(OutputArray frame) CV_OVERRIDE;100void reset() CV_OVERRIDE;101102/** @brief Clear all inner buffers.103*/104virtual void collectGarbage();105106//! @brief Scale factor107/** @see setScale */108virtual int getScale() const = 0;109/** @copybrief getScale @see getScale */110virtual void setScale(int val) = 0;111112//! @brief Iterations count113/** @see setIterations */114virtual int getIterations() const = 0;115/** @copybrief getIterations @see getIterations */116virtual void setIterations(int val) = 0;117118//! @brief Asymptotic value of steepest descent method119/** @see setTau */120virtual double getTau() const = 0;121/** @copybrief getTau @see getTau */122virtual void setTau(double val) = 0;123124//! @brief Weight parameter to balance data term and smoothness term125/** @see setLabmda */126virtual double getLabmda() const = 0;127/** @copybrief getLabmda @see getLabmda */128virtual void setLabmda(double val) = 0;129130//! @brief Parameter of spacial distribution in Bilateral-TV131/** @see setAlpha */132virtual double getAlpha() const = 0;133/** @copybrief getAlpha @see getAlpha */134virtual void setAlpha(double val) = 0;135136//! @brief Kernel size of Bilateral-TV filter137/** @see setKernelSize */138virtual int getKernelSize() const = 0;139/** @copybrief getKernelSize @see getKernelSize */140virtual void setKernelSize(int val) = 0;141142//! @brief Gaussian blur kernel size143/** @see setBlurKernelSize */144virtual int getBlurKernelSize() const = 0;145/** @copybrief getBlurKernelSize @see getBlurKernelSize */146virtual void setBlurKernelSize(int val) = 0;147148//! @brief Gaussian blur sigma149/** @see setBlurSigma */150virtual double getBlurSigma() const = 0;151/** @copybrief getBlurSigma @see getBlurSigma */152virtual void setBlurSigma(double val) = 0;153154//! @brief Radius of the temporal search area155/** @see setTemporalAreaRadius */156virtual int getTemporalAreaRadius() const = 0;157/** @copybrief getTemporalAreaRadius @see getTemporalAreaRadius */158virtual void setTemporalAreaRadius(int val) = 0;159160//! @brief Dense optical flow algorithm161/** @see setOpticalFlow */162virtual Ptr<cv::superres::DenseOpticalFlowExt> getOpticalFlow() const = 0;163/** @copybrief getOpticalFlow @see getOpticalFlow */164virtual void setOpticalFlow(const Ptr<cv::superres::DenseOpticalFlowExt> &val) = 0;165166protected:167SuperResolution();168169virtual void initImpl(Ptr<FrameSource>& frameSource) = 0;170virtual void processImpl(Ptr<FrameSource>& frameSource, OutputArray output) = 0;171172bool isUmat_;173174private:175Ptr<FrameSource> frameSource_;176bool firstCall_;177};178179/** @brief Create Bilateral TV-L1 Super Resolution.180181This class implements Super Resolution algorithm described in the papers @cite Farsiu03 and182@cite Mitzel09 .183184Here are important members of the class that control the algorithm, which you can set after185constructing the class instance:186187- **int scale** Scale factor.188- **int iterations** Iteration count.189- **double tau** Asymptotic value of steepest descent method.190- **double lambda** Weight parameter to balance data term and smoothness term.191- **double alpha** Parameter of spacial distribution in Bilateral-TV.192- **int btvKernelSize** Kernel size of Bilateral-TV filter.193- **int blurKernelSize** Gaussian blur kernel size.194- **double blurSigma** Gaussian blur sigma.195- **int temporalAreaRadius** Radius of the temporal search area.196- **Ptr\<DenseOpticalFlowExt\> opticalFlow** Dense optical flow algorithm.197*/198CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1();199CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1_CUDA();200201//! @} superres202203}204}205206#endif // OPENCV_SUPERRES_HPP207208209