Commit d6453cf0 authored by hbristow's avatar hbristow

Now builds all functions except those dependent on Features2d. Improved build…

Now builds all functions except those dependent on Features2d. Improved build detection if cmake is rerun
parent 245bc5dc
......@@ -44,10 +44,10 @@ set(the_description "The Matlab/Octave bindings")
ocv_add_module(matlab BINDINGS #TODO: does it actually NEED to depend on core?
OPTIONAL opencv_core
opencv_imgproc opencv_ml opencv_highgui
#opencv_objdetect opencv_features2d
opencv_objdetect #opencv_features2d TODO: Re-enable when Flann is in a compliant state
opencv_video opencv_photo
#opencv_calib opencv_calib3d
#opencv_nonfree
opencv_nonfree
)
# TODO: Undo this when building all modules to find python properly
......@@ -143,6 +143,7 @@ set(MEX_WORKS True CACHE BOOL ADVANCED)
# (which do the real work) only when they're outdated
set(GENERATE_PROXY ${CMAKE_CURRENT_BINARY_DIR}/generate.proxy)
set(COMPILE_PROXY ${CMAKE_CURRENT_BINARY_DIR}/compile.proxy)
file(REMOVE ${GENERATE_PROXY} ${COMPILE_PROXY})
# generate
# call the python executable to generate the Matlab gateways
......
......@@ -44,10 +44,11 @@ def noutputs(args):
return len(outputs(args))
def convertibleToInt(string):
salt = '1+'
try:
int(string)
exec(salt+string)
return True
except ValueError:
except:
return False
def capitalizeFirst(text):
......
......@@ -13,10 +13,8 @@ class MatlabWrapperGenerator(object):
ns[name] = parser.parse(file)
# cleanify the parser output
print ns['ml']
parse_tree = ParseTree()
parse_tree.build(ns)
print parse_tree
# setup the template engine
jtemplate = Environment(loader=PackageLoader('templates', ''), trim_blocks=True, lstrip_blocks=True)
......
......@@ -51,6 +51,13 @@ class Translator(object):
# classes have 'class' prefixed on their name
if 'class' in defn[0].split(' ') or 'struct' in defn[0].split(' '):
return self.translateClass(defn)
# --- operators! ---
#TODO: implement operators: http://www.mathworks.com.au/help/matlab/matlab_oop/implementing-operators-for-your-class.html
if 'operator' in defn[0]:
return self.translateFunction(defn)
# --- constant ---
elif convertibleToInt(defn[1]):
return self.translateConstant(defn)
# --- function ---
# functions either need to have input arguments, or not uppercase names
elif defn[3] or not self.translateName(defn[0]).split('_')[0].isupper():
......
......@@ -14,7 +14,9 @@ typedef std::vector<cv::Mat> vector_Mat;
typedef std::vector<cv::Point> vector_Point;
typedef std::vector<int> vector_int;
typedef std::vector<float> vector_float;
typedef std::vector<cv::String> vector_String;
typedef std::vector<unsigned char> vector_uchar;
typedef std::vector<cv::Rect> vector_Rect;
void conditionalError(bool expr, const std::string& str) {
......@@ -134,6 +136,16 @@ public:
vector_float toVectorFloat() { return vector_float(); }
operator vector_float() { return toVectorFloat(); }
// --------------------------- vector_Rect ----------------------------------
Bridge& operator=(const vector_Rect& obj) { return *this; }
vector_Rect toVectorRect() { return vector_Rect(); }
operator vector_Rect() { return toVectorRect(); }
// --------------------------- vector_String ----------------------------------
Bridge& operator=(const vector_String& obj) { return *this; }
vector_String toVectorString() { return vector_String(); }
operator vector_String() { return toVectorString(); }
// --------------------------- string --------------------------------------
Bridge& operator=(const std::string& obj) { return *this; }
std::string toString() { return ""; }
......
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