opencv on mbed

Dependencies:   mbed

Committer:
joeverbout
Date:
Thu Mar 31 21:16:38 2016 +0000
Revision:
0:ea44dc9ed014
OpenCV on mbed attempt

Who changed what in which revision?

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