Now builds all functions except those dependent on Features2d. Improved build detection if cmake is rerun

pull/1384/head
hbristow 12 years ago
parent 245bc5dcc0
commit d6453cf051
  1. 5
      modules/matlab/CMakeLists.txt
  2. 5
      modules/matlab/generator/filters.py
  3. 2
      modules/matlab/generator/gen_matlab.py
  4. 7
      modules/matlab/generator/parse_tree.py
  5. 12
      modules/matlab/include/bridge.hpp

@ -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? ocv_add_module(matlab BINDINGS #TODO: does it actually NEED to depend on core?
OPTIONAL opencv_core OPTIONAL opencv_core
opencv_imgproc opencv_ml opencv_highgui 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_video opencv_photo
#opencv_calib opencv_calib3d #opencv_calib opencv_calib3d
#opencv_nonfree opencv_nonfree
) )
# TODO: Undo this when building all modules to find python properly # 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 # (which do the real work) only when they're outdated
set(GENERATE_PROXY ${CMAKE_CURRENT_BINARY_DIR}/generate.proxy) set(GENERATE_PROXY ${CMAKE_CURRENT_BINARY_DIR}/generate.proxy)
set(COMPILE_PROXY ${CMAKE_CURRENT_BINARY_DIR}/compile.proxy) set(COMPILE_PROXY ${CMAKE_CURRENT_BINARY_DIR}/compile.proxy)
file(REMOVE ${GENERATE_PROXY} ${COMPILE_PROXY})
# generate # generate
# call the python executable to generate the Matlab gateways # call the python executable to generate the Matlab gateways

@ -44,10 +44,11 @@ def noutputs(args):
return len(outputs(args)) return len(outputs(args))
def convertibleToInt(string): def convertibleToInt(string):
salt = '1+'
try: try:
int(string) exec(salt+string)
return True return True
except ValueError: except:
return False return False
def capitalizeFirst(text): def capitalizeFirst(text):

@ -13,10 +13,8 @@ class MatlabWrapperGenerator(object):
ns[name] = parser.parse(file) ns[name] = parser.parse(file)
# cleanify the parser output # cleanify the parser output
print ns['ml']
parse_tree = ParseTree() parse_tree = ParseTree()
parse_tree.build(ns) parse_tree.build(ns)
print parse_tree
# setup the template engine # setup the template engine
jtemplate = Environment(loader=PackageLoader('templates', ''), trim_blocks=True, lstrip_blocks=True) 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 # classes have 'class' prefixed on their name
if 'class' in defn[0].split(' ') or 'struct' in defn[0].split(' '): if 'class' in defn[0].split(' ') or 'struct' in defn[0].split(' '):
return self.translateClass(defn) 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 --- # --- function ---
# functions either need to have input arguments, or not uppercase names # functions either need to have input arguments, or not uppercase names
elif defn[3] or not self.translateName(defn[0]).split('_')[0].isupper(): 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<cv::Point> vector_Point;
typedef std::vector<int> vector_int; typedef std::vector<int> vector_int;
typedef std::vector<float> vector_float; typedef std::vector<float> vector_float;
typedef std::vector<cv::String> vector_String;
typedef std::vector<unsigned char> vector_uchar; typedef std::vector<unsigned char> vector_uchar;
typedef std::vector<cv::Rect> vector_Rect;
void conditionalError(bool expr, const std::string& str) { void conditionalError(bool expr, const std::string& str) {
@ -134,6 +136,16 @@ public:
vector_float toVectorFloat() { return vector_float(); } vector_float toVectorFloat() { return vector_float(); }
operator vector_float() { return toVectorFloat(); } 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 -------------------------------------- // --------------------------- string --------------------------------------
Bridge& operator=(const std::string& obj) { return *this; } Bridge& operator=(const std::string& obj) { return *this; }
std::string toString() { return ""; } std::string toString() { return ""; }

Loading…
Cancel
Save