Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: RZ_A2M_Mbed_samples
superres.hpp
00001 /*M/////////////////////////////////////////////////////////////////////////////////////// 00002 // 00003 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 00004 // 00005 // By downloading, copying, installing or using the software you agree to this license. 00006 // If you do not agree to this license, do not download, install, 00007 // copy or use the software. 00008 // 00009 // 00010 // License Agreement 00011 // For Open Source Computer Vision Library 00012 // 00013 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 00014 // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 00015 // Third party copyrights are property of their respective owners. 00016 // 00017 // Redistribution and use in source and binary forms, with or without modification, 00018 // are permitted provided that the following conditions are met: 00019 // 00020 // * Redistribution's of source code must retain the above copyright notice, 00021 // this list of conditions and the following disclaimer. 00022 // 00023 // * Redistribution's in binary form must reproduce the above copyright notice, 00024 // this list of conditions and the following disclaimer in the documentation 00025 // and/or other materials provided with the distribution. 00026 // 00027 // * The name of the copyright holders may not be used to endorse or promote products 00028 // derived from this software without specific prior written permission. 00029 // 00030 // This software is provided by the copyright holders and contributors "as is" and 00031 // any express or implied warranties, including, but not limited to, the implied 00032 // warranties of merchantability and fitness for a particular purpose are disclaimed. 00033 // In no event shall the Intel Corporation or contributors be liable for any direct, 00034 // indirect, incidental, special, exemplary, or consequential damages 00035 // (including, but not limited to, procurement of substitute goods or services; 00036 // loss of use, data, or profits; or business interruption) however caused 00037 // and on any theory of liability, whether in contract, strict liability, 00038 // or tort (including negligence or otherwise) arising in any way out of 00039 // the use of this software, even if advised of the possibility of such damage. 00040 // 00041 //M*/ 00042 00043 #ifndef OPENCV_SUPERRES_HPP 00044 #define OPENCV_SUPERRES_HPP 00045 00046 #include "opencv2/core.hpp" 00047 #include "opencv2/superres/optical_flow.hpp" 00048 00049 /** 00050 @defgroup superres Super Resolution 00051 00052 The Super Resolution module contains a set of functions and classes that can be used to solve the 00053 problem of resolution enhancement. There are a few methods implemented, most of them are descibed in 00054 the papers @cite Farsiu03 and @cite Mitzel09 . 00055 00056 */ 00057 00058 namespace cv 00059 { 00060 namespace superres 00061 { 00062 00063 //! @addtogroup superres 00064 //! @{ 00065 00066 class CV_EXPORTS FrameSource 00067 { 00068 public: 00069 virtual ~FrameSource(); 00070 00071 virtual void nextFrame(OutputArray frame) = 0; 00072 virtual void reset() = 0; 00073 }; 00074 00075 CV_EXPORTS Ptr<FrameSource> createFrameSource_Empty(); 00076 00077 CV_EXPORTS Ptr<FrameSource> createFrameSource_Video(const String& fileName); 00078 CV_EXPORTS Ptr<FrameSource> createFrameSource_Video_CUDA(const String& fileName); 00079 00080 CV_EXPORTS Ptr<FrameSource> createFrameSource_Camera(int deviceId = 0); 00081 00082 /** @brief Base class for Super Resolution algorithms. 00083 00084 The class is only used to define the common interface for the whole family of Super Resolution 00085 algorithms. 00086 */ 00087 class CV_EXPORTS SuperResolution : public cv::Algorithm, public FrameSource 00088 { 00089 public: 00090 /** @brief Set input frame source for Super Resolution algorithm. 00091 00092 @param frameSource Input frame source 00093 */ 00094 void setInput(const Ptr<FrameSource> & frameSource); 00095 00096 /** @brief Process next frame from input and return output result. 00097 00098 @param frame Output result 00099 */ 00100 void nextFrame(OutputArray frame); 00101 void reset(); 00102 00103 /** @brief Clear all inner buffers. 00104 */ 00105 virtual void collectGarbage(); 00106 00107 //! @brief Scale factor 00108 /** @see setScale */ 00109 virtual int getScale() const = 0; 00110 /** @copybrief getScale @see getScale */ 00111 virtual void setScale(int val) = 0; 00112 00113 //! @brief Iterations count 00114 /** @see setIterations */ 00115 virtual int getIterations() const = 0; 00116 /** @copybrief getIterations @see getIterations */ 00117 virtual void setIterations(int val) = 0; 00118 00119 //! @brief Asymptotic value of steepest descent method 00120 /** @see setTau */ 00121 virtual double getTau() const = 0; 00122 /** @copybrief getTau @see getTau */ 00123 virtual void setTau(double val) = 0; 00124 00125 //! @brief Weight parameter to balance data term and smoothness term 00126 /** @see setLabmda */ 00127 virtual double getLabmda() const = 0; 00128 /** @copybrief getLabmda @see getLabmda */ 00129 virtual void setLabmda(double val) = 0; 00130 00131 //! @brief Parameter of spacial distribution in Bilateral-TV 00132 /** @see setAlpha */ 00133 virtual double getAlpha() const = 0; 00134 /** @copybrief getAlpha @see getAlpha */ 00135 virtual void setAlpha(double val) = 0; 00136 00137 //! @brief Kernel size of Bilateral-TV filter 00138 /** @see setKernelSize */ 00139 virtual int getKernelSize() const = 0; 00140 /** @copybrief getKernelSize @see getKernelSize */ 00141 virtual void setKernelSize(int val) = 0; 00142 00143 //! @brief Gaussian blur kernel size 00144 /** @see setBlurKernelSize */ 00145 virtual int getBlurKernelSize() const = 0; 00146 /** @copybrief getBlurKernelSize @see getBlurKernelSize */ 00147 virtual void setBlurKernelSize(int val) = 0; 00148 00149 //! @brief Gaussian blur sigma 00150 /** @see setBlurSigma */ 00151 virtual double getBlurSigma() const = 0; 00152 /** @copybrief getBlurSigma @see getBlurSigma */ 00153 virtual void setBlurSigma(double val) = 0; 00154 00155 //! @brief Radius of the temporal search area 00156 /** @see setTemporalAreaRadius */ 00157 virtual int getTemporalAreaRadius() const = 0; 00158 /** @copybrief getTemporalAreaRadius @see getTemporalAreaRadius */ 00159 virtual void setTemporalAreaRadius(int val) = 0; 00160 00161 //! @brief Dense optical flow algorithm 00162 /** @see setOpticalFlow */ 00163 virtual Ptr<cv::superres::DenseOpticalFlowExt> getOpticalFlow() const = 0; 00164 /** @copybrief getOpticalFlow @see getOpticalFlow */ 00165 virtual void setOpticalFlow(const Ptr<cv::superres::DenseOpticalFlowExt> &val) = 0; 00166 00167 protected: 00168 SuperResolution(); 00169 00170 virtual void initImpl(Ptr<FrameSource> & frameSource) = 0; 00171 virtual void processImpl(Ptr<FrameSource> & frameSource, OutputArray output) = 0; 00172 00173 bool isUmat_; 00174 00175 private: 00176 Ptr<FrameSource> frameSource_; 00177 bool firstCall_; 00178 }; 00179 00180 /** @brief Create Bilateral TV-L1 Super Resolution. 00181 00182 This class implements Super Resolution algorithm described in the papers @cite Farsiu03 and 00183 @cite Mitzel09 . 00184 00185 Here are important members of the class that control the algorithm, which you can set after 00186 constructing the class instance: 00187 00188 - **int scale** Scale factor. 00189 - **int iterations** Iteration count. 00190 - **double tau** Asymptotic value of steepest descent method. 00191 - **double lambda** Weight parameter to balance data term and smoothness term. 00192 - **double alpha** Parameter of spacial distribution in Bilateral-TV. 00193 - **int btvKernelSize** Kernel size of Bilateral-TV filter. 00194 - **int blurKernelSize** Gaussian blur kernel size. 00195 - **double blurSigma** Gaussian blur sigma. 00196 - **int temporalAreaRadius** Radius of the temporal search area. 00197 - **Ptr<DenseOpticalFlowExt> opticalFlow** Dense optical flow algorithm. 00198 */ 00199 CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1(); 00200 CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1_CUDA(); 00201 00202 //! @} superres 00203 00204 } 00205 } 00206 00207 #endif // OPENCV_SUPERRES_HPP
Generated on Tue Jul 12 2022 18:20:19 by
