mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Merge pull request #13267 from LaurentBerger:StitchPython
* Python wrapper for detail * hide pyrotationwrapper * copy code in pyopencv_rotationwarper.hpp * move ImageFeatures MatchInfo and CameraParams in core/misc/ * add python test for detail * move test_detail in test_stitching * rename
This commit is contained in:
committed by
Alexander Alekhin
parent
fd27d5ea00
commit
2fb409b286
@@ -64,7 +64,7 @@ undergoes rotations around its centre only.
|
||||
See "Construction of Panoramic Image Mosaics with Global and Local Alignment"
|
||||
by Heung-Yeung Shum and Richard Szeliski.
|
||||
*/
|
||||
void CV_EXPORTS focalsFromHomography(const Mat &H, double &f0, double &f1, bool &f0_ok, bool &f1_ok);
|
||||
void CV_EXPORTS_W focalsFromHomography(const Mat &H, double &f0, double &f1, bool &f0_ok, bool &f1_ok);
|
||||
|
||||
/** @brief Estimates focal lengths for each given camera.
|
||||
|
||||
@@ -76,7 +76,7 @@ void CV_EXPORTS estimateFocal(const std::vector<ImageFeatures> &features,
|
||||
const std::vector<MatchesInfo> &pairwise_matches,
|
||||
std::vector<double> &focals);
|
||||
|
||||
bool CV_EXPORTS calibrateRotatingCamera(const std::vector<Mat> &Hs, Mat &K);
|
||||
bool CV_EXPORTS_W calibrateRotatingCamera(const std::vector<Mat> &Hs,CV_OUT Mat &K);
|
||||
|
||||
//! @} stitching_autocalib
|
||||
|
||||
|
||||
@@ -60,35 +60,35 @@ namespace detail {
|
||||
|
||||
Simple blender which puts one image over another
|
||||
*/
|
||||
class CV_EXPORTS Blender
|
||||
class CV_EXPORTS_W Blender
|
||||
{
|
||||
public:
|
||||
virtual ~Blender() {}
|
||||
|
||||
enum { NO, FEATHER, MULTI_BAND };
|
||||
static Ptr<Blender> createDefault(int type, bool try_gpu = false);
|
||||
CV_WRAP static Ptr<Blender> createDefault(int type, bool try_gpu = false);
|
||||
|
||||
/** @brief Prepares the blender for blending.
|
||||
|
||||
@param corners Source images top-left corners
|
||||
@param sizes Source image sizes
|
||||
*/
|
||||
void prepare(const std::vector<Point> &corners, const std::vector<Size> &sizes);
|
||||
CV_WRAP void prepare(const std::vector<Point> &corners, const std::vector<Size> &sizes);
|
||||
/** @overload */
|
||||
virtual void prepare(Rect dst_roi);
|
||||
CV_WRAP virtual void prepare(Rect dst_roi);
|
||||
/** @brief Processes the image.
|
||||
|
||||
@param img Source image
|
||||
@param mask Source image mask
|
||||
@param tl Source image top-left corners
|
||||
*/
|
||||
virtual void feed(InputArray img, InputArray mask, Point tl);
|
||||
CV_WRAP virtual void feed(InputArray img, InputArray mask, Point tl);
|
||||
/** @brief Blends and returns the final pano.
|
||||
|
||||
@param dst Final pano
|
||||
@param dst_mask Final pano mask
|
||||
*/
|
||||
virtual void blend(InputOutputArray dst, InputOutputArray dst_mask);
|
||||
CV_WRAP virtual void blend(CV_IN_OUT InputOutputArray dst,CV_IN_OUT InputOutputArray dst_mask);
|
||||
|
||||
protected:
|
||||
UMat dst_, dst_mask_;
|
||||
@@ -97,22 +97,22 @@ protected:
|
||||
|
||||
/** @brief Simple blender which mixes images at its borders.
|
||||
*/
|
||||
class CV_EXPORTS FeatherBlender : public Blender
|
||||
class CV_EXPORTS_W FeatherBlender : public Blender
|
||||
{
|
||||
public:
|
||||
FeatherBlender(float sharpness = 0.02f);
|
||||
CV_WRAP FeatherBlender(float sharpness = 0.02f);
|
||||
|
||||
float sharpness() const { return sharpness_; }
|
||||
void setSharpness(float val) { sharpness_ = val; }
|
||||
CV_WRAP float sharpness() const { return sharpness_; }
|
||||
CV_WRAP void setSharpness(float val) { sharpness_ = val; }
|
||||
|
||||
void prepare(Rect dst_roi) CV_OVERRIDE;
|
||||
void feed(InputArray img, InputArray mask, Point tl) CV_OVERRIDE;
|
||||
void blend(InputOutputArray dst, InputOutputArray dst_mask) CV_OVERRIDE;
|
||||
CV_WRAP void prepare(Rect dst_roi) CV_OVERRIDE;
|
||||
CV_WRAP void feed(InputArray img, InputArray mask, Point tl) CV_OVERRIDE;
|
||||
CV_WRAP void blend(InputOutputArray dst, InputOutputArray dst_mask) CV_OVERRIDE;
|
||||
|
||||
//! Creates weight maps for fixed set of source images by their masks and top-left corners.
|
||||
//! Final image can be obtained by simple weighting of the source images.
|
||||
Rect createWeightMaps(const std::vector<UMat> &masks, const std::vector<Point> &corners,
|
||||
std::vector<UMat> &weight_maps);
|
||||
CV_WRAP Rect createWeightMaps(const std::vector<UMat> &masks, const std::vector<Point> &corners,
|
||||
CV_IN_OUT std::vector<UMat> &weight_maps);
|
||||
|
||||
private:
|
||||
float sharpness_;
|
||||
@@ -124,17 +124,17 @@ inline FeatherBlender::FeatherBlender(float _sharpness) { setSharpness(_sharpnes
|
||||
|
||||
/** @brief Blender which uses multi-band blending algorithm (see @cite BA83).
|
||||
*/
|
||||
class CV_EXPORTS MultiBandBlender : public Blender
|
||||
class CV_EXPORTS_W MultiBandBlender : public Blender
|
||||
{
|
||||
public:
|
||||
MultiBandBlender(int try_gpu = false, int num_bands = 5, int weight_type = CV_32F);
|
||||
CV_WRAP MultiBandBlender(int try_gpu = false, int num_bands = 5, int weight_type = CV_32F);
|
||||
|
||||
int numBands() const { return actual_num_bands_; }
|
||||
void setNumBands(int val) { actual_num_bands_ = val; }
|
||||
CV_WRAP int numBands() const { return actual_num_bands_; }
|
||||
CV_WRAP void setNumBands(int val) { actual_num_bands_ = val; }
|
||||
|
||||
void prepare(Rect dst_roi) CV_OVERRIDE;
|
||||
void feed(InputArray img, InputArray mask, Point tl) CV_OVERRIDE;
|
||||
void blend(InputOutputArray dst, InputOutputArray dst_mask) CV_OVERRIDE;
|
||||
CV_WRAP void prepare(Rect dst_roi) CV_OVERRIDE;
|
||||
CV_WRAP void feed(InputArray img, InputArray mask, Point tl) CV_OVERRIDE;
|
||||
CV_WRAP void blend(CV_IN_OUT InputOutputArray dst, CV_IN_OUT InputOutputArray dst_mask) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
int actual_num_bands_, num_bands_;
|
||||
@@ -165,16 +165,16 @@ private:
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Auxiliary functions
|
||||
|
||||
void CV_EXPORTS normalizeUsingWeightMap(InputArray weight, InputOutputArray src);
|
||||
void CV_EXPORTS_W normalizeUsingWeightMap(InputArray weight, CV_IN_OUT InputOutputArray src);
|
||||
|
||||
void CV_EXPORTS createWeightMap(InputArray mask, float sharpness, InputOutputArray weight);
|
||||
void CV_EXPORTS_W createWeightMap(InputArray mask, float sharpness, CV_IN_OUT InputOutputArray weight);
|
||||
|
||||
void CV_EXPORTS createLaplacePyr(InputArray img, int num_levels, std::vector<UMat>& pyr);
|
||||
void CV_EXPORTS createLaplacePyrGpu(InputArray img, int num_levels, std::vector<UMat>& pyr);
|
||||
void CV_EXPORTS_W createLaplacePyr(InputArray img, int num_levels, CV_IN_OUT std::vector<UMat>& pyr);
|
||||
void CV_EXPORTS_W createLaplacePyrGpu(InputArray img, int num_levels, CV_IN_OUT std::vector<UMat>& pyr);
|
||||
|
||||
// Restores source image
|
||||
void CV_EXPORTS restoreImageFromLaplacePyr(std::vector<UMat>& pyr);
|
||||
void CV_EXPORTS restoreImageFromLaplacePyrGpu(std::vector<UMat>& pyr);
|
||||
void CV_EXPORTS_W restoreImageFromLaplacePyr(CV_IN_OUT std::vector<UMat>& pyr);
|
||||
void CV_EXPORTS_W restoreImageFromLaplacePyrGpu(CV_IN_OUT std::vector<UMat>& pyr);
|
||||
|
||||
//! @}
|
||||
|
||||
|
||||
@@ -55,19 +55,19 @@ namespace detail {
|
||||
|
||||
@note Translation is assumed to be zero during the whole stitching pipeline. :
|
||||
*/
|
||||
struct CV_EXPORTS CameraParams
|
||||
struct CV_EXPORTS_W_SIMPLE CameraParams
|
||||
{
|
||||
CameraParams();
|
||||
CameraParams(const CameraParams& other);
|
||||
CameraParams& operator =(const CameraParams& other);
|
||||
Mat K() const;
|
||||
CV_WRAP Mat K() const;
|
||||
|
||||
double focal; // Focal length
|
||||
double aspect; // Aspect ratio
|
||||
double ppx; // Principal point X
|
||||
double ppy; // Principal point Y
|
||||
Mat R; // Rotation
|
||||
Mat t; // Translation
|
||||
CV_PROP_RW double focal; // Focal length
|
||||
CV_PROP_RW double aspect; // Aspect ratio
|
||||
CV_PROP_RW double ppx; // Principal point X
|
||||
CV_PROP_RW double ppy; // Principal point Y
|
||||
CV_PROP_RW Mat R; // Rotation
|
||||
CV_PROP_RW Mat t; // Translation
|
||||
};
|
||||
|
||||
//! @}
|
||||
|
||||
@@ -57,54 +57,64 @@ namespace detail {
|
||||
|
||||
/** @brief Base class for all exposure compensators.
|
||||
*/
|
||||
class CV_EXPORTS ExposureCompensator
|
||||
class CV_EXPORTS_W ExposureCompensator
|
||||
{
|
||||
public:
|
||||
virtual ~ExposureCompensator() {}
|
||||
|
||||
enum { NO, GAIN, GAIN_BLOCKS };
|
||||
static Ptr<ExposureCompensator> createDefault(int type);
|
||||
CV_WRAP static Ptr<ExposureCompensator> createDefault(int type);
|
||||
|
||||
/**
|
||||
@param corners Source image top-left corners
|
||||
@param images Source images
|
||||
@param masks Image masks to update (second value in pair specifies the value which should be used
|
||||
to detect where image is)
|
||||
*/
|
||||
void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
|
||||
const std::vector<UMat> &masks);
|
||||
*/
|
||||
CV_WRAP void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
|
||||
const std::vector<UMat> &masks);
|
||||
/** @overload */
|
||||
virtual void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
|
||||
const std::vector<std::pair<UMat,uchar> > &masks) = 0;
|
||||
const std::vector<std::pair<UMat, uchar> > &masks) = 0;
|
||||
/** @brief Compensate exposure in the specified image.
|
||||
|
||||
@param index Image index
|
||||
@param corner Image top-left corner
|
||||
@param image Image to process
|
||||
@param mask Image mask
|
||||
*/
|
||||
virtual void apply(int index, Point corner, InputOutputArray image, InputArray mask) = 0;
|
||||
*/
|
||||
CV_WRAP virtual void apply(int index, Point corner, InputOutputArray image, InputArray mask) = 0;
|
||||
CV_WRAP virtual void getMatGains(CV_OUT std::vector<Mat>& ) {CV_Error(Error::StsInternal, "");};
|
||||
CV_WRAP virtual void setMatGains(std::vector<Mat>& ) { CV_Error(Error::StsInternal, ""); };
|
||||
CV_WRAP void setUpdateGain(bool b) { updateGain = b; };
|
||||
CV_WRAP bool getUpdateGain() { return updateGain; };
|
||||
protected :
|
||||
bool updateGain;
|
||||
};
|
||||
|
||||
/** @brief Stub exposure compensator which does nothing.
|
||||
*/
|
||||
class CV_EXPORTS NoExposureCompensator : public ExposureCompensator
|
||||
class CV_EXPORTS_W NoExposureCompensator : public ExposureCompensator
|
||||
{
|
||||
public:
|
||||
void feed(const std::vector<Point> &/*corners*/, const std::vector<UMat> &/*images*/,
|
||||
const std::vector<std::pair<UMat,uchar> > &/*masks*/) CV_OVERRIDE { }
|
||||
void apply(int /*index*/, Point /*corner*/, InputOutputArray /*image*/, InputArray /*mask*/) CV_OVERRIDE { }
|
||||
CV_WRAP void apply(int /*index*/, Point /*corner*/, InputOutputArray /*image*/, InputArray /*mask*/) CV_OVERRIDE { }
|
||||
CV_WRAP void getMatGains(CV_OUT std::vector<Mat>& umv) CV_OVERRIDE { umv.clear(); return; };
|
||||
CV_WRAP void setMatGains(std::vector<Mat>& umv) CV_OVERRIDE { umv.clear(); return; };
|
||||
};
|
||||
|
||||
/** @brief Exposure compensator which tries to remove exposure related artifacts by adjusting image
|
||||
intensities, see @cite BL07 and @cite WJ10 for details.
|
||||
*/
|
||||
class CV_EXPORTS GainCompensator : public ExposureCompensator
|
||||
class CV_EXPORTS_W GainCompensator : public ExposureCompensator
|
||||
{
|
||||
public:
|
||||
void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
|
||||
const std::vector<std::pair<UMat,uchar> > &masks) CV_OVERRIDE;
|
||||
void apply(int index, Point corner, InputOutputArray image, InputArray mask) CV_OVERRIDE;
|
||||
CV_WRAP void apply(int index, Point corner, InputOutputArray image, InputArray mask) CV_OVERRIDE;
|
||||
CV_WRAP void getMatGains(CV_OUT std::vector<Mat>& umv) CV_OVERRIDE ;
|
||||
CV_WRAP void setMatGains(std::vector<Mat>& umv) CV_OVERRIDE ;
|
||||
std::vector<double> gains() const;
|
||||
|
||||
private:
|
||||
@@ -114,14 +124,16 @@ private:
|
||||
/** @brief Exposure compensator which tries to remove exposure related artifacts by adjusting image block
|
||||
intensities, see @cite UES01 for details.
|
||||
*/
|
||||
class CV_EXPORTS BlocksGainCompensator : public ExposureCompensator
|
||||
class CV_EXPORTS_W BlocksGainCompensator : public ExposureCompensator
|
||||
{
|
||||
public:
|
||||
BlocksGainCompensator(int bl_width = 32, int bl_height = 32)
|
||||
: bl_width_(bl_width), bl_height_(bl_height) {}
|
||||
CV_WRAP BlocksGainCompensator(int bl_width = 32, int bl_height = 32)
|
||||
: bl_width_(bl_width), bl_height_(bl_height) {setUpdateGain(true);}
|
||||
void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
|
||||
const std::vector<std::pair<UMat,uchar> > &masks) CV_OVERRIDE;
|
||||
void apply(int index, Point corner, InputOutputArray image, InputArray mask) CV_OVERRIDE;
|
||||
CV_WRAP void apply(int index, Point corner, InputOutputArray image, InputArray mask) CV_OVERRIDE;
|
||||
CV_WRAP void getMatGains(CV_OUT std::vector<Mat>& umv) CV_OVERRIDE;
|
||||
CV_WRAP void setMatGains(std::vector<Mat>& umv) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
int bl_width_, bl_height_;
|
||||
|
||||
@@ -55,24 +55,38 @@ namespace detail {
|
||||
//! @{
|
||||
|
||||
/** @brief Structure containing image keypoints and descriptors. */
|
||||
struct CV_EXPORTS ImageFeatures
|
||||
struct CV_EXPORTS_W_SIMPLE ImageFeatures
|
||||
{
|
||||
int img_idx;
|
||||
Size img_size;
|
||||
CV_PROP_RW int img_idx;
|
||||
CV_PROP_RW Size img_size;
|
||||
std::vector<KeyPoint> keypoints;
|
||||
UMat descriptors;
|
||||
CV_PROP_RW UMat descriptors;
|
||||
CV_WRAP std::vector<KeyPoint> getKeypoints() { return keypoints; };
|
||||
};
|
||||
/** @brief
|
||||
|
||||
CV_EXPORTS void computeImageFeatures(
|
||||
@param featuresFinder
|
||||
@param images
|
||||
@param features
|
||||
@param masks
|
||||
*/
|
||||
CV_EXPORTS_W void computeImageFeatures(
|
||||
const Ptr<Feature2D> &featuresFinder,
|
||||
InputArrayOfArrays images,
|
||||
std::vector<ImageFeatures> &features,
|
||||
CV_OUT std::vector<ImageFeatures> &features,
|
||||
InputArrayOfArrays masks = noArray());
|
||||
|
||||
CV_EXPORTS void computeImageFeatures(
|
||||
/** @brief
|
||||
|
||||
@param featuresFinder
|
||||
@param image
|
||||
@param features
|
||||
@param mask
|
||||
*/
|
||||
CV_EXPORTS_AS(computeImageFeatures2) void computeImageFeatures(
|
||||
const Ptr<Feature2D> &featuresFinder,
|
||||
InputArray image,
|
||||
ImageFeatures &features,
|
||||
CV_OUT ImageFeatures &features,
|
||||
InputArray mask = noArray());
|
||||
|
||||
/** @brief Structure containing information about matches between two images.
|
||||
@@ -82,33 +96,36 @@ homography or affine transformation based on selected matcher.
|
||||
|
||||
@sa detail::FeaturesMatcher
|
||||
*/
|
||||
struct CV_EXPORTS MatchesInfo
|
||||
struct CV_EXPORTS_W_SIMPLE MatchesInfo
|
||||
{
|
||||
MatchesInfo();
|
||||
MatchesInfo(const MatchesInfo &other);
|
||||
MatchesInfo& operator =(const MatchesInfo &other);
|
||||
|
||||
int src_img_idx, dst_img_idx; //!< Images indices (optional)
|
||||
CV_PROP_RW int src_img_idx;
|
||||
CV_PROP_RW int dst_img_idx; //!< Images indices (optional)
|
||||
std::vector<DMatch> matches;
|
||||
std::vector<uchar> inliers_mask; //!< Geometrically consistent matches mask
|
||||
int num_inliers; //!< Number of geometrically consistent matches
|
||||
Mat H; //!< Estimated transformation
|
||||
double confidence; //!< Confidence two images are from the same panorama
|
||||
CV_PROP_RW int num_inliers; //!< Number of geometrically consistent matches
|
||||
CV_PROP_RW Mat H; //!< Estimated transformation
|
||||
CV_PROP_RW double confidence; //!< Confidence two images are from the same panorama
|
||||
CV_WRAP std::vector<DMatch> getMatches() { return matches; };
|
||||
CV_WRAP std::vector<uchar> getInliers() { return inliers_mask; };
|
||||
};
|
||||
|
||||
/** @brief Feature matchers base class. */
|
||||
class CV_EXPORTS FeaturesMatcher
|
||||
class CV_EXPORTS_W FeaturesMatcher
|
||||
{
|
||||
public:
|
||||
virtual ~FeaturesMatcher() {}
|
||||
CV_WRAP virtual ~FeaturesMatcher() {}
|
||||
|
||||
/** @overload
|
||||
@param features1 First image features
|
||||
@param features2 Second image features
|
||||
@param matches_info Found matches
|
||||
*/
|
||||
void operator ()(const ImageFeatures &features1, const ImageFeatures &features2,
|
||||
MatchesInfo& matches_info) { match(features1, features2, matches_info); }
|
||||
CV_WRAP_AS(apply) void operator ()(const ImageFeatures &features1, const ImageFeatures &features2,
|
||||
CV_OUT MatchesInfo& matches_info) { match(features1, features2, matches_info); }
|
||||
|
||||
/** @brief Performs images matching.
|
||||
|
||||
@@ -120,16 +137,16 @@ public:
|
||||
|
||||
@sa detail::MatchesInfo
|
||||
*/
|
||||
void operator ()(const std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
|
||||
CV_WRAP_AS(apply2) void operator ()(const std::vector<ImageFeatures> &features, CV_OUT std::vector<MatchesInfo> &pairwise_matches,
|
||||
const cv::UMat &mask = cv::UMat());
|
||||
|
||||
/** @return True, if it's possible to use the same matcher instance in parallel, false otherwise
|
||||
*/
|
||||
bool isThreadSafe() const { return is_thread_safe_; }
|
||||
CV_WRAP bool isThreadSafe() const { return is_thread_safe_; }
|
||||
|
||||
/** @brief Frees unused memory allocated before if there is any.
|
||||
*/
|
||||
virtual void collectGarbage() {}
|
||||
CV_WRAP virtual void collectGarbage() {}
|
||||
|
||||
protected:
|
||||
FeaturesMatcher(bool is_thread_safe = false) : is_thread_safe_(is_thread_safe) {}
|
||||
@@ -152,7 +169,7 @@ ratio between descriptor distances is greater than the threshold match_conf
|
||||
|
||||
@sa detail::FeaturesMatcher
|
||||
*/
|
||||
class CV_EXPORTS BestOf2NearestMatcher : public FeaturesMatcher
|
||||
class CV_EXPORTS_W BestOf2NearestMatcher : public FeaturesMatcher
|
||||
{
|
||||
public:
|
||||
/** @brief Constructs a "best of 2 nearest" matcher.
|
||||
@@ -164,23 +181,25 @@ public:
|
||||
@param num_matches_thresh2 Minimum number of matches required for the 2D projective transform
|
||||
re-estimation on inliers
|
||||
*/
|
||||
BestOf2NearestMatcher(bool try_use_gpu = false, float match_conf = 0.3f, int num_matches_thresh1 = 6,
|
||||
CV_WRAP BestOf2NearestMatcher(bool try_use_gpu = false, float match_conf = 0.3f, int num_matches_thresh1 = 6,
|
||||
int num_matches_thresh2 = 6);
|
||||
|
||||
void collectGarbage() CV_OVERRIDE;
|
||||
CV_WRAP void collectGarbage() CV_OVERRIDE;
|
||||
CV_WRAP static Ptr<BestOf2NearestMatcher> create(bool try_use_gpu = false, float match_conf = 0.3f, int num_matches_thresh1 = 6,
|
||||
int num_matches_thresh2 = 6);
|
||||
|
||||
protected:
|
||||
void match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo &matches_info) CV_OVERRIDE;
|
||||
|
||||
void match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo &matches_info) CV_OVERRIDE;
|
||||
int num_matches_thresh1_;
|
||||
int num_matches_thresh2_;
|
||||
Ptr<FeaturesMatcher> impl_;
|
||||
};
|
||||
|
||||
class CV_EXPORTS BestOf2NearestRangeMatcher : public BestOf2NearestMatcher
|
||||
class CV_EXPORTS_W BestOf2NearestRangeMatcher : public BestOf2NearestMatcher
|
||||
{
|
||||
public:
|
||||
BestOf2NearestRangeMatcher(int range_width = 5, bool try_use_gpu = false, float match_conf = 0.3f,
|
||||
CV_WRAP BestOf2NearestRangeMatcher(int range_width = 5, bool try_use_gpu = false, float match_conf = 0.3f,
|
||||
int num_matches_thresh1 = 6, int num_matches_thresh2 = 6);
|
||||
|
||||
void operator ()(const std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
|
||||
@@ -200,7 +219,7 @@ transformation (affine trasformation estimate will be placed in matches_info).
|
||||
|
||||
@sa cv::detail::FeaturesMatcher cv::detail::BestOf2NearestMatcher
|
||||
*/
|
||||
class CV_EXPORTS AffineBestOf2NearestMatcher : public BestOf2NearestMatcher
|
||||
class CV_EXPORTS_W AffineBestOf2NearestMatcher : public BestOf2NearestMatcher
|
||||
{
|
||||
public:
|
||||
/** @brief Constructs a "best of 2 nearest" matcher that expects affine trasformation
|
||||
@@ -215,7 +234,7 @@ public:
|
||||
|
||||
@sa cv::estimateAffine2D cv::estimateAffinePartial2D
|
||||
*/
|
||||
AffineBestOf2NearestMatcher(bool full_affine = false, bool try_use_gpu = false,
|
||||
CV_WRAP AffineBestOf2NearestMatcher(bool full_affine = false, bool try_use_gpu = false,
|
||||
float match_conf = 0.3f, int num_matches_thresh1 = 6) :
|
||||
BestOf2NearestMatcher(try_use_gpu, match_conf, num_matches_thresh1, num_matches_thresh1),
|
||||
full_affine_(full_affine) {}
|
||||
|
||||
@@ -62,7 +62,7 @@ cameras.
|
||||
@note The coordinate system origin is implementation-dependent, but you can always normalize the
|
||||
rotations in respect to the first camera, for instance. :
|
||||
*/
|
||||
class CV_EXPORTS Estimator
|
||||
class CV_EXPORTS_W Estimator
|
||||
{
|
||||
public:
|
||||
virtual ~Estimator() {}
|
||||
@@ -74,10 +74,12 @@ public:
|
||||
@param cameras Estimated camera parameters
|
||||
@return True in case of success, false otherwise
|
||||
*/
|
||||
bool operator ()(const std::vector<ImageFeatures> &features,
|
||||
const std::vector<MatchesInfo> &pairwise_matches,
|
||||
std::vector<CameraParams> &cameras)
|
||||
{ return estimate(features, pairwise_matches, cameras); }
|
||||
CV_WRAP_AS(apply) bool operator ()(const std::vector<ImageFeatures> &features,
|
||||
const std::vector<MatchesInfo> &pairwise_matches,
|
||||
CV_OUT CV_IN_OUT std::vector<CameraParams> &cameras)
|
||||
{
|
||||
return estimate(features, pairwise_matches, cameras);
|
||||
}
|
||||
|
||||
protected:
|
||||
/** @brief This method must implement camera parameters estimation logic in order to make the wrapper
|
||||
@@ -90,15 +92,15 @@ protected:
|
||||
*/
|
||||
virtual bool estimate(const std::vector<ImageFeatures> &features,
|
||||
const std::vector<MatchesInfo> &pairwise_matches,
|
||||
std::vector<CameraParams> &cameras) = 0;
|
||||
CV_OUT std::vector<CameraParams> &cameras) = 0;
|
||||
};
|
||||
|
||||
/** @brief Homography based rotation estimator.
|
||||
*/
|
||||
class CV_EXPORTS HomographyBasedEstimator : public Estimator
|
||||
class CV_EXPORTS_W HomographyBasedEstimator : public Estimator
|
||||
{
|
||||
public:
|
||||
HomographyBasedEstimator(bool is_focals_estimated = false)
|
||||
CV_WRAP HomographyBasedEstimator(bool is_focals_estimated = false)
|
||||
: is_focals_estimated_(is_focals_estimated) {}
|
||||
|
||||
private:
|
||||
@@ -116,7 +118,7 @@ final transformation for each camera.
|
||||
|
||||
@sa cv::detail::HomographyBasedEstimator
|
||||
*/
|
||||
class CV_EXPORTS AffineBasedEstimator : public Estimator
|
||||
class CV_EXPORTS_W AffineBasedEstimator : public Estimator
|
||||
{
|
||||
private:
|
||||
virtual bool estimate(const std::vector<ImageFeatures> &features,
|
||||
@@ -126,21 +128,21 @@ private:
|
||||
|
||||
/** @brief Base class for all camera parameters refinement methods.
|
||||
*/
|
||||
class CV_EXPORTS BundleAdjusterBase : public Estimator
|
||||
class CV_EXPORTS_W BundleAdjusterBase : public Estimator
|
||||
{
|
||||
public:
|
||||
const Mat refinementMask() const { return refinement_mask_.clone(); }
|
||||
void setRefinementMask(const Mat &mask)
|
||||
CV_WRAP const Mat refinementMask() const { return refinement_mask_.clone(); }
|
||||
CV_WRAP void setRefinementMask(const Mat &mask)
|
||||
{
|
||||
CV_Assert(mask.type() == CV_8U && mask.size() == Size(3, 3));
|
||||
refinement_mask_ = mask.clone();
|
||||
}
|
||||
|
||||
double confThresh() const { return conf_thresh_; }
|
||||
void setConfThresh(double conf_thresh) { conf_thresh_ = conf_thresh; }
|
||||
CV_WRAP double confThresh() const { return conf_thresh_; }
|
||||
CV_WRAP void setConfThresh(double conf_thresh) { conf_thresh_ = conf_thresh; }
|
||||
|
||||
TermCriteria termCriteria() { return term_criteria_; }
|
||||
void setTermCriteria(const TermCriteria& term_criteria) { term_criteria_ = term_criteria; }
|
||||
CV_WRAP TermCriteria termCriteria() { return term_criteria_; }
|
||||
CV_WRAP void setTermCriteria(const TermCriteria& term_criteria) { term_criteria_ = term_criteria; }
|
||||
|
||||
protected:
|
||||
/** @brief Construct a bundle adjuster base instance.
|
||||
@@ -214,10 +216,10 @@ protected:
|
||||
|
||||
/** @brief Stub bundle adjuster that does nothing.
|
||||
*/
|
||||
class CV_EXPORTS NoBundleAdjuster : public BundleAdjusterBase
|
||||
class CV_EXPORTS_W NoBundleAdjuster : public BundleAdjusterBase
|
||||
{
|
||||
public:
|
||||
NoBundleAdjuster() : BundleAdjusterBase(0, 0) {}
|
||||
CV_WRAP NoBundleAdjuster() : BundleAdjusterBase(0, 0) {}
|
||||
|
||||
private:
|
||||
bool estimate(const std::vector<ImageFeatures> &, const std::vector<MatchesInfo> &,
|
||||
@@ -238,10 +240,10 @@ error squares
|
||||
It can estimate focal length, aspect ratio, principal point.
|
||||
You can affect only on them via the refinement mask.
|
||||
*/
|
||||
class CV_EXPORTS BundleAdjusterReproj : public BundleAdjusterBase
|
||||
class CV_EXPORTS_W BundleAdjusterReproj : public BundleAdjusterBase
|
||||
{
|
||||
public:
|
||||
BundleAdjusterReproj() : BundleAdjusterBase(7, 2) {}
|
||||
CV_WRAP BundleAdjusterReproj() : BundleAdjusterBase(7, 2) {}
|
||||
|
||||
private:
|
||||
void setUpInitialCameraParams(const std::vector<CameraParams> &cameras) CV_OVERRIDE;
|
||||
@@ -258,10 +260,10 @@ between the rays passing through the camera center and a feature. :
|
||||
|
||||
It can estimate focal length. It ignores the refinement mask for now.
|
||||
*/
|
||||
class CV_EXPORTS BundleAdjusterRay : public BundleAdjusterBase
|
||||
class CV_EXPORTS_W BundleAdjusterRay : public BundleAdjusterBase
|
||||
{
|
||||
public:
|
||||
BundleAdjusterRay() : BundleAdjusterBase(4, 3) {}
|
||||
CV_WRAP BundleAdjusterRay() : BundleAdjusterBase(4, 3) {}
|
||||
|
||||
private:
|
||||
void setUpInitialCameraParams(const std::vector<CameraParams> &cameras) CV_OVERRIDE;
|
||||
@@ -282,10 +284,10 @@ It estimates all transformation parameters. Refinement mask is ignored.
|
||||
|
||||
@sa AffineBasedEstimator AffineBestOf2NearestMatcher BundleAdjusterAffinePartial
|
||||
*/
|
||||
class CV_EXPORTS BundleAdjusterAffine : public BundleAdjusterBase
|
||||
class CV_EXPORTS_W BundleAdjusterAffine : public BundleAdjusterBase
|
||||
{
|
||||
public:
|
||||
BundleAdjusterAffine() : BundleAdjusterBase(6, 2) {}
|
||||
CV_WRAP BundleAdjusterAffine() : BundleAdjusterBase(6, 2) {}
|
||||
|
||||
private:
|
||||
void setUpInitialCameraParams(const std::vector<CameraParams> &cameras) CV_OVERRIDE;
|
||||
@@ -306,10 +308,10 @@ It estimates all transformation parameters. Refinement mask is ignored.
|
||||
|
||||
@sa AffineBasedEstimator AffineBestOf2NearestMatcher BundleAdjusterAffine
|
||||
*/
|
||||
class CV_EXPORTS BundleAdjusterAffinePartial : public BundleAdjusterBase
|
||||
class CV_EXPORTS_W BundleAdjusterAffinePartial : public BundleAdjusterBase
|
||||
{
|
||||
public:
|
||||
BundleAdjusterAffinePartial() : BundleAdjusterBase(4, 2) {}
|
||||
CV_WRAP BundleAdjusterAffinePartial() : BundleAdjusterBase(4, 2) {}
|
||||
|
||||
private:
|
||||
void setUpInitialCameraParams(const std::vector<CameraParams> &cameras) CV_OVERRIDE;
|
||||
@@ -332,17 +334,17 @@ enum WaveCorrectKind
|
||||
@param rmats Camera rotation matrices.
|
||||
@param kind Correction kind, see detail::WaveCorrectKind.
|
||||
*/
|
||||
void CV_EXPORTS waveCorrect(std::vector<Mat> &rmats, WaveCorrectKind kind);
|
||||
void CV_EXPORTS_W waveCorrect(CV_IN_OUT std::vector<Mat> &rmats, WaveCorrectKind kind);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Auxiliary functions
|
||||
|
||||
// Returns matches graph representation in DOT language
|
||||
String CV_EXPORTS matchesGraphAsString(std::vector<String> &pathes, std::vector<MatchesInfo> &pairwise_matches,
|
||||
String CV_EXPORTS_W matchesGraphAsString(std::vector<String> &pathes, std::vector<MatchesInfo> &pairwise_matches,
|
||||
float conf_threshold);
|
||||
|
||||
std::vector<int> CV_EXPORTS leaveBiggestComponent(
|
||||
CV_EXPORTS_W std::vector<int> leaveBiggestComponent(
|
||||
std::vector<ImageFeatures> &features,
|
||||
std::vector<MatchesInfo> &pairwise_matches,
|
||||
float conf_threshold);
|
||||
|
||||
@@ -55,35 +55,37 @@ namespace detail {
|
||||
|
||||
/** @brief Base class for a seam estimator.
|
||||
*/
|
||||
class CV_EXPORTS SeamFinder
|
||||
class CV_EXPORTS_W SeamFinder
|
||||
{
|
||||
public:
|
||||
virtual ~SeamFinder() {}
|
||||
CV_WRAP virtual ~SeamFinder() {}
|
||||
enum { NO, VORONOI_SEAM, DP_SEAM };
|
||||
/** @brief Estimates seams.
|
||||
|
||||
@param src Source images
|
||||
@param corners Source image top-left corners
|
||||
@param masks Source image masks to update
|
||||
*/
|
||||
virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
|
||||
std::vector<UMat> &masks) = 0;
|
||||
CV_WRAP virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
|
||||
CV_IN_OUT std::vector<UMat> &masks) = 0;
|
||||
CV_WRAP static Ptr<SeamFinder> createDefault(int type);
|
||||
};
|
||||
|
||||
/** @brief Stub seam estimator which does nothing.
|
||||
*/
|
||||
class CV_EXPORTS NoSeamFinder : public SeamFinder
|
||||
class CV_EXPORTS_W NoSeamFinder : public SeamFinder
|
||||
{
|
||||
public:
|
||||
void find(const std::vector<UMat>&, const std::vector<Point>&, std::vector<UMat>&) CV_OVERRIDE {}
|
||||
CV_WRAP void find(const std::vector<UMat>&, const std::vector<Point>&, CV_IN_OUT std::vector<UMat>&) CV_OVERRIDE {}
|
||||
};
|
||||
|
||||
/** @brief Base class for all pairwise seam estimators.
|
||||
*/
|
||||
class CV_EXPORTS PairwiseSeamFinder : public SeamFinder
|
||||
class CV_EXPORTS_W PairwiseSeamFinder : public SeamFinder
|
||||
{
|
||||
public:
|
||||
virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
|
||||
std::vector<UMat> &masks) CV_OVERRIDE;
|
||||
CV_WRAP virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
|
||||
CV_IN_OUT std::vector<UMat> &masks) CV_OVERRIDE;
|
||||
|
||||
protected:
|
||||
void run();
|
||||
@@ -103,11 +105,11 @@ protected:
|
||||
|
||||
/** @brief Voronoi diagram-based seam estimator.
|
||||
*/
|
||||
class CV_EXPORTS VoronoiSeamFinder : public PairwiseSeamFinder
|
||||
class CV_EXPORTS_W VoronoiSeamFinder : public PairwiseSeamFinder
|
||||
{
|
||||
public:
|
||||
virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
|
||||
std::vector<UMat> &masks) CV_OVERRIDE;
|
||||
CV_WRAP virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
|
||||
CV_IN_OUT std::vector<UMat> &masks) CV_OVERRIDE;
|
||||
virtual void find(const std::vector<Size> &size, const std::vector<Point> &corners,
|
||||
std::vector<UMat> &masks);
|
||||
private:
|
||||
@@ -115,15 +117,17 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class CV_EXPORTS DpSeamFinder : public SeamFinder
|
||||
class CV_EXPORTS_W DpSeamFinder : public SeamFinder
|
||||
{
|
||||
public:
|
||||
enum CostFunction { COLOR, COLOR_GRAD };
|
||||
|
||||
DpSeamFinder(CostFunction costFunc = COLOR);
|
||||
CV_WRAP DpSeamFinder(String costFunc );
|
||||
|
||||
CostFunction costFunction() const { return costFunc_; }
|
||||
void setCostFunction(CostFunction val) { costFunc_ = val; }
|
||||
CV_WRAP void setCostFunction(String val);
|
||||
|
||||
virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
|
||||
std::vector<UMat> &masks) CV_OVERRIDE;
|
||||
@@ -233,15 +237,17 @@ public:
|
||||
|
||||
/** @brief Minimum graph cut-based seam estimator. See details in @cite V03 .
|
||||
*/
|
||||
class CV_EXPORTS GraphCutSeamFinder : public GraphCutSeamFinderBase, public SeamFinder
|
||||
class CV_EXPORTS_W GraphCutSeamFinder : public GraphCutSeamFinderBase, public SeamFinder
|
||||
{
|
||||
public:
|
||||
GraphCutSeamFinder(int cost_type = COST_COLOR_GRAD, float terminal_cost = 10000.f,
|
||||
float bad_region_penalty = 1000.f);
|
||||
CV_WRAP GraphCutSeamFinder(String cost_type,float terminal_cost = 10000.f,
|
||||
float bad_region_penalty = 1000.f);
|
||||
|
||||
~GraphCutSeamFinder();
|
||||
|
||||
void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
|
||||
CV_WRAP void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
|
||||
std::vector<UMat> &masks) CV_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace detail {
|
||||
|
||||
// Base Timelapser class, takes a sequence of images, applies appropriate shift, stores result in dst_.
|
||||
|
||||
class CV_EXPORTS Timelapser
|
||||
class CV_EXPORTS_W Timelapser
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -62,11 +62,11 @@ public:
|
||||
|
||||
virtual ~Timelapser() {}
|
||||
|
||||
static Ptr<Timelapser> createDefault(int type);
|
||||
CV_WRAP static Ptr<Timelapser> createDefault(int type);
|
||||
|
||||
virtual void initialize(const std::vector<Point> &corners, const std::vector<Size> &sizes);
|
||||
virtual void process(InputArray img, InputArray mask, Point tl);
|
||||
virtual const UMat& getDst() {return dst_;}
|
||||
CV_WRAP virtual void initialize(const std::vector<Point> &corners, const std::vector<Size> &sizes);
|
||||
CV_WRAP virtual void process(InputArray img, InputArray mask, Point tl);
|
||||
CV_WRAP virtual const UMat& getDst() {return dst_;}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -77,7 +77,7 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class CV_EXPORTS TimelapserCrop : public Timelapser
|
||||
class CV_EXPORTS_W TimelapserCrop : public Timelapser
|
||||
{
|
||||
public:
|
||||
virtual void initialize(const std::vector<Point> &corners, const std::vector<Size> &sizes) CV_OVERRIDE;
|
||||
|
||||
@@ -100,16 +100,16 @@ private:
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Auxiliary functions
|
||||
|
||||
CV_EXPORTS bool overlapRoi(Point tl1, Point tl2, Size sz1, Size sz2, Rect &roi);
|
||||
CV_EXPORTS Rect resultRoi(const std::vector<Point> &corners, const std::vector<UMat> &images);
|
||||
CV_EXPORTS Rect resultRoi(const std::vector<Point> &corners, const std::vector<Size> &sizes);
|
||||
CV_EXPORTS Rect resultRoiIntersection(const std::vector<Point> &corners, const std::vector<Size> &sizes);
|
||||
CV_EXPORTS Point resultTl(const std::vector<Point> &corners);
|
||||
CV_EXPORTS_W bool overlapRoi(Point tl1, Point tl2, Size sz1, Size sz2, Rect &roi);
|
||||
CV_EXPORTS_W Rect resultRoi(const std::vector<Point> &corners, const std::vector<UMat> &images);
|
||||
CV_EXPORTS_W Rect resultRoi(const std::vector<Point> &corners, const std::vector<Size> &sizes);
|
||||
CV_EXPORTS_W Rect resultRoiIntersection(const std::vector<Point> &corners, const std::vector<Size> &sizes);
|
||||
CV_EXPORTS_W Point resultTl(const std::vector<Point> &corners);
|
||||
|
||||
// Returns random 'count' element subset of the {0,1,...,size-1} set
|
||||
CV_EXPORTS void selectRandomSubset(int count, int size, std::vector<int> &subset);
|
||||
CV_EXPORTS_W void selectRandomSubset(int count, int size, std::vector<int> &subset);
|
||||
|
||||
CV_EXPORTS int& stitchingLogLevel();
|
||||
CV_EXPORTS_W int& stitchingLogLevel();
|
||||
|
||||
//! @}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
@return Project image top-left corner
|
||||
*/
|
||||
virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
|
||||
OutputArray dst) = 0;
|
||||
CV_OUT OutputArray dst) = 0;
|
||||
|
||||
/** @brief Projects the image backward.
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
@param dst Backward-projected image
|
||||
*/
|
||||
virtual void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
|
||||
Size dst_size, OutputArray dst) = 0;
|
||||
Size dst_size, CV_OUT OutputArray dst) = 0;
|
||||
|
||||
/**
|
||||
@param src_size Source image bounding box
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
|
||||
/** @brief Base class for warping logic implementation.
|
||||
*/
|
||||
struct CV_EXPORTS ProjectorBase
|
||||
struct CV_EXPORTS_W_SIMPLE ProjectorBase
|
||||
{
|
||||
void setCameraParams(InputArray K = Mat::eye(3, 3, CV_32F),
|
||||
InputArray R = Mat::eye(3, 3, CV_32F),
|
||||
@@ -189,13 +189,13 @@ public:
|
||||
Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE;
|
||||
Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R, InputArray T);
|
||||
|
||||
virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap);
|
||||
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE;
|
||||
virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, CV_OUT OutputArray xmap, CV_OUT OutputArray ymap);
|
||||
Rect buildMaps(Size src_size, InputArray K, InputArray R, CV_OUT OutputArray xmap, CV_OUT OutputArray ymap) CV_OVERRIDE;
|
||||
|
||||
Point warp(InputArray src, InputArray K, InputArray R,
|
||||
int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE;
|
||||
int interp_mode, int border_mode, CV_OUT OutputArray dst) CV_OVERRIDE;
|
||||
virtual Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
|
||||
OutputArray dst);
|
||||
CV_OUT OutputArray dst);
|
||||
|
||||
Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE;
|
||||
Rect warpRoi(Size src_size, InputArray K, InputArray R, InputArray T);
|
||||
@@ -220,9 +220,9 @@ public:
|
||||
AffineWarper(float scale = 1.f) : PlaneWarper(scale) {}
|
||||
|
||||
Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) CV_OVERRIDE;
|
||||
Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) CV_OVERRIDE;
|
||||
Rect buildMaps(Size src_size, InputArray K, InputArray R, CV_OUT OutputArray xmap, CV_OUT OutputArray ymap) CV_OVERRIDE;
|
||||
Point warp(InputArray src, InputArray K, InputArray R,
|
||||
int interp_mode, int border_mode, OutputArray dst) CV_OVERRIDE;
|
||||
int interp_mode, int border_mode, CV_OUT OutputArray dst) CV_OVERRIDE;
|
||||
Rect warpRoi(Size src_size, InputArray K, InputArray R) CV_OVERRIDE;
|
||||
|
||||
protected:
|
||||
@@ -233,10 +233,10 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
struct CV_EXPORTS SphericalProjector : ProjectorBase
|
||||
struct CV_EXPORTS_W_SIMPLE SphericalProjector : ProjectorBase
|
||||
{
|
||||
void mapForward(float x, float y, float &u, float &v);
|
||||
void mapBackward(float u, float v, float &x, float &y);
|
||||
CV_WRAP void mapForward(float x, float y, float &u, float &v);
|
||||
CV_WRAP void mapBackward(float u, float v, float &x, float &y);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -44,25 +44,94 @@
|
||||
#define OPENCV_STITCHING_WARPER_CREATORS_HPP
|
||||
|
||||
#include "opencv2/stitching/detail/warpers.hpp"
|
||||
#include <string>
|
||||
|
||||
namespace cv {
|
||||
class CV_EXPORTS_W PyRotationWarper
|
||||
{
|
||||
Ptr<detail::RotationWarper> rw;
|
||||
|
||||
public:
|
||||
CV_WRAP PyRotationWarper(String type, float scale);
|
||||
CV_WRAP PyRotationWarper() {};
|
||||
~PyRotationWarper() {}
|
||||
|
||||
/** @brief Projects the image point.
|
||||
|
||||
@param pt Source point
|
||||
@param K Camera intrinsic parameters
|
||||
@param R Camera rotation matrix
|
||||
@return Projected point
|
||||
*/
|
||||
CV_WRAP Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R);
|
||||
|
||||
/** @brief Builds the projection maps according to the given camera data.
|
||||
|
||||
@param src_size Source image size
|
||||
@param K Camera intrinsic parameters
|
||||
@param R Camera rotation matrix
|
||||
@param xmap Projection map for the x axis
|
||||
@param ymap Projection map for the y axis
|
||||
@return Projected image minimum bounding box
|
||||
*/
|
||||
CV_WRAP Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
|
||||
|
||||
/** @brief Projects the image.
|
||||
|
||||
@param src Source image
|
||||
@param K Camera intrinsic parameters
|
||||
@param R Camera rotation matrix
|
||||
@param interp_mode Interpolation mode
|
||||
@param border_mode Border extrapolation mode
|
||||
@param dst Projected image
|
||||
@return Project image top-left corner
|
||||
*/
|
||||
CV_WRAP Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
|
||||
CV_OUT OutputArray dst);
|
||||
|
||||
/** @brief Projects the image backward.
|
||||
|
||||
@param src Projected image
|
||||
@param K Camera intrinsic parameters
|
||||
@param R Camera rotation matrix
|
||||
@param interp_mode Interpolation mode
|
||||
@param border_mode Border extrapolation mode
|
||||
@param dst_size Backward-projected image size
|
||||
@param dst Backward-projected image
|
||||
*/
|
||||
CV_WRAP void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
|
||||
Size dst_size, CV_OUT OutputArray dst);
|
||||
|
||||
/**
|
||||
@param src_size Source image bounding box
|
||||
@param K Camera intrinsic parameters
|
||||
@param R Camera rotation matrix
|
||||
@return Projected image minimum bounding box
|
||||
*/
|
||||
CV_WRAP Rect warpRoi(Size src_size, InputArray K, InputArray R);
|
||||
|
||||
CV_WRAP float getScale() const { return 1.f; }
|
||||
CV_WRAP void setScale(float) {}
|
||||
};
|
||||
|
||||
//! @addtogroup stitching_warp
|
||||
//! @{
|
||||
|
||||
/** @brief Image warper factories base class.
|
||||
*/
|
||||
class WarperCreator
|
||||
|
||||
class CV_EXPORTS_W WarperCreator
|
||||
{
|
||||
public:
|
||||
virtual ~WarperCreator() {}
|
||||
CV_WRAP virtual ~WarperCreator() {}
|
||||
virtual Ptr<detail::RotationWarper> create(float scale) const = 0;
|
||||
};
|
||||
|
||||
|
||||
/** @brief Plane warper factory class.
|
||||
@sa detail::PlaneWarper
|
||||
*/
|
||||
class PlaneWarper : public WarperCreator
|
||||
class CV_EXPORTS PlaneWarper : public WarperCreator
|
||||
{
|
||||
public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PlaneWarper>(scale); }
|
||||
@@ -71,7 +140,7 @@ public:
|
||||
/** @brief Affine warper factory class.
|
||||
@sa detail::AffineWarper
|
||||
*/
|
||||
class AffineWarper : public WarperCreator
|
||||
class CV_EXPORTS AffineWarper : public WarperCreator
|
||||
{
|
||||
public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::AffineWarper>(scale); }
|
||||
@@ -80,32 +149,32 @@ public:
|
||||
/** @brief Cylindrical warper factory class.
|
||||
@sa detail::CylindricalWarper
|
||||
*/
|
||||
class CylindricalWarper: public WarperCreator
|
||||
class CV_EXPORTS CylindricalWarper: public WarperCreator
|
||||
{
|
||||
public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CylindricalWarper>(scale); }
|
||||
};
|
||||
|
||||
/** @brief Spherical warper factory class */
|
||||
class SphericalWarper: public WarperCreator
|
||||
class CV_EXPORTS SphericalWarper: public WarperCreator
|
||||
{
|
||||
public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::SphericalWarper>(scale); }
|
||||
};
|
||||
|
||||
class FisheyeWarper : public WarperCreator
|
||||
class CV_EXPORTS FisheyeWarper : public WarperCreator
|
||||
{
|
||||
public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::FisheyeWarper>(scale); }
|
||||
};
|
||||
|
||||
class StereographicWarper: public WarperCreator
|
||||
class CV_EXPORTS StereographicWarper: public WarperCreator
|
||||
{
|
||||
public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::StereographicWarper>(scale); }
|
||||
};
|
||||
|
||||
class CompressedRectilinearWarper: public WarperCreator
|
||||
class CV_EXPORTS CompressedRectilinearWarper: public WarperCreator
|
||||
{
|
||||
float a, b;
|
||||
public:
|
||||
@@ -116,7 +185,7 @@ public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CompressedRectilinearWarper>(scale, a, b); }
|
||||
};
|
||||
|
||||
class CompressedRectilinearPortraitWarper: public WarperCreator
|
||||
class CV_EXPORTS CompressedRectilinearPortraitWarper: public WarperCreator
|
||||
{
|
||||
float a, b;
|
||||
public:
|
||||
@@ -127,7 +196,7 @@ public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::CompressedRectilinearPortraitWarper>(scale, a, b); }
|
||||
};
|
||||
|
||||
class PaniniWarper: public WarperCreator
|
||||
class CV_EXPORTS PaniniWarper: public WarperCreator
|
||||
{
|
||||
float a, b;
|
||||
public:
|
||||
@@ -138,7 +207,7 @@ public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PaniniWarper>(scale, a, b); }
|
||||
};
|
||||
|
||||
class PaniniPortraitWarper: public WarperCreator
|
||||
class CV_EXPORTS PaniniPortraitWarper: public WarperCreator
|
||||
{
|
||||
float a, b;
|
||||
public:
|
||||
@@ -149,13 +218,13 @@ public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::PaniniPortraitWarper>(scale, a, b); }
|
||||
};
|
||||
|
||||
class MercatorWarper: public WarperCreator
|
||||
class CV_EXPORTS MercatorWarper: public WarperCreator
|
||||
{
|
||||
public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::MercatorWarper>(scale); }
|
||||
};
|
||||
|
||||
class TransverseMercatorWarper: public WarperCreator
|
||||
class CV_EXPORTS TransverseMercatorWarper: public WarperCreator
|
||||
{
|
||||
public:
|
||||
Ptr<detail::RotationWarper> create(float scale) const CV_OVERRIDE { return makePtr<detail::TransverseMercatorWarper>(scale); }
|
||||
|
||||
Reference in New Issue
Block a user