diff options
author | lluÃs gómez i bigordà <lluisbigorda@users.sourceforge.net> | 2008-05-25 23:07:29 +0000 |
---|---|---|
committer | lluÃs gómez i bigordà <lluisbigorda@users.sourceforge.net> | 2008-05-25 23:07:29 +0000 |
commit | e78c5f1d5c4ad638c66163a9c57737a8634556e6 (patch) | |
tree | b67e3b7e936ec22d5d0499436990e28c616598f6 | |
parent | 7b555924a46e83b194e5fab92fc6d6e564d6a5ab (diff) |
changed extensions cpp to cc for autobuilds
svn path=/trunk/externals/pix_opencv/; revision=9916
-rw-r--r-- | pix_opencv_bgsubstract.cc (renamed from pix_opencv_bgsubstract.cpp) | 0 | ||||
-rw-r--r-- | pix_opencv_contours_boundingrect.cc (renamed from pix_opencv_contours_boundingrect.cpp) | 0 | ||||
-rw-r--r-- | pix_opencv_contours_convexity.cc (renamed from pix_opencv_contours_convexity.cpp) | 0 | ||||
-rw-r--r-- | pix_opencv_distrans.cc (renamed from pix_opencv_distrans.cpp) | 0 | ||||
-rw-r--r-- | pix_opencv_edge.cc (renamed from pix_opencv_edge.cpp) | 0 | ||||
-rw-r--r-- | pix_opencv_haarcascade.cc (renamed from pix_opencv_haarcascade.cpp) | 0 | ||||
-rw-r--r-- | pix_opencv_laplace.cc (renamed from pix_opencv_laplace.cpp) | 0 | ||||
-rw-r--r-- | pix_opencv_morphology.cc (renamed from pix_opencv_morphology.cpp) | 0 | ||||
-rw-r--r-- | pix_opencv_motempl.cc (renamed from pix_opencv_motempl.cpp) | 0 | ||||
-rw-r--r-- | pix_opencv_threshold.cpp | 266 | ||||
-rw-r--r-- | pix_opencv_threshold.h | 87 |
11 files changed, 0 insertions, 353 deletions
diff --git a/pix_opencv_bgsubstract.cpp b/pix_opencv_bgsubstract.cc index 1daa4ef..1daa4ef 100644 --- a/pix_opencv_bgsubstract.cpp +++ b/pix_opencv_bgsubstract.cc diff --git a/pix_opencv_contours_boundingrect.cpp b/pix_opencv_contours_boundingrect.cc index c6ebd94..c6ebd94 100644 --- a/pix_opencv_contours_boundingrect.cpp +++ b/pix_opencv_contours_boundingrect.cc diff --git a/pix_opencv_contours_convexity.cpp b/pix_opencv_contours_convexity.cc index 982fd3d..982fd3d 100644 --- a/pix_opencv_contours_convexity.cpp +++ b/pix_opencv_contours_convexity.cc diff --git a/pix_opencv_distrans.cpp b/pix_opencv_distrans.cc index c9e4cdf..c9e4cdf 100644 --- a/pix_opencv_distrans.cpp +++ b/pix_opencv_distrans.cc diff --git a/pix_opencv_edge.cpp b/pix_opencv_edge.cc index 198d8ee..198d8ee 100644 --- a/pix_opencv_edge.cpp +++ b/pix_opencv_edge.cc diff --git a/pix_opencv_haarcascade.cpp b/pix_opencv_haarcascade.cc index f446f5b..f446f5b 100644 --- a/pix_opencv_haarcascade.cpp +++ b/pix_opencv_haarcascade.cc diff --git a/pix_opencv_laplace.cpp b/pix_opencv_laplace.cc index 5fbecda..5fbecda 100644 --- a/pix_opencv_laplace.cpp +++ b/pix_opencv_laplace.cc diff --git a/pix_opencv_morphology.cpp b/pix_opencv_morphology.cc index 5d95266..5d95266 100644 --- a/pix_opencv_morphology.cpp +++ b/pix_opencv_morphology.cc diff --git a/pix_opencv_motempl.cpp b/pix_opencv_motempl.cc index 48f6be6..48f6be6 100644 --- a/pix_opencv_motempl.cpp +++ b/pix_opencv_motempl.cc diff --git a/pix_opencv_threshold.cpp b/pix_opencv_threshold.cpp deleted file mode 100644 index b102c0d..0000000 --- a/pix_opencv_threshold.cpp +++ /dev/null @@ -1,266 +0,0 @@ -//////////////////////////////////////////////////////// -// -// GEM - Graphics Environment for Multimedia -// -// zmoelnig@iem.kug.ac.at -// -// Implementation file -// -// Copyright (c) 1997-2000 Mark Danks. -// Copyright (c) Günther Geiger. -// Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM -// Copyright (c) 2002 James Tittle & Chris Clepper -// For information on usage and redistribution, and for a DISCLAIMER OF ALL -// WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. -// -///////////////////////////////////////////////////////// - -#include "pix_opencv_threshold.h" - -CPPEXTERN_NEW(pix_opencv_threshold) - -///////////////////////////////////////////////////////// -// -// pix_opencv_threshold -// -///////////////////////////////////////////////////////// -// Constructor -// -///////////////////////////////////////////////////////// -pix_opencv_threshold :: pix_opencv_threshold() -{ - inlet_new(this->x_obj, &this->x_obj->ob_pd, gensym("float"), gensym("ft1")); - inlet_new(this->x_obj, &this->x_obj->ob_pd, gensym("float"), gensym("ft2")); - threshold_value = 1; - max_value = 255; - threshold_mode = 0; - comp_xsize = 0; - comp_ysize = 0; - orig = NULL; - gray = NULL; -} - -///////////////////////////////////////////////////////// -// Destructor -// -///////////////////////////////////////////////////////// -pix_opencv_threshold :: ~pix_opencv_threshold() -{ - //Destroy cv_images to clean memory - cvReleaseImage(&orig); - cvReleaseImage(&gray); - cvReleaseImage(&edge); - cvReleaseImage(&cedge); - cvReleaseImage(&cedgergb); - cvReleaseImage(&rgb); -} - -///////////////////////////////////////////////////////// -// processImage -// -///////////////////////////////////////////////////////// -void pix_opencv_threshold :: processRGBAImage(imageStruct &image) -{ - unsigned char *pixels = image.data; - - if ((this->comp_xsize!=image.xsize)||(this->comp_ysize!=image.ysize)||(!orig)) { - - this->comp_xsize = image.xsize; - this->comp_ysize = image.ysize; - - //Destroy cv_images to clean memory - cvReleaseImage(&orig); - cvReleaseImage(&gray); - cvReleaseImage(&edge); - cvReleaseImage(&cedge); - cvReleaseImage(&cedgergb); - cvReleaseImage(&rgb); - - //create the orig image with new size - orig = cvCreateImage(cvSize(image.xsize,image.ysize), IPL_DEPTH_8U, 4); - - // Create the output images with new sizes - gray = cvCreateImage(cvSize(orig->width,orig->height), IPL_DEPTH_8U, 1); - } - // Here we make a copy of the pixel data from image to orig->imageData - // orig is a IplImage struct, the default image type in openCV, take a look on the IplImage data structure here - // http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html - memcpy( orig->imageData, image.data, image.xsize*image.ysize*4 ); - - // Convert to grayscale - cvCvtColor(orig, gray, CV_BGRA2GRAY); - - // Applies fixed-level thresholding to single-channel array. - switch(this->threshold_mode) { - case 0: - cvThreshold(gray, gray, (float)this->threshold_value, (float)this->max_value, CV_THRESH_BINARY); - break; - case 1: - cvThreshold(gray, gray, (float)this->threshold_value, (float)this->max_value, CV_THRESH_BINARY_INV); - break; - case 2: - cvThreshold(gray, gray, (float)this->threshold_value, (float)this->max_value, CV_THRESH_TRUNC); - break; - case 3: - cvThreshold(gray, gray, (float)this->threshold_value, (float)this->max_value, CV_THRESH_TOZERO); - break; - case 4: - cvThreshold(gray, gray, (float)this->threshold_value, (float)this->max_value, CV_THRESH_TOZERO_INV); - break; - } - - cvCvtColor(gray, orig, CV_GRAY2BGRA); - - //copy back the processed frame to image - memcpy( image.data, orig->imageData, image.xsize*image.ysize*4 ); -} - -void pix_opencv_threshold :: processRGBImage(imageStruct &image) -{ - unsigned char *pixels = image.data; - - if ((this->comp_xsize!=image.xsize)||(this->comp_ysize!=image.ysize)||(!rgb)) { - - this->comp_xsize = image.xsize; - this->comp_ysize = image.ysize; - - //Destroy cv_images to clean memory - cvReleaseImage(&orig); - cvReleaseImage(&gray); - cvReleaseImage(&edge); - cvReleaseImage(&cedge); - cvReleaseImage(&cedgergb); - cvReleaseImage(&rgb); - - //create the orig image with new size - rgb = cvCreateImage(cvSize(image.xsize,image.ysize), IPL_DEPTH_8U, 3); - - // Create the output images with new sizes - gray = cvCreateImage(cvSize(rgb->width,rgb->height), IPL_DEPTH_8U, 1); - - } - // FEM UNA COPIA DEL PACKET A image->imageData ... http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html aqui veiem la estructura de IplImage - memcpy( rgb->imageData, image.data, image.xsize*image.ysize*3 ); - - // Convert to grayscale - cvCvtColor(rgb, gray, CV_RGB2GRAY); - - // Applies fixed-level thresholding to single-channel array. - switch(this->threshold_mode) { - case 0: - cvThreshold(gray, gray, (float)this->threshold_value, (float)this->max_value, CV_THRESH_BINARY); - break; - case 1: - cvThreshold(gray, gray, (float)this->threshold_value, (float)this->max_value, CV_THRESH_BINARY_INV); - break; - case 2: - cvThreshold(gray, gray, (float)this->threshold_value, (float)this->max_value, CV_THRESH_TRUNC); - break; - case 3: - cvThreshold(gray, gray, (float)this->threshold_value, (float)this->max_value, CV_THRESH_TOZERO); - break; - case 4: - cvThreshold(gray, gray, (float)this->threshold_value, (float)this->max_value, CV_THRESH_TOZERO_INV); - break; - } - - cvCvtColor(gray, rgb, CV_GRAY2BGR); - - //cvShowImage(wndname, cedge); - memcpy( image.data, rgb->imageData, image.xsize*image.ysize*3 ); -} - -void pix_opencv_threshold :: processYUVImage(imageStruct &image) -{ -} - -void pix_opencv_threshold :: processGrayImage(imageStruct &image) -{ - unsigned char *pixels = image.data; - - if ((this->comp_xsize!=image.xsize)||(this->comp_ysize!=image.ysize)||(!rgb)) { - - this->comp_xsize = image.xsize; - this->comp_ysize = image.ysize; - - //Destroy cv_images to clean memory - cvReleaseImage(&orig); - cvReleaseImage(&gray); - cvReleaseImage(&edge); - cvReleaseImage(&cedge); - cvReleaseImage(&cedgergb); - cvReleaseImage(&rgb); - - //create the orig image with new size - rgb = cvCreateImage(cvSize(image.xsize,image.ysize), IPL_DEPTH_8U, 3); - - // Create the output images with new sizes - cedgergb = cvCreateImage(cvSize(rgb->width,rgb->height), IPL_DEPTH_8U, 3); - - gray = cvCreateImage(cvSize(rgb->width,rgb->height), IPL_DEPTH_8U, 1); - edge = cvCreateImage(cvSize(rgb->width,rgb->height), IPL_DEPTH_8U, 1); - - } - // FEM UNA COPIA DEL PACKET A image->imageData ... http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html aqui veiem la estructura de IplImage - memcpy( gray->imageData, image.data, image.xsize*image.ysize ); - - // Convert to RGB - cvCvtColor( gray, rgb, CV_GRAY2RGB); - - cvSmooth( gray, edge, CV_BLUR, 3, 3, 0, 0 ); - cvNot( gray, edge ); - - // Run the edge detector on grayscale - cvCanny(gray, edge, (float)this->edge_thresh, (float)this->edge_thresh*3, 3); - - cvZero( cedgergb ); - // copy edge points - cvCopy( rgb, cedgergb, edge ); - - cvCvtColor( cedgergb, gray, CV_RGB2GRAY); - //cvShowImage(wndname, cedge); - memcpy( image.data, gray->imageData, image.xsize*image.ysize ); -} - -///////////////////////////////////////////////////////// -// floatThreshMess -// -///////////////////////////////////////////////////////// -void pix_opencv_threshold :: floatThreshMess (float edge_thresh) -{ - this->edge_thresh = (int)edge_thresh; -} -void pix_opencv_threshold :: floatMaxMess (float thresh_max) -{ - if ((thresh_max>=0)&&(thresh_max<256)) this->max_value = (int)thresh_max; -} -void pix_opencv_threshold :: floatModeMess (float mode) -{ - f ((mode>=0)&&(mode<7)) this->threshold_mode = (int)edge_thresh; -} - -///////////////////////////////////////////////////////// -// static member function -// -///////////////////////////////////////////////////////// -void pix_opencv_threshold :: obj_setupCallback(t_class *classPtr) -{ - class_addmethod(classPtr, (t_method)&pix_opencv_threshold::floatModeMessCallback, - gensym("mode"), A_FLOAT, A_NULL); - class_addmethod(classPtr, (t_method)&pix_opencv_threshold::floatMaxMessCallback, - gensym("ft1"), A_FLOAT, A_NULL); - class_addmethod(classPtr, (t_method)&pix_opencv_threshold::floatTreshMessCallback, - gensym("ft2"), A_FLOAT, A_NULL); -} -void pix_opencv_threshold :: floatTreshMessCallback(void *data, t_floatarg edge_thresh) -{ - GetMyClass(data)->floatThreshMess((float)edge_thresh); -} -void pix_opencv_threshold :: floatMaxMessCallback(void *data, t_floatarg edge_thresh) -{ - GetMyClass(data)->floatMaxMess((float)edge_thresh); -} -void pix_opencv_threshold :: floatModeMessCallback(void *data, t_floatarg edge_thresh) -{ - GetMyClass(data)->floatModeMess((float)edge_thresh); -} diff --git a/pix_opencv_threshold.h b/pix_opencv_threshold.h deleted file mode 100644 index a3de7df..0000000 --- a/pix_opencv_threshold.h +++ /dev/null @@ -1,87 +0,0 @@ -/*----------------------------------------------------------------- -LOG - GEM - Graphics Environment for Multimedia - - Change pix to greyscale - - Copyright (c) 1997-1999 Mark Danks. mark@danks.org - Copyright (c) Günther Geiger. geiger@epy.co.at - Copyright (c) 2001-2002 IOhannes m zmoelnig. forum::für::umläute. IEM. zmoelnig@iem.kug.ac.at - Copyright (c) 2002 James Tittle & Chris Clepper - For information on usage and redistribution, and for a DISCLAIMER OF ALL - WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. - ------------------------------------------------------------------*/ - -#ifndef INCLUDE_PIX_OPENCV_EDGE_H_ -#define INCLUDE_PIX_OPENCV_EDGE_H_ - -#include "Base/GemPixObj.h" - -#ifndef _EiC -#include "cv.h" -#endif - -/*----------------------------------------------------------------- -------------------------------------------------------------------- -CLASS - pix_opencv_threshold - - Change pix to greyscale - -KEYWORDS - pix - -DESCRIPTION - ------------------------------------------------------------------*/ -class GEM_EXTERN pix_opencv_threshold : public GemPixObj -{ - CPPEXTERN_HEADER(pix_opencv_threshold, GemPixObj) - - public: - - ////////// - // Constructor - pix_opencv_threshold(); - - protected: - - ////////// - // Destructor - virtual ~pix_opencv_threshold(); - - ////////// - // Do the processing - virtual void processRGBAImage(imageStruct &image); - virtual void processRGBImage(imageStruct &image); - virtual void processYUVImage(imageStruct &image); - virtual void processGrayImage(imageStruct &image); - - ////////// - // Set the new edge threshold - void floatThreshMess(float edge_thresh); - // The new edge threshold - int threshold_value; - int max_value; - int threshold_mode; - - // to detect changes in the image size - int comp_xsize; - int comp_ysize; - - private: - - ////////// - // Static member functions - static void floatTreshMessCallback(void *data, t_floatarg thresh_value); - static void floatModeMessCallback(void *data, t_floatarg thresh_mode_value); - static void floatMaxMessCallback(void *data, t_floatarg max_value); - - ///////// - // IplImage needed - IplImage *orig, *rgb, *gray; - -}; - -#endif // for header file |