diff --git a/modules/matlab/CMakeLists.txt b/modules/matlab/CMakeLists.txt index 3e415e20d..f9f869051 100644 --- a/modules/matlab/CMakeLists.txt +++ b/modules/matlab/CMakeLists.txt @@ -73,8 +73,9 @@ ocv_add_module(matlab BINDINGS opencv_nonfree ) -# set the path to the C++ header parser -set(HDR_PARSER_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../python/src2) +# set the path to the C++ header and doc parser +set(HDR_PARSER_PATH ${CMAKE_SOURCE_DIR}/modules/python/src2) +set(RST_PARSER_PATH ${CMAKE_SOURCE_DIR}/modules/java/generator) # set mex compiler options prepend("-I" MEX_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/modules/matlab/generator/templates/template_function_base.cpp b/modules/matlab/generator/templates/template_function_base.cpp index 5089455df..7a6ad4b07 100644 --- a/modules/matlab/generator/templates/template_function_base.cpp +++ b/modules/matlab/generator/templates/template_function_base.cpp @@ -50,7 +50,7 @@ void mexFunction(int nlhs, mxArray*{% if fun|noutputs %} plhs[]{% else %}*{% end {% if fun|noutputs %} // push the outputs back to matlab - for (size_t n = 0; n < static_cast(nlhs); ++n) { + for (size_t n = 0; n < static_cast(std::max(nlhs,1)); ++n) { plhs[n] = outputs[n].toMxArray().releaseOwnership(); } {% endif %}