From 4889ec5cdf940855605f271a00e6c053102e595b Mon Sep 17 00:00:00 2001 From: berak Date: Mon, 2 May 2016 09:55:55 +0200 Subject: [PATCH] structured_light: python / java bindings --- modules/structured_light/CMakeLists.txt | 2 +- .../opencv2/structured_light/graycodepattern.hpp | 11 ++++++----- modules/structured_light/src/graycodepattern.cpp | 10 ++++++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/modules/structured_light/CMakeLists.txt b/modules/structured_light/CMakeLists.txt index 66bcc2756..de3a07382 100644 --- a/modules/structured_light/CMakeLists.txt +++ b/modules/structured_light/CMakeLists.txt @@ -1,2 +1,2 @@ set(the_description "Structured Light API") -ocv_define_module(structured_light opencv_core opencv_calib3d opencv_imgproc opencv_highgui opencv_features2d opencv_rgbd OPTIONAL opencv_viz) +ocv_define_module(structured_light opencv_core opencv_calib3d opencv_imgproc opencv_highgui opencv_features2d opencv_rgbd OPTIONAL opencv_viz WRAP python java) diff --git a/modules/structured_light/include/opencv2/structured_light/graycodepattern.hpp b/modules/structured_light/include/opencv2/structured_light/graycodepattern.hpp index cf01f70d3..55b39af0f 100644 --- a/modules/structured_light/include/opencv2/structured_light/graycodepattern.hpp +++ b/modules/structured_light/include/opencv2/structured_light/graycodepattern.hpp @@ -43,6 +43,7 @@ #define __OPENCV_GRAY_CODE_PATTERN_HPP__ #include "opencv2/core.hpp" +#include "opencv2/structured_light/structured_light.hpp" namespace cv { namespace structured_light { @@ -72,22 +73,22 @@ class CV_EXPORTS_W GrayCodePattern : public StructuredLightPattern * @param width Projector's width. Default value is 1024. * @param height Projector's height. Default value is 768. */ - struct CV_EXPORTS_W_SIMPLE Params + struct CV_EXPORTS Params { - CV_WRAP Params(); - CV_PROP_RW int width; - CV_PROP_RW int height; }; /** @brief Constructor @param parameters GrayCodePattern parameters GrayCodePattern::Params: the width and the height of the projector. */ - CV_WRAP static Ptr create( const GrayCodePattern::Params ¶meters = GrayCodePattern::Params() ); + // alias for scripting + CV_WRAP + static Ptr create( int width, int height ); + /** @brief Get the number of pattern images needed for the graycode pattern. * * @return The number of pattern images needed for the graycode pattern. diff --git a/modules/structured_light/src/graycodepattern.cpp b/modules/structured_light/src/graycodepattern.cpp index d3df7aa2a..ff56a027d 100644 --- a/modules/structured_light/src/graycodepattern.cpp +++ b/modules/structured_light/src/graycodepattern.cpp @@ -471,5 +471,15 @@ Ptr GrayCodePattern::create( const GrayCodePattern::Params& par return makePtr( params ); } +// Creates the GrayCodePattern instance +// alias for scripting +Ptr GrayCodePattern::create( int width, int height ) +{ + Params params; + params.width = width; + params.height = height; + return makePtr( params ); +} + } }