Started writing the Bridge interface. Mex wrappers now starting to compile for core
This commit is contained in:
@@ -7,8 +7,9 @@
|
||||
/
|
||||
{% macro compose(fun) %}
|
||||
{# ----------- Return type ------------- #}
|
||||
{%- if not fun.rtp|void -%} {{fun.rtp}} retval = {% endif -%}
|
||||
cv::{{fun.name}}(
|
||||
{%- if not fun.rtp|void -%} retval = {% endif -%}
|
||||
{%- if fun.clss -%}inst.{%- else -%} cv:: {% endif -%}
|
||||
{{fun.name}}(
|
||||
{#- ----------- Required ------------- -#}
|
||||
{%- for arg in fun.req -%}
|
||||
{%- if arg.ref == '*' -%}&{%- endif -%}
|
||||
@@ -34,7 +35,7 @@
|
||||
{{arg.tp}} {{arg.name}} = inputs[{{ loop.index0 }}];
|
||||
{% endfor %}
|
||||
{% for opt in fun.opt|inputs %}
|
||||
{{opt.tp}} {{opt.name}} = (nrhs > {{loop.index0 + fun.req|inputs|length}}) ? inputs[{{loop.index0 + fun.req|inputs|length}}] : {{opt.default}};
|
||||
{{opt.tp}} {{opt.name}} = (nrhs > {{loop.index0 + fun.req|inputs|length}}) ? ({{opt.tp}})inputs[{{loop.index0 + fun.req|inputs|length}}] : {{opt.default}};
|
||||
{% endfor %}
|
||||
{# ----------- Outputs ------------ #}
|
||||
{% for arg in fun.req|only|outputs %}
|
||||
@@ -43,6 +44,9 @@
|
||||
{% for opt in fun.opt|only|outputs %}
|
||||
{{opt.tp}} {{opt.name}};
|
||||
{% endfor %}
|
||||
{% if not fun.rtp|void %}
|
||||
{{fun.rtp}} retval;
|
||||
{% endif %}
|
||||
|
||||
// call the opencv function
|
||||
// [out =] namespace.fun(src1, ..., srcn, dst1, ..., dstn, opt1, ..., optn);
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
#include "mex.h"
|
||||
#include "bridge.hpp"
|
||||
#include <vector>
|
||||
//TODO: Standard C++ does not have an unordered_map (only C++11 and Boost)
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include <opencv2/core.hpp>
|
||||
{% block includes %}
|
||||
{% endblock %}
|
||||
using namespace cv;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -25,12 +25,7 @@ typedef std::vector<Bridge> (*)({{clss.name}}&, const std::vector<Bridge>&) Meth
|
||||
{% for function in clss.functions %}
|
||||
// wrapper for {{function.name}}() method
|
||||
std::vector<Bridge> {{function.name}}({{clss.name}}& inst, const std::vector<Bridge>& args) {
|
||||
// setup
|
||||
|
||||
// invoke
|
||||
{{ functional.generate(function) }}
|
||||
|
||||
// setdown
|
||||
}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
% {{clss.name | upper}}
|
||||
% Matlab handle clss for OpenCV object clsses
|
||||
% Matlab handle class for OpenCV object classes
|
||||
%
|
||||
% This file was autogenerated, do not modify.
|
||||
% See LICENCE for full modification and redistribution details.
|
||||
@@ -20,7 +20,7 @@ classdef {{clss.name}} < handle
|
||||
{{clss.name}}Bridge(this.ptr_, 'delete');
|
||||
end
|
||||
|
||||
{% for function in clss.functions -%}
|
||||
{% for function in clss.functions %}
|
||||
% {{function.__str__()}}
|
||||
function varargout = {{function.name}}(this, varargin)
|
||||
[varargout{1:nargout}] = {{clss.name}}Bridge('{{function.name}}', this.ptr_, varargin{:});
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
#include <vector>
|
||||
#include <exception>
|
||||
#include <opencv2/{{includes}}.hpp>
|
||||
{% block includes %}
|
||||
{% endblock %}
|
||||
using namespace cv;
|
||||
|
||||
/*
|
||||
* {{ fun.name }}
|
||||
|
||||
Reference in New Issue
Block a user