Commit c68ffec6 authored by Patrik Huber's avatar Patrik Huber

Changed mexFunction call to MEX_DISPATCH

This enables defining multiple functions per Matlab mex module
parent 71d5dc07
function [texturemap] = extract_texture(mesh, rendering_params, image, ... function [ texturemap ] = extract_texture(mesh, rendering_params, image, ...
compute_view_angle, isomap_resolution) compute_view_angle, isomap_resolution)
% EXTRACT_TEXTURE Extracts the texture from an image and returns the texture map. % EXTRACT_TEXTURE Extracts the texture from an image and returns the texture map.
% [ texturemap ] = EXTRACT_TEXTURE(mesh, rendering_params, image, ... % [ texturemap ] = EXTRACT_TEXTURE(mesh, rendering_params, image, ...
...@@ -18,6 +18,6 @@ function [texturemap] = extract_texture(mesh, rendering_params, image, ... ...@@ -18,6 +18,6 @@ function [texturemap] = extract_texture(mesh, rendering_params, image, ...
if (~exist('compute_view_angle', 'var')), compute_view_angle = false; end if (~exist('compute_view_angle', 'var')), compute_view_angle = false; end
if (~exist('isomap_resolution', 'var')), isomap_resolution = 512; end if (~exist('isomap_resolution', 'var')), isomap_resolution = 512; end
[ texturemap ] = render(mesh, rendering_params, image, compute_view_angle, isomap_resolution); [ texturemap ] = render('extract_texture', mesh, rendering_params, image, compute_view_angle, isomap_resolution);
end end
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "mexplus_eos_types.hpp" #include "mexplus_eos_types.hpp"
#include "mexplus.h" #include "mexplus.h"
#include "mexplus/dispatch.h"
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
...@@ -33,7 +34,7 @@ ...@@ -33,7 +34,7 @@
using namespace eos; using namespace eos;
using namespace mexplus; using namespace mexplus;
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) MEX_DEFINE(extract_texture) (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{ {
// Check for proper number of input and output arguments: // Check for proper number of input and output arguments:
if (nrhs != 5) { if (nrhs != 5) {
...@@ -63,3 +64,5 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) ...@@ -63,3 +64,5 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
OutputArguments output(nlhs, plhs, 1); OutputArguments output(nlhs, plhs, 1);
output.set(0, isomap); output.set(0, isomap);
}; };
MEX_DISPATCH;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment