aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile153
-rw-r--r--pix_opencv_athreshold.h4
-rw-r--r--pix_opencv_bgstats.h4
-rw-r--r--pix_opencv_bgsubstract.h4
-rw-r--r--pix_opencv_camshift.h4
-rw-r--r--pix_opencv_colorfilt.h4
-rw-r--r--pix_opencv_contours_boundingrect.h5
-rw-r--r--pix_opencv_contours_convexhull.h5
-rw-r--r--pix_opencv_contours_convexity.h5
-rw-r--r--pix_opencv_dft.h4
-rw-r--r--pix_opencv_distrans.h4
-rw-r--r--pix_opencv_edge.h4
-rw-r--r--pix_opencv_floodfill.h4
-rw-r--r--pix_opencv_haarcascade.h4
-rw-r--r--pix_opencv_hist_compare.h5
-rw-r--r--pix_opencv_hough_circles.h4
-rw-r--r--pix_opencv_hough_lines.h4
-rw-r--r--pix_opencv_hu_compare.h5
-rwxr-xr-xpix_opencv_hu_moments.h4
-rw-r--r--pix_opencv_knear.h5
-rw-r--r--pix_opencv_laplace.h5
-rw-r--r--pix_opencv_lk.h4
-rw-r--r--pix_opencv_morphology.h4
-rw-r--r--pix_opencv_motempl.h5
-rw-r--r--pix_opencv_pgh_compare.h5
-rw-r--r--pix_opencv_surf.h4
-rw-r--r--pix_opencv_threshold.h4
27 files changed, 231 insertions, 35 deletions
diff --git a/Makefile b/Makefile
index 3c7039c..25517ee 100644
--- a/Makefile
+++ b/Makefile
@@ -1,54 +1,137 @@
-PD_DIR = /Software/pd-svn/trunk/pd
-GEM_DIR = /usr/local/pd/gem
+# To use this Makefile for your project, first put the name of your library in
+# LIBRARY_NAME variable. The folder for your project should have the same name
+# as your library.
+LIBRARY_NAME = pix_opencv
+LIBRARY_VERSION = 0.2
-GEM_OPENCV_VERSION = 0.2
+# Next, add your source files to the SOURCES variable.
+SOURCES = pix_opencv_edge.cc pix_opencv_laplace.cc pix_opencv_morphology.cc pix_opencv_distrans.cc pix_opencv_motempl.cc pix_opencv_haarcascade.cc pix_opencv_contours_boundingrect.cc pix_opencv_bgsubstract.cc pix_opencv_contours_convexity.cc pix_opencv_dft.cc pix_opencv_lk.cc pix_opencv_hist_compare.cc pix_opencv_knear.cc pix_opencv_threshold.cc pix_opencv_floodfill.cc pix_opencv_athreshold.cc pix_opencv_bgstats.cc pix_opencv_camshift.cc pix_opencv_hu_compare.cc pix_opencv_pgh_compare.cc pix_opencv_hough_circles.cc pix_opencv_hough_lines.cc pix_opencv_hu_moments.cc pix_opencv_contours_convexhull.cc pix_opencv_colorfilt.cc pix_opencv_surf.cc
-# build flags
+# For objects that only build on certain platforms, add those to the SOURCES
+# line for the right platforms.
+SOURCES_Darwin =
+SOURCES_Linux =
+SOURCES_Windows =
-INCLUDES = -I$(PD_DIR)/src -I. -I$(GEM_DIR)/src -I$(PD_DIR)/src
-CPPFLAGS = -fPIC -DPD -O2 -funroll-loops -fomit-frame-pointer -ffast-math \
- -Wall -W -Wno-unused -Wno-parentheses -Wno-switch \
- -DGEM_OPENCV_VERSION=\"$(GEM_OPENCV_VERSION)\" -g
+#------------------------------------------------------------------------------#
+#
+# you shouldn't need to edit anything below here, if we did it right :)
+#
+#------------------------------------------------------------------------------#
+# where Pd lives
+PD_PATH = ../../pd
+GEM_PATH = ../../Gem
+# where to install the library
+objectsdir = $(PD_PATH)/extra
+
+CFLAGS = -DPD -I$(PD_PATH)/src -I$(GEM_PATH)/src -Wall -W -g
+LDFLAGS =
+LIBS =
UNAME := $(shell uname -s)
+ifeq ($(UNAME),Darwin)
+ SOURCES += $(SOURCES_Darwin)
+ EXTENSION = pd_darwin
+ OS = macosx
+ OPT_CFLAGS = -fast
+ FAT_FLAGS = -arch i386 -arch ppc -mmacosx-version-min=10.4
+ CFLAGS += -fPIC -F.
+ LDFLAGS += -bundle -undefined dynamic_lookup -F.
+ LIBS += -lc -framework OpenCV
+ STRIP = strip -x
+ endif
ifeq ($(UNAME),Linux)
- CPPFLAGS += -DLINUX
- INCLUDES += `pkg-config --cflags opencv`
- LDFLAGS = -export_dynamic -shared
- LIBS = `pkg-config --libs opencv`
- EXTENSION = pd_linux
+ SOURCES += $(SOURCES_Linux)
+ EXTENSION = pd_linux
+ OS = linux
+ OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
+ CFLAGS += -fPIC
+ LDFLAGS += -Wl,--export-dynamic -shared -fPIC
+ LIBS += -lc
+ STRIP = strip --strip-unneeded -R .note -R .comment
endif
-ifeq ($(UNAME),Darwin)
- CPPFLAGS += -DDARWIN
- INCLUDES += -I/System/Library/Frameworks/OpenCV.framework/Headers/
- LDFLAGS = -bundle -undefined dynamic_lookup
- LIBS = -lm -framework OpenCV
- EXTENSION = pd_darwin
+ifeq (MINGW,$(findstring MINGW,$(UNAME)))
+ SOURCES += $(SOURCES_Windows)
+ EXTENSION = dll
+ OS = windows
+ OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer -march=i686 -mtune=pentium4
+ WINDOWS_HACKS = -D'O_NONBLOCK=1'
+ CFLAGS += -mms-bitfields $(WINDOWS_HACKS)
+ LDFLAGS += -s -shared -Wl,--enable-auto-import
+ LIBS += -L$(PD_PATH)/src -L$(PD_PATH)/bin -L$(PD_PATH)/obj -lpd -lwsock32 -lkernel32 -luser32 -lgdi32
+ STRIP = strip --strip-unneeded -R .note -R .comment
endif
-.SUFFIXES = $(EXTENSION)
+CFLAGS += $(OPT_CFLAGS)
+
+
+.PHONY = install libdir_install single_install install-doc install-exec clean dist etags
+
+all: $(SOURCES:.cc=.$(EXTENSION))
+
+%.$(EXTENSION): %.cc
+ $(CXX) $(CFLAGS) -o "$*.o" -c "$*.cc"
+ $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS)
+ chmod a-x "$*.$(EXTENSION)"
+ rm -f -- $*.o
+
-SOURCES = pix_opencv_edge.cc pix_opencv_laplace.cc pix_opencv_morphology.cc pix_opencv_distrans.cc pix_opencv_motempl.cc pix_opencv_haarcascade.cc pix_opencv_contours_boundingrect.cc pix_opencv_bgsubstract.cc pix_opencv_contours_convexity.cc pix_opencv_dft.cc pix_opencv_lk.cc pix_opencv_hist_compare.cc pix_opencv_knear.cc pix_opencv_threshold.cc pix_opencv_floodfill.cc pix_opencv_athreshold.cc pix_opencv_bgstats.cc pix_opencv_camshift.cc pix_opencv_hu_compare.cc pix_opencv_pgh_compare.cc pix_opencv_hough_circles.cc pix_opencv_hough_lines.cc pix_opencv_hu_moments.cc pix_opencv_contours_convexhull.cc pix_opencv_colorfilt.cc
-SOURCES_OPT = pix_opencv_surf.cc
+install: libdir_install
-all: $(SOURCES:.cc=.$(EXTENSION)) $(SOURCES_OPT:.cc=.$(EXTENSION))
+# The meta and help files are explicitly installed to make sure they are
+# actually there. Those files are not optional, then need to be there.
+libdir_install: $(SOURCES:.cc=.$(EXTENSION)) install-doc install-exec
+ install -d $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p $(LIBRARY_NAME)-meta.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ $(STRIP) $(addprefix $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/,$(SOURCES:.cc=.$(EXTENSION)))
-%.$(EXTENSION): %.o
- gcc $(LDFLAGS) -o $*.$(EXTENSION) $*.o $(LIBS)
+# install library linked as single binary
+single_install: $(LIBRARY_NAME) install-doc install-exec
+ install -d $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION)
-.cc.o:
- g++ $(CPPFLAGS) $(INCLUDES) -o $*.o -c $*.cc
+install-doc:
+ install -d $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+# install -m644 -p $(SOURCES:.c=-help.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p $(wildcard *.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p README $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt
+ install -m644 -p VERSION $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/VERSION.txt
+ install -m644 -p CHANGES $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/CHANGES.txt
-.c.o:
- gcc $(CPPFLAGS) $(INCLUDES) -o $*.o -c $*.c
+install-exec:
+ install -d $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p $(wildcard *.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
-install:
- cp -f --remove-destination *.pd $(PD_DIR)/doc/5.reference
clean:
- rm -f pix_opencv*.o
- rm -f pix_opencv*.$(EXTENSION)
+ -rm -f -- $(SOURCES:.cc=.o)
+ -rm -f -- $(SOURCES:.cc=.$(EXTENSION))
+ -rm -f -- $(LIBRARY_NAME).$(EXTENSION)
+
+distclean: clean
+ -rm -f -- ../$(LIBRARY_NAME)-$(OS)-$(shell uname -m).tar.bz2
+ -rm -f -- ../$(LIBRARY_NAME)-$(OS).tar.bz2
+
+dist: all dist_$(OS)
+
+dist_linux:
+ cd .. && tar --exclude=.svn -cjpf $(LIBRARY_NAME)-$(OS)-$(shell uname -m).tar.bz2 $(LIBRARY_NAME)
+
+dist_macosx:
+ cd .. && tar --exclude=.svn -cjpf $(LIBRARY_NAME)-$(OS).tar.bz2 $(LIBRARY_NAME)
+
+dist_windows:
+ cd .. && tar --exclude=.svn -cjpf $(LIBRARY_NAME)-$(OS).tar.bz2 $(LIBRARY_NAME)
+
+
+etags:
+ etags *.[ch] ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h
-distro: clean all
- rm *.o
+showpaths:
+ @echo "PD_PATH: $(PD_PATH)"
+ @echo "objectsdir: $(objectsdir)"
+ @echo "LIBRARY_NAME: $(LIBRARY_NAME)"
+ @echo "SOURCES: $(SOURCES)"
diff --git a/pix_opencv_athreshold.h b/pix_opencv_athreshold.h
index 071449c..4ced0e4 100644
--- a/pix_opencv_athreshold.h
+++ b/pix_opencv_athreshold.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_bgstats.h b/pix_opencv_bgstats.h
index 01935d1..56e7157 100644
--- a/pix_opencv_bgstats.h
+++ b/pix_opencv_bgstats.h
@@ -19,9 +19,13 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#include "cvaux.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_bgsubstract.h b/pix_opencv_bgsubstract.h
index 8d12a91..90c24ad 100644
--- a/pix_opencv_bgsubstract.h
+++ b/pix_opencv_bgsubstract.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_camshift.h b/pix_opencv_camshift.h
index 5ec988e..5b23fcd 100644
--- a/pix_opencv_camshift.h
+++ b/pix_opencv_camshift.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
#define MAX_MARKERS 500
const int MAX_COUNT = 500;
diff --git a/pix_opencv_colorfilt.h b/pix_opencv_colorfilt.h
index b3a3949..8881c21 100644
--- a/pix_opencv_colorfilt.h
+++ b/pix_opencv_colorfilt.h
@@ -21,8 +21,12 @@ LOG
#include <stdio.h>
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_contours_boundingrect.h b/pix_opencv_contours_boundingrect.h
index 0c23402..f89790e 100644
--- a/pix_opencv_contours_boundingrect.h
+++ b/pix_opencv_contours_boundingrect.h
@@ -19,8 +19,13 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#include <OpenCV/cvcompat.h>
+#else
#include "cv.h"
#endif
+#endif
#define MAX_MARKERS 100
diff --git a/pix_opencv_contours_convexhull.h b/pix_opencv_contours_convexhull.h
index 494136f..06f076a 100644
--- a/pix_opencv_contours_convexhull.h
+++ b/pix_opencv_contours_convexhull.h
@@ -19,8 +19,13 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#include <OpenCV/cvcompat.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_contours_convexity.h b/pix_opencv_contours_convexity.h
index 045cb96..bb6b85a 100644
--- a/pix_opencv_contours_convexity.h
+++ b/pix_opencv_contours_convexity.h
@@ -19,8 +19,13 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#include <OpenCV/cvcompat.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_dft.h b/pix_opencv_dft.h
index 6af0a5e..84f4330 100644
--- a/pix_opencv_dft.h
+++ b/pix_opencv_dft.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_distrans.h b/pix_opencv_distrans.h
index ef283ff..34e5662 100644
--- a/pix_opencv_distrans.h
+++ b/pix_opencv_distrans.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_edge.h b/pix_opencv_edge.h
index e67de6c..341c597 100644
--- a/pix_opencv_edge.h
+++ b/pix_opencv_edge.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_floodfill.h b/pix_opencv_floodfill.h
index 380730a..be3fa61 100644
--- a/pix_opencv_floodfill.h
+++ b/pix_opencv_floodfill.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
#define MAX_COMPONENTS 10
diff --git a/pix_opencv_haarcascade.h b/pix_opencv_haarcascade.h
index ecdc92e..f47c388 100644
--- a/pix_opencv_haarcascade.h
+++ b/pix_opencv_haarcascade.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
#define MAX_MARKERS 50
diff --git a/pix_opencv_hist_compare.h b/pix_opencv_hist_compare.h
index 987dff3..993bd81 100644
--- a/pix_opencv_hist_compare.h
+++ b/pix_opencv_hist_compare.h
@@ -19,8 +19,13 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#include <OpenCV/cvcompat.h>
+#else
#include "cv.h"
#endif
+#endif
#define MAX_HISTOGRAMS_TO_COMPARE 80
diff --git a/pix_opencv_hough_circles.h b/pix_opencv_hough_circles.h
index 9c2a63b..71eb9c9 100644
--- a/pix_opencv_hough_circles.h
+++ b/pix_opencv_hough_circles.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
#define MAX_HISTOGRAMS_TO_COMPARE 80
diff --git a/pix_opencv_hough_lines.h b/pix_opencv_hough_lines.h
index a0aaef4..a685925 100644
--- a/pix_opencv_hough_lines.h
+++ b/pix_opencv_hough_lines.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
#define MAX_HISTOGRAMS_TO_COMPARE 80
diff --git a/pix_opencv_hu_compare.h b/pix_opencv_hu_compare.h
index f083a22..9b0c463 100644
--- a/pix_opencv_hu_compare.h
+++ b/pix_opencv_hu_compare.h
@@ -19,8 +19,13 @@ LOG
#include "Base/GemPixDualObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#include <OpenCV/cvcompat.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
CLASS
diff --git a/pix_opencv_hu_moments.h b/pix_opencv_hu_moments.h
index 20c031c..18d9c09 100755
--- a/pix_opencv_hu_moments.h
+++ b/pix_opencv_hu_moments.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_knear.h b/pix_opencv_knear.h
index faa9483..27b4cf8 100644
--- a/pix_opencv_knear.h
+++ b/pix_opencv_knear.h
@@ -19,10 +19,15 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#include <OpenCV/cvcompat.h>
+#else
#include "cv.h"
#include "highgui.h"
#include "ml.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_laplace.h b/pix_opencv_laplace.h
index 674126b..aa6f0c4 100644
--- a/pix_opencv_laplace.h
+++ b/pix_opencv_laplace.h
@@ -19,8 +19,13 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#include <OpenCV/cvcompat.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_lk.h b/pix_opencv_lk.h
index f60fa63..0d2e5d0 100644
--- a/pix_opencv_lk.h
+++ b/pix_opencv_lk.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
#define MAX_MARKERS 500
const int MAX_COUNT = 500;
diff --git a/pix_opencv_morphology.h b/pix_opencv_morphology.h
index be1e143..9c8b6d4 100644
--- a/pix_opencv_morphology.h
+++ b/pix_opencv_morphology.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
diff --git a/pix_opencv_motempl.h b/pix_opencv_motempl.h
index 8a8e0b5..307a230 100644
--- a/pix_opencv_motempl.h
+++ b/pix_opencv_motempl.h
@@ -19,7 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#include <OpenCV/cvcompat.h>
+#else
#include "cv.h"
+#endif
#include <time.h>
#include <math.h>
#include <ctype.h>
diff --git a/pix_opencv_pgh_compare.h b/pix_opencv_pgh_compare.h
index 94e9c78..1f62ce1 100644
--- a/pix_opencv_pgh_compare.h
+++ b/pix_opencv_pgh_compare.h
@@ -19,8 +19,13 @@ LOG
#include "Base/GemPixDualObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#include <OpenCV/cvcompat.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
CLASS
diff --git a/pix_opencv_surf.h b/pix_opencv_surf.h
index e551d70..7341ecb 100644
--- a/pix_opencv_surf.h
+++ b/pix_opencv_surf.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
#define MAX_MARKERS 500
#define DSCSIZE 128
diff --git a/pix_opencv_threshold.h b/pix_opencv_threshold.h
index 018002b..4d5fd10 100644
--- a/pix_opencv_threshold.h
+++ b/pix_opencv_threshold.h
@@ -19,8 +19,12 @@ LOG
#include "Base/GemPixObj.h"
#ifndef _EiC
+#ifdef __APPLE__
+#include <OpenCV/OpenCV.h>
+#else
#include "cv.h"
#endif
+#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------