aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Villeret <avilleret@users.sourceforge.net>2013-01-10 12:16:41 +0000
committerAntoine Villeret <avilleret@users.sourceforge.net>2013-01-10 12:16:41 +0000
commit997720d18c09050619b00b652e18075a6f065f51 (patch)
tree2ae24c2dbda9fdb32849e20982246b4c9bf1b3a7
parent59eabc4c7f04473efcfd305b213d78c57a2de26b (diff)
- update build instructions
- add contour length to infos output of pix_opencv_contours svn path=/trunk/externals/pix_opencv/; revision=16850
-rw-r--r--README.txt86
-rw-r--r--pix_opencv_contours.cc5
2 files changed, 24 insertions, 67 deletions
diff --git a/README.txt b/README.txt
index 3fd8108..bdeda2a 100644
--- a/README.txt
+++ b/README.txt
@@ -1,86 +1,42 @@
-updated for Linux on 2012-09-12
-
+updated for Linux on 03/01/2013
get the source version through svn :
svn co https://pure-data.svn.sourceforge.net/svnroot/pure-data pure-data
cd pure-data/trunk/externals/pix_opencv
+you need a working build toolchain
+
pix_opencv depends on OpenCV 2.x and >1.5 (for old externals)
===== GNU/Linux =====
-(actually only tested in GNU/Linux Ubuntu)
-this new version requiered OpenCV 2.3, available with apt-get since 12.04 :
-
+# (actually only tested in GNU/Linux Ubuntu)
+# this new version requiered OpenCV 2.3, available with apt-get since 12.04 :
apt-get install libopencv-dev libcv-dev libhighgui-dev
-for other systems, you must build the lib from source, see this :
-http://opencv.willowgarage.com/wiki/InstallGuide
-
-get the _SOURCES_ of the pd you are using
-and of the GEM that you are loading
-( it might not work if the version
-is different )
-
-cd into the package folder :
-
- cd pix_opencv
-
-configure the package with the appropriate command for your system :
-
- ./configure --with-pd=<path to pd _sources_> --with-gem=<path to gem _sources_>
-
-for example :
-
-./configure --with-pd=/usr/local/pd --with-gem=/usr/local/pd/gem
-
-then, compile it :
+# for other systems, you can build the lib from source, see this :
+# http://opencv.willowgarage.com/wiki/InstallGuide
-make clean
-make
+# get the source :
+svn co https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/externals/pix_opencv pix_opencv
-and put the *.pd_linux and *.pd files somewhere in Pd's path. You can add the
-current directory to the pd search path through Media->Preferences->Path
+cd pix_opencv
+make
+# To use the binaries you can either put them into the same folder as your patch or to add this folder to the search paths of Pd
===== MAC OSX (intel and powerPC) =====
+# install opencv with fink :
+fink install opencv-dev
-first install openCV MacOS framework
- download openCV private framework from http://www.ient.rwth-aachen.de/cms/software/opencv/
- copy the provided OpenCV.framework folder in your /Library/Frameworks/ directory ::
- cp -Rf /Volumes/OpenCV\ Private\ Framework/OpenCV.framework /Library/Frameworks/
-this will only install OpenCV 1.5
-
-you need OpenCV 2.x to use recent pix_opencv externals
-you will find a step by step how to install it on Mac OSX here :
-http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port
-but this document is quite old...
-
-get the _SOURCES_ of the pd you are using
-and of the GEM that you are loading
-( it might not work if the version
-is different )
-
-cd into the package folder ::
-
- cd pix_opencv
-
-configure the package with the appropriate command for your system :
-
- ./configure --with-pd=<path to pd _sources_> --with-gem=<path to gem _sources_>
-
-for example :
-
-./configure --with-pd=/usr/local/pd --with-gem=/usr/local/pd/gem
-
-then, compile it ::
-
- make clean
- make
-
-and copy the .pd_darwin to your externals folder ::
+# if you don't have fink, you can build it from source by following this guide :
+# http://opencv.willowgarage.com/wiki/InstallGuide
- cp *.pd_darwin /Applications/Pd-0.40.3-extended-20080315.app/Contents/Resources/extra/Gem/ for example
+# then get the sources and compile :
+svn co https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/externals/pix_opencv pix_opencv
+cd pix_opencv
+make PD_PATH=/path/to/pdextended-app/Contents/Resources/
+# PD_PATH should be ended by something like that : Pd-0.43.4-extended-20121231.app/Contents/Resources/
diff --git a/pix_opencv_contours.cc b/pix_opencv_contours.cc
index 6032d1b..d8f162d 100644
--- a/pix_opencv_contours.cc
+++ b/pix_opencv_contours.cc
@@ -149,7 +149,7 @@ void pix_opencv_contours :: processGrayImage(imageStruct &image)
t_atom*info;
info = new t_atom[(int) m_contours.size()*20+2];
// info : 20x(contour_nb) matrix
- // info for each contour : area, rotrect corner (8 float), rotrect center, rotrect size, rotation angle, segments number, other are reserved for future use
+ // info for each contour : area, rotrect corner (8 float), rotrect center, rotrect size, rotation angle, number of segments, length of contour, other are reserved for future use
int count(0);
SETFLOAT(info+1, 20.);
int info_offset(2);
@@ -162,6 +162,7 @@ void pix_opencv_contours :: processGrayImage(imageStruct &image)
cv::RotatedRect rot_rect = cv::minAreaRect(m_contours[i]);
cv::Point2f corners[4];
rot_rect.points(corners);
+ double length = cv::arcLength(m_contours[i],true);
for (int j=0;j<4;j++) {
SETFLOAT(info+info_offset+j*2+1, corners[j].x/image.xsize);
SETFLOAT(info+info_offset+j*2+2, corners[j].y/image.ysize);
@@ -173,7 +174,7 @@ void pix_opencv_contours :: processGrayImage(imageStruct &image)
SETFLOAT(info+info_offset+12, rot_rect.size.height/image.xsize);
SETFLOAT(info+info_offset+13, rot_rect.angle);
SETFLOAT(info+info_offset+14, m_contours[i].size()); // number of points in segment
- SETFLOAT(info+info_offset+15, 0);
+ SETFLOAT(info+info_offset+15, (float) length);
SETFLOAT(info+info_offset+16, 0);
SETFLOAT(info+info_offset+17, 0);
SETFLOAT(info+info_offset+18, 0);