diff options
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | Makefile.in | 2 | ||||
-rw-r--r-- | pdp_opencv.c | 107 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_athreshold.cc (renamed from pdp_opencv_athreshold.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_bgsubstract.cc (renamed from pdp_opencv_bgsubstract.c) | 4 | ||||
-rwxr-xr-x | pdp_opencv_bm-help.pd | 103 | ||||
-rwxr-xr-x | pdp_opencv_bm.cc | 327 | ||||
-rwxr-xr-x | pdp_opencv_colorfilt.cc (renamed from pdp_opencv_colorfilt.c) | 11 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_contours_boundingrect.cc (renamed from pdp_opencv_contours_boundingrect.c) | 4 | ||||
-rw-r--r-- | pdp_opencv_contours_convexhull.cc (renamed from pdp_opencv_contours_convexhull.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_contours_convexity.cc (renamed from pdp_opencv_contours_convexity.c) | 10 | ||||
-rwxr-xr-x | pdp_opencv_dft.cc (renamed from pdp_opencv_dft.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_distrans.cc (renamed from pdp_opencv_distrans.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_edge.cc (renamed from pdp_opencv_edge.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_floodfill.cc (renamed from pdp_opencv_floodfill.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_haarcascade.cc (renamed from pdp_opencv_haarcascade.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_hist_compare.cc (renamed from pdp_opencv_hist_compare.c) | 4 | ||||
-rwxr-xr-x | pdp_opencv_hu_moments.cc (renamed from pdp_opencv_hu_moments.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_laplace.cc (renamed from pdp_opencv_laplace.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_lk.cc (renamed from pdp_opencv_lk.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_morphology.cc (renamed from pdp_opencv_morphology.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_motempl.cc (renamed from pdp_opencv_motempl.c) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | pdp_opencv_threshold.cc (renamed from pdp_opencv_threshold.c) | 4 |
23 files changed, 474 insertions, 154 deletions
@@ -18,7 +18,7 @@ ifeq ($(UNAME),Linux) EXTENSION = pd_linux endif ifeq ($(UNAME),Darwin) - INCLUDES += -I/System/Library/Frameworks/OpenCV.framework/Headers/ + INCLUDES += -I/Library/Frameworks/OpenCV.framework/Headers/ LDFLAGS = -bundle -undefined dynamic_lookup LIBS = -lm -framework OpenCV EXTENSION = pd_darwin @@ -26,7 +26,7 @@ endif .SUFFIXES = $(EXTENSION) -SOURCES = pdp_opencv_threshold.c pdp_opencv_edge.c pdp_opencv_distrans.c pdp_opencv_laplace.c pdp_opencv_motempl.c pdp_opencv_morphology.c pdp_opencv_haarcascade.c pdp_opencv_contours_convexity.c pdp_opencv_contours_boundingrect.c pdp_opencv_bgsubstract.c pdp_opencv_lk.c pdp_opencv_floodfill.c pdp_opencv_hist_compare.c pdp_opencv_dft.c pdp_opencv_knear.cc pdp_opencv_hu_moments.c pdp_opencv_hu_compare.cc pdp_opencv_pgh_compare.cc pdp_opencv_bgstats.cc pdp_opencv_athreshold.c pdp_opencv_hough_lines.cc pdp_opencv_channels.cc pdp_opencv_hough_circles.cc pdp_opencv_camshift.cc pdp_opencv_colorfilt.c pdp_opencv_contours_convexhull.c +SOURCES = pdp_opencv_threshold.cc pdp_opencv_edge.cc pdp_opencv_distrans.cc pdp_opencv_laplace.cc pdp_opencv_motempl.cc pdp_opencv_morphology.cc pdp_opencv_haarcascade.cc pdp_opencv_contours_convexity.cc pdp_opencv_contours_boundingrect.cc pdp_opencv_bgsubstract.cc pdp_opencv_lk.cc pdp_opencv_floodfill.cc pdp_opencv_hist_compare.cc pdp_opencv_dft.cc pdp_opencv_knear.cc pdp_opencv_hu_moments.cc pdp_opencv_hu_compare.cc pdp_opencv_pgh_compare.cc pdp_opencv_bgstats.cc pdp_opencv_athreshold.cc pdp_opencv_hough_lines.cc pdp_opencv_channels.cc pdp_opencv_hough_circles.cc pdp_opencv_camshift.cc pdp_opencv_colorfilt.cc pdp_opencv_contours_convexhull.cc pdp_opencv_bm.cc SOURCES_OPT = pdp_opencv_surf.cc all: $(SOURCES:.c=.$(EXTENSION)) $(SOURCES:.cc=.$(EXTENSION)) $(SOURCES_OPT:.c=.$(EXTENSION)) $(SOURCES_OPT:.cc=.$(EXTENSION)) diff --git a/Makefile.in b/Makefile.in index 49e352e..4bed297 100755 --- a/Makefile.in +++ b/Makefile.in @@ -26,7 +26,7 @@ endif .SUFFIXES = $(EXTENSION) -SOURCES = pdp_opencv_threshold.c pdp_opencv_edge.c pdp_opencv_distrans.c pdp_opencv_laplace.c pdp_opencv_motempl.c pdp_opencv_morphology.c pdp_opencv_haarcascade.c pdp_opencv_contours_convexity.c pdp_opencv_contours_boundingrect.c pdp_opencv_bgsubstract.c pdp_opencv_lk.c pdp_opencv_floodfill.c pdp_opencv_hist_compare.c pdp_opencv_dft.c pdp_opencv_knear.cc pdp_opencv_hu_moments.c pdp_opencv_hu_compare.cc pdp_opencv_pgh_compare.cc pdp_opencv_bgstats.cc pdp_opencv_athreshold.c pdp_opencv_hough_lines.cc pdp_opencv_channels.cc pdp_opencv_hough_circles.cc pdp_opencv_camshift.cc pdp_opencv_colorfilt.c pdp_opencv_contours_convexhull.c +SOURCES = pdp_opencv_threshold.cc pdp_opencv_edge.cc pdp_opencv_distrans.cc pdp_opencv_laplace.cc pdp_opencv_motempl.cc pdp_opencv_morphology.cc pdp_opencv_haarcascade.cc pdp_opencv_contours_convexity.cc pdp_opencv_contours_boundingrect.cc pdp_opencv_bgsubstract.cc pdp_opencv_lk.cc pdp_opencv_floodfill.cc pdp_opencv_hist_compare.cc pdp_opencv_dft.cc pdp_opencv_knear.cc pdp_opencv_hu_moments.cc pdp_opencv_hu_compare.cc pdp_opencv_pgh_compare.cc pdp_opencv_bgstats.cc pdp_opencv_athreshold.cc pdp_opencv_hough_lines.cc pdp_opencv_channels.cc pdp_opencv_hough_circles.cc pdp_opencv_camshift.cc pdp_opencv_colorfilt.cc pdp_opencv_contours_convexhull.cc pdp_opencv_bm.cc SOURCES_OPT = @SOURCES_OPT@ all: $(SOURCES:.c=.$(EXTENSION)) $(SOURCES:.cc=.$(EXTENSION)) $(SOURCES_OPT:.c=.$(EXTENSION)) $(SOURCES_OPT:.cc=.$(EXTENSION)) diff --git a/pdp_opencv.c b/pdp_opencv.c deleted file mode 100644 index 59a2ea9..0000000 --- a/pdp_opencv.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Pure Data Packet system implementation: setup code - * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include <stdio.h> -#include <m_pd.h> - -static int pdp_opencv_initialized = 0; - -/* all symbols are C style */ -#ifdef __cplusplus -extern "C" -{ -#endif - -void pdp_opencv_edge_setup(void); -void pdp_opencv_threshold_setup(void); -void pdp_opencv_bgsubstract_setup(void); -void pdp_opencv_distrans_setup(void); -void pdp_opencv_laplace_setup(void); -void pdp_opencv_motempl_setup(void); -void pdp_opencv_morphology_setup(void); -void pdp_opencv_haarcascade_setup(void); -void pdp_opencv_floodfill_setup(void); -void pdp_opencv_contours_convexity_setup(void); -void pdp_opencv_contours_boundingrect_setup(void); -void pdp_opencv_lk_setup(void); -void pdp_opencv_dft_setup(void); -void pdp_opencv_knear_setup(void); -void pdp_opencv_hu_moments_setup(void); -void pdp_opencv_hu_compare_setup(void); -void pdp_opencv_pgh_compare_setup(void); -void pdp_opencv_bgstats_setup(void); -void pdp_opencv_surf_setup(void); -void pdp_opencv_lk_setup(void); -void pdp_opencv_athreshold_setup(void); -void pdp_opencv_channels_setup(void); -void pdp_opencv_hough_lines_setup(void); -void pdp_opencv_hough_circles_setup(void); -void pdp_opencv_camshift_setup(void); - - - -/* library setup routine */ -void pdp_opencv_setup(void){ - - if (pdp_opencv_initialized) return; - - /* babble */ -#ifdef PDP_CV_VERSION - post("PDP_opencv: pure data packet openCV wrapper version " PDP_CV_VERSION ); -#else - post ("PDP_opencv: pure data packet openCV wrapper"); -#endif - - - /* setup pdp_opencv system */ - pdp_opencv_edge_setup(); - pdp_opencv_threshold_setup(); - pdp_opencv_bgsubstract_setup(); - pdp_opencv_distrans_setup(); - pdp_opencv_laplace_setup(); - pdp_opencv_motempl_setup(); - pdp_opencv_morphology_setup(); - pdp_opencv_haarcascade_setup(); - pdp_opencv_floodfill_setup(); - pdp_opencv_contours_convexity_setup(); - pdp_opencv_contours_boundingrect_setup(); - pdp_opencv_lk_setup(); - pdp_opencv_dft_setup(); - pdp_opencv_knear_setup(); - pdp_opencv_hu_moments_setup(); - pdp_opencv_hu_compare_setup(); - pdp_opencv_pgh_compare_setup(); - pdp_opencv_bgstats_setup(); - pdp_opencv_surf_setup(); - pdp_opencv_lk_setup(); - pdp_opencv_athreshold_setup(); - pdp_opencv_channels_setup(); - pdp_opencv_hough_lines_setup(); - pdp_opencv_hough_circles_setup(); - pdp_opencv_camshift_setup(); - - pdp_opencv_initialized++; - - -} - -#ifdef __cplusplus -} -#endif diff --git a/pdp_opencv_athreshold.c b/pdp_opencv_athreshold.cc index ac7c9c2..f43c556 100644..100755 --- a/pdp_opencv_athreshold.c +++ b/pdp_opencv_athreshold.cc @@ -176,7 +176,7 @@ static void pdp_opencv_athreshold_process(t_pdp_opencv_athreshold *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_athreshold_process_rgb, pdp_opencv_athreshold_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_athreshold_process_rgb, (void*)pdp_opencv_athreshold_sendpacket, &x->x_queue_id); break; default: @@ -193,7 +193,7 @@ static void pdp_opencv_athreshold_input_0(t_pdp_opencv_athreshold *x, t_symbol * /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_bgsubstract.c b/pdp_opencv_bgsubstract.cc index 1895a82..f28a33a 100644..100755 --- a/pdp_opencv_bgsubstract.c +++ b/pdp_opencv_bgsubstract.cc @@ -190,7 +190,7 @@ static void pdp_opencv_bgsubstract_process(t_pdp_opencv_bgsubstract *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_bgsubstract_process_rgb, pdp_opencv_bgsubstract_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_bgsubstract_process_rgb, (void*)pdp_opencv_bgsubstract_sendpacket, &x->x_queue_id); break; default: @@ -207,7 +207,7 @@ static void pdp_opencv_bgsubstract_input_0(t_pdp_opencv_bgsubstract *x, t_symbol /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_bm-help.pd b/pdp_opencv_bm-help.pd new file mode 100755 index 0000000..039c1e0 --- /dev/null +++ b/pdp_opencv_bm-help.pd @@ -0,0 +1,103 @@ +#N canvas 503 49 833 785 10; +#X obj -17 -55 cnv 15 621 250 empty empty empty 20 12 0 14 -260097 +-66577 0; +#X obj 223 -15 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 223 12 metro 40; +#X msg 313 39 close; +#X obj 243 110 pdp_v4l; +#X msg 300 7 open /dev/video0; +#X obj 412 -20 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 412 7 metro 40; +#X msg 493 26 close; +#X msg 489 2 open /dev/video0; +#X obj 433 106 pdp_v4l2; +#X msg 498 81 format \$1; +#X obj 499 59 hradio 15 1 0 4 empty empty empty 0 -8 0 10 -262144 -1 +-1 0; +#X obj 13 160 pdp_qt; +#X obj 46 96 metro 40; +#X msg 46 68 bang; +#X msg 87 68 stop; +#X obj 13 -1 openpanel; +#X msg 13 24 open \$1; +#X msg 13 -29 bang; +#X msg 47 123 loop \$1; +#X obj 127 123 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 +1; +#X obj 127 41 loadbang; +#X text 56 -26 playing a video file; +#X text 253 -17 Camera input; +#X obj 73 161 hsl 128 15 0 500 0 0 empty empty empty -2 -8 0 10 -262144 +-1 -1 0 1; +#X obj -15 203 cnv 15 621 250 empty empty empty 20 12 0 14 -258113 +-66577 0; +#X obj 9 468 pdp_xv; +#X obj 158 368 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X msg 73 366 nightmode \$1; +#X text 177 369 set nightmode; +#X floatatom 163 223 5 0 0 0 - - -; +#X text -14 -77 pdp_opencv_bm : Block Matching optical flow algorithm. +; +#X msg 53 222 blocksize \$1 \$1; +#X floatatom 172 250 5 0 0 0 - - -; +#X floatatom 179 279 5 0 0 0 - - -; +#X obj 9 422 pdp_opencv_bm; +#X msg 62 249 shiftsize \$1 \$1; +#X text 204 223 set blocksize (width height) ( default 10x10 ); +#X text 212 249 set shiftsize (width height) ( default 10x10 ); +#X msg 69 278 maxrange \$1 \$1; +#X text 220 279 set maxrange (width height) ( default 5x5 ); +#X floatatom 162 318 5 0 0 0 - - -; +#X msg 75 316 threshold \$1; +#X text 204 315 threhold value for the detection of movement ( default +10 ); +#X obj 296 385 pdp_background; +#X obj 293 358 metro 40; +#X obj 292 337 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X msg 99 -157; +#X msg 321 334 stop; +#X obj 281 413 pdp_convert image/YCrCb/*; +#X connect 1 0 2 0; +#X connect 2 0 4 0; +#X connect 3 0 4 0; +#X connect 4 0 36 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 7 0 10 0; +#X connect 8 0 10 0; +#X connect 9 0 10 0; +#X connect 10 0 36 0; +#X connect 11 0 10 0; +#X connect 12 0 11 0; +#X connect 13 0 36 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 16 0 14 0; +#X connect 17 0 18 0; +#X connect 18 0 13 0; +#X connect 19 0 17 0; +#X connect 20 0 13 0; +#X connect 21 0 20 0; +#X connect 22 0 21 0; +#X connect 22 0 15 0; +#X connect 25 0 13 1; +#X connect 28 0 29 0; +#X connect 29 0 36 0; +#X connect 31 0 33 0; +#X connect 33 0 36 0; +#X connect 34 0 37 0; +#X connect 35 0 40 0; +#X connect 36 0 27 0; +#X connect 37 0 36 0; +#X connect 40 0 36 0; +#X connect 42 0 43 0; +#X connect 43 0 36 0; +#X connect 45 0 50 0; +#X connect 46 0 45 0; +#X connect 47 0 46 0; +#X connect 49 0 46 0; +#X connect 50 0 36 0; diff --git a/pdp_opencv_bm.cc b/pdp_opencv_bm.cc new file mode 100755 index 0000000..1d26dab --- /dev/null +++ b/pdp_opencv_bm.cc @@ -0,0 +1,327 @@ +/* + * Pure Data Packet module. + * Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <dirent.h> +#include <limits.h> +#include <dlfcn.h> +#include <ctype.h> + +#include "pdp.h" + +#ifndef _EiC +#include "cv.h" +#endif + +typedef struct pdp_opencv_bm_struct +{ + t_object x_obj; + t_float x_f; + + t_outlet *x_outlet0; + t_outlet *x_outlet1; + t_atom x_list[3]; + + int x_packet0; + int x_packet1; + int x_dropped; + int x_queue_id; + + int x_width; + int x_height; + int x_size; + + // OpenCv structures + IplImage *image, *grey, *prev_grey, *swap_temp; + IplImage *x_velx, *x_vely; + CvSize x_blocksize, x_shiftsize, x_maxrange, x_velsize; + + int x_nightmode; + int x_threshold; + CvFont font; + +} t_pdp_opencv_bm; + +static void pdp_opencv_bm_process_rgb(t_pdp_opencv_bm *x) +{ + t_pdp *header = pdp_packet_header(x->x_packet0); + short int *data = (short int *)pdp_packet_data(x->x_packet0); + t_pdp *newheader = pdp_packet_header(x->x_packet1); + short int *newdata = (short int *)pdp_packet_data(x->x_packet1); + int i,j,k,im; + int marked; + int px,py; + + if ((x->x_width != (t_int)header->info.image.width) || + (x->x_height != (t_int)header->info.image.height) || (!x->image)) + { + + post("pdp_opencv_bm :: resizing plugins"); + + x->x_width = header->info.image.width; + x->x_height = header->info.image.height; + x->x_size = x->x_width*x->x_height; + + x->x_velsize.width = (x->x_width-x->x_blocksize.width)/x->x_shiftsize.width; + x->x_velsize.height = (x->x_height-x->x_blocksize.height)/x->x_shiftsize.height; + x->x_maxrange.width = x->x_width; + x->x_maxrange.height = x->x_height; + + //Destroy cv_images + cvReleaseImage( &x->image ); + cvReleaseImage( &x->grey ); + cvReleaseImage( &x->prev_grey ); + cvReleaseImage( &x->x_velx ); + cvReleaseImage( &x->x_vely ); + + //Create cv_images + x->image = cvCreateImage( cvSize(x->x_width, x->x_height), 8, 3 ); + x->grey = cvCreateImage( cvSize(x->x_width, x->x_height), 8, 1 ); + x->prev_grey = cvCreateImage( cvSize(x->x_width, x->x_height), 8, 1 ); + + x->x_velx = cvCreateImage( x->x_velsize, IPL_DEPTH_32F, 1 ); + x->x_vely = cvCreateImage( x->x_velsize, IPL_DEPTH_32F, 1 ); + } + + newheader->info.image.encoding = header->info.image.encoding; + newheader->info.image.width = x->x_width; + newheader->info.image.height = x->x_height; + + memcpy( newdata, data, x->x_size*3 ); + + memcpy( x->image->imageData, data, x->x_size*3 ); + + cvCvtColor( x->image, x->grey, CV_RGB2GRAY ); + + if( x->x_nightmode ) + cvZero( x->image ); + + cvCalcOpticalFlowBM( x->prev_grey, x->grey, + x->x_blocksize, x->x_shiftsize, + x->x_maxrange, 1, + x->x_velx, x->x_vely ); + + for( py=0; py<x->x_velsize.height; py++ ) + { + for( px=0; px<x->x_velsize.width; px++ ) + { + float velxf = (float)*( x->x_velx->imageData + py * x->x_velx->widthStep + px); + float velyf = (float)*( x->x_vely->imageData + py * x->x_vely->widthStep + px); + + if ( sqrt( velxf*velxf + velyf*velyf ) > x->x_threshold ) + { + // post( "pdp_opencv_bm : (%d,%d) values (%f,%f)", px, py, velxf, velyf ); + CvPoint orig, dest; + orig.x = px*x->x_shiftsize.width; + orig.y = py*x->x_shiftsize.height; + dest.x = px*x->x_shiftsize.width+(int)velxf; + dest.y = py*x->x_shiftsize.height+(int)velyf; + + cvLine( x->image, orig, dest, CV_RGB(0,255,0), 1, 8 ); + } + } + } + + CV_SWAP( x->prev_grey, x->grey, x->swap_temp ); + + memcpy( newdata, x->image->imageData, x->x_size*3 ); + return; +} + +static void pdp_opencv_bm_nightmode(t_pdp_opencv_bm *x, t_floatarg f) +{ + if ((f==0.0)||(f==1.0)) x->x_nightmode = (int)f; +} + +static void pdp_opencv_bm_threshold(t_pdp_opencv_bm *x, t_floatarg f) +{ + if (f>=0.0) x->x_threshold = (int)f; +} + +static void pdp_opencv_bm_blocksize(t_pdp_opencv_bm *x, t_floatarg fwidth, t_floatarg fheight ) +{ + if (fwidth>=1.0) x->x_blocksize.width = (int)fwidth; + if (fheight>=1.0) x->x_blocksize.height = (int)fheight; + + x->x_velsize.width = (x->x_width-x->x_blocksize.width)/x->x_shiftsize.width; + x->x_velsize.height = (x->x_height-x->x_blocksize.height)/x->x_shiftsize.height; + cvReleaseImage( &x->x_velx ); + cvReleaseImage( &x->x_vely ); + x->x_velx = cvCreateImage( x->x_velsize, IPL_DEPTH_32F, 1 ); + x->x_vely = cvCreateImage( x->x_velsize, IPL_DEPTH_32F, 1 ); + +} + +static void pdp_opencv_bm_shiftsize(t_pdp_opencv_bm *x, t_floatarg fwidth, t_floatarg fheight ) +{ + if (fwidth>=1.0) x->x_shiftsize.width = (int)fwidth; + if (fheight>=1.0) x->x_shiftsize.height = (int)fheight; + + x->x_velsize.width = (x->x_width-x->x_blocksize.width)/x->x_shiftsize.width; + x->x_velsize.height = (x->x_height-x->x_blocksize.height)/x->x_shiftsize.height; + cvReleaseImage( &x->x_velx ); + cvReleaseImage( &x->x_vely ); + x->x_velx = cvCreateImage( x->x_velsize, IPL_DEPTH_32F, 1 ); + x->x_vely = cvCreateImage( x->x_velsize, IPL_DEPTH_32F, 1 ); +} + +static void pdp_opencv_bm_maxrange(t_pdp_opencv_bm *x, t_floatarg fwidth, t_floatarg fheight ) +{ + if (fwidth>=1.0) x->x_maxrange.width = (int)fwidth; + if (fheight>=1.0) x->x_maxrange.height = (int)fheight; +} + +static void pdp_opencv_bm_sendpacket(t_pdp_opencv_bm *x) +{ + /* release the packet */ + pdp_packet_mark_unused(x->x_packet0); + x->x_packet0 = -1; + + /* unregister and propagate if valid dest packet */ + pdp_packet_pass_if_valid(x->x_outlet0, &x->x_packet1); +} + +static void pdp_opencv_bm_process(t_pdp_opencv_bm *x) +{ + int encoding; + t_pdp *header = 0; + + /* check if image data packets are compatible */ + if ( (header = pdp_packet_header(x->x_packet0)) + && (PDP_BITMAP == header->type)){ + + /* pdp_opencv_bm_process inputs and write into active inlet */ + switch(pdp_packet_header(x->x_packet0)->info.image.encoding){ + + case PDP_BITMAP_RGB: + x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); + pdp_queue_add(x, (void*)pdp_opencv_bm_process_rgb, (void*)pdp_opencv_bm_sendpacket, &x->x_queue_id); + break; + + default: + /* don't know the type, so dont pdp_opencv_bm_process */ + break; + + } + } + +} + +static void pdp_opencv_bm_input_0(t_pdp_opencv_bm *x, t_symbol *s, t_floatarg f) +{ + /* if this is a register_ro message or register_rw message, register with packet factory */ + + if (s == gensym("register_rw")) + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); + + if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) + { + /* add the process method and callback to the process queue */ + pdp_opencv_bm_process(x); + } +} + +static void pdp_opencv_bm_free(t_pdp_opencv_bm *x) +{ + int i; + + pdp_queue_finish(x->x_queue_id); + pdp_packet_mark_unused(x->x_packet0); + //cv_freeplugins(x); + + //Destroy cv_images + cvReleaseImage( &x->image ); + cvReleaseImage( &x->grey ); + cvReleaseImage( &x->prev_grey ); + cvReleaseImage( &x->x_velx ); + cvReleaseImage( &x->x_vely ); +} + +t_class *pdp_opencv_bm_class; + +void *pdp_opencv_bm_new(t_floatarg f) +{ + int i; + + t_pdp_opencv_bm *x = (t_pdp_opencv_bm *)pd_new(pdp_opencv_bm_class); + + x->x_outlet0 = outlet_new(&x->x_obj, &s_anything); + x->x_outlet1 = outlet_new(&x->x_obj, &s_anything); + + x->x_packet0 = -1; + x->x_packet1 = -1; + x->x_queue_id = -1; + + x->x_width = 320; + x->x_height = 240; + x->x_size = x->x_width * x->x_height; + + x->x_nightmode=0; + x->x_threshold=10; + x->x_blocksize.width = 10; + x->x_blocksize.height = 10; + x->x_shiftsize.width = 10; + x->x_shiftsize.height = 10; + x->x_maxrange.width = x->x_width; + x->x_maxrange.height = x->x_height; + x->x_velsize.width = (x->x_width-x->x_blocksize.width)/x->x_shiftsize.width; + x->x_velsize.height = (x->x_height-x->x_blocksize.height)/x->x_shiftsize.height; + + // initialize font + cvInitFont( &x->font, CV_FONT_HERSHEY_PLAIN, 1.0, 1.0, 0, 1, 8 ); + + x->image = cvCreateImage( cvSize(x->x_width, x->x_height), 8, 3 ); + x->grey = cvCreateImage( cvSize(x->x_width, x->x_height), 8, 1 ); + x->prev_grey = cvCreateImage( cvSize(x->x_width, x->x_height), 8, 1 ); + + x->x_velx = cvCreateImage( x->x_velsize, IPL_DEPTH_32F, 1 ); + x->x_vely = cvCreateImage( x->x_velsize, IPL_DEPTH_32F, 1 ); + + return (void *)x; +} + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_opencv_bm_setup(void) +{ + + post( " pdp_opencv_bm"); + pdp_opencv_bm_class = class_new(gensym("pdp_opencv_bm"), (t_newmethod)pdp_opencv_bm_new, + (t_method)pdp_opencv_bm_free, sizeof(t_pdp_opencv_bm), 0, A_DEFFLOAT, A_NULL); + + class_addmethod(pdp_opencv_bm_class, (t_method)pdp_opencv_bm_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_opencv_bm_class, (t_method)pdp_opencv_bm_nightmode, gensym("nightmode"), A_FLOAT, A_NULL ); + class_addmethod(pdp_opencv_bm_class, (t_method)pdp_opencv_bm_threshold, gensym("threshold"), A_FLOAT, A_NULL ); + class_addmethod(pdp_opencv_bm_class, (t_method)pdp_opencv_bm_blocksize, gensym("blocksize"), A_FLOAT, A_FLOAT, A_NULL ); + class_addmethod(pdp_opencv_bm_class, (t_method)pdp_opencv_bm_shiftsize, gensym("shiftsize"), A_FLOAT, A_FLOAT, A_NULL ); + class_addmethod(pdp_opencv_bm_class, (t_method)pdp_opencv_bm_maxrange, gensym("maxrange"), A_FLOAT, A_FLOAT, A_NULL ); + +} + +#ifdef __cplusplus +} +#endif diff --git a/pdp_opencv_colorfilt.c b/pdp_opencv_colorfilt.cc index b2d4092..89eaecc 100755 --- a/pdp_opencv_colorfilt.c +++ b/pdp_opencv_colorfilt.cc @@ -26,8 +26,6 @@ #include <stdio.h> #include "g_canvas.h" -static char *pdp_opencv_colorfilt_version = "pdp_opencv_colorfilt: a color filter"; - typedef struct pdp_opencv_colorfilt_struct { t_object x_obj; @@ -63,8 +61,8 @@ static void pdp_opencv_colorfilt_draw_color(t_pdp_opencv_colorfilt *x) sprintf( color, "#%.2X%.2X%.2X", x->x_colorR, x->x_colorG, x->x_colorB ); width = rtext_width( glist_findrtext( (t_glist*)x->x_canvas, (t_text *)x ) ); height = rtext_height( glist_findrtext( (t_glist*)x->x_canvas, (t_text *)x ) ); - sys_vgui(".x%x.c delete rectangle %xCOLOR\n", x->x_canvas, x ); - sys_vgui(".x%x.c create rectangle %d %d %d %d -fill %s -tags %xCOLOR\n", + sys_vgui((char*)".x%x.c delete rectangle %xCOLOR\n", x->x_canvas, x ); + sys_vgui((char*)".x%x.c create rectangle %d %d %d %d -fill %s -tags %xCOLOR\n", x->x_canvas, x->x_obj.te_xpix+width+5, x->x_obj.te_ypix, x->x_obj.te_xpix+width+height+5, x->x_obj.te_ypix+height, color, x ); @@ -230,7 +228,7 @@ static void pdp_opencv_colorfilt_process(t_pdp_opencv_colorfilt *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_colorfilt_process_rgb, pdp_opencv_colorfilt_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_colorfilt_process_rgb, (void*)pdp_opencv_colorfilt_sendpacket, &x->x_queue_id); break; default: @@ -248,7 +246,7 @@ static void pdp_opencv_colorfilt_input_0(t_pdp_opencv_colorfilt *x, t_symbol *s, if (s== gensym("register_rw")) { - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); } if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) @@ -313,7 +311,6 @@ extern "C" void pdp_opencv_colorfilt_setup(void) { - // post( pdp_opencv_colorfilt_version ); pdp_opencv_colorfilt_class = class_new(gensym("pdp_opencv_colorfilt"), (t_newmethod)pdp_opencv_colorfilt_new, (t_method)pdp_opencv_colorfilt_free, sizeof(t_pdp_opencv_colorfilt), 0, A_NULL); diff --git a/pdp_opencv_contours_boundingrect.c b/pdp_opencv_contours_boundingrect.cc index 549fb6d..c8b747d 100644..100755 --- a/pdp_opencv_contours_boundingrect.c +++ b/pdp_opencv_contours_boundingrect.cc @@ -416,7 +416,7 @@ static void pdp_opencv_contours_boundingrect_process(t_pdp_opencv_contours_bound case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_contours_boundingrect_process_rgb, pdp_opencv_contours_boundingrect_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_contours_boundingrect_process_rgb, (void*)pdp_opencv_contours_boundingrect_sendpacket, &x->x_queue_id); break; default: @@ -433,7 +433,7 @@ static void pdp_opencv_contours_boundingrect_input_0(t_pdp_opencv_contours_bound /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_contours_convexhull.c b/pdp_opencv_contours_convexhull.cc index 59235d1..f57515f 100644 --- a/pdp_opencv_contours_convexhull.c +++ b/pdp_opencv_contours_convexhull.cc @@ -310,7 +310,7 @@ static void pdp_opencv_contours_convexhull_process(t_pdp_opencv_contours_convexh case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_contours_convexhull_process_rgb, pdp_opencv_contours_convexhull_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_contours_convexhull_process_rgb, (void*)pdp_opencv_contours_convexhull_sendpacket, &x->x_queue_id); break; default: @@ -327,7 +327,7 @@ static void pdp_opencv_contours_convexhull_input_0(t_pdp_opencv_contours_convexh /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_contours_convexity.c b/pdp_opencv_contours_convexity.cc index f9ce1cb..58ee306 100644..100755 --- a/pdp_opencv_contours_convexity.c +++ b/pdp_opencv_contours_convexity.cc @@ -179,10 +179,10 @@ static void pdp_opencv_contours_convexity_process_rgb(t_pdp_opencv_contours_conv //fprintf(stderr,"malloc\n"); // Alloc memory for contour point set. - PointArray = malloc( count*sizeof(CvPoint) ); + PointArray = (CvPoint*)malloc( count*sizeof(CvPoint) ); // Alloc memory for indices of convex hull vertices. - hull = malloc(sizeof(int)*count); + hull = (int*)malloc(sizeof(int)*count); // Get contour point set. //fprintf(stderr,"cvCvtSeqToArray\n"); @@ -227,7 +227,7 @@ static void pdp_opencv_contours_convexity_process_rgb(t_pdp_opencv_contours_conv // Alloc memory for defect set. //fprintf(stderr,"malloc\n"); - defectArray = malloc(sizeof(CvConvexityDefect)*nomdef); + defectArray = (CvConvexityDefect*)malloc(sizeof(CvConvexityDefect)*nomdef); // Get defect set. //fprintf(stderr,"cvCvtSeqToArray\n"); @@ -345,7 +345,7 @@ static void pdp_opencv_contours_convexity_process(t_pdp_opencv_contours_convexit case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_contours_convexity_process_rgb, pdp_opencv_contours_convexity_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_contours_convexity_process_rgb, (void*)pdp_opencv_contours_convexity_sendpacket, &x->x_queue_id); break; default: @@ -362,7 +362,7 @@ static void pdp_opencv_contours_convexity_input_0(t_pdp_opencv_contours_convexit /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_dft.c b/pdp_opencv_dft.cc index 4cfac5f..e9f72b2 100755 --- a/pdp_opencv_dft.c +++ b/pdp_opencv_dft.cc @@ -281,7 +281,7 @@ static void pdp_opencv_dft_process(t_pdp_opencv_dft *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); x->x_packet2 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_dft_process_rgb, pdp_opencv_dft_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_dft_process_rgb, (void*)pdp_opencv_dft_sendpacket, &x->x_queue_id); break; default: @@ -303,7 +303,7 @@ static void pdp_opencv_dft_input_0(t_pdp_opencv_dft *x, t_symbol *s, t_floatarg /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_distrans.c b/pdp_opencv_distrans.cc index 4fa2aba..21c868b 100644..100755 --- a/pdp_opencv_distrans.c +++ b/pdp_opencv_distrans.cc @@ -240,7 +240,7 @@ static void pdp_opencv_distrans_process(t_pdp_opencv_distrans *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_distrans_process_rgb, pdp_opencv_distrans_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_distrans_process_rgb, (void*)pdp_opencv_distrans_sendpacket, &x->x_queue_id); break; default: @@ -257,7 +257,7 @@ static void pdp_opencv_distrans_input_0(t_pdp_opencv_distrans *x, t_symbol *s, t /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_edge.c b/pdp_opencv_edge.cc index d227381..fd2d3a3 100644..100755 --- a/pdp_opencv_edge.c +++ b/pdp_opencv_edge.cc @@ -166,7 +166,7 @@ static void pdp_opencv_edge_process(t_pdp_opencv_edge *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_edge_process_rgb, pdp_opencv_edge_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_edge_process_rgb, (void*)pdp_opencv_edge_sendpacket, &x->x_queue_id); break; default: @@ -183,7 +183,7 @@ static void pdp_opencv_edge_input_0(t_pdp_opencv_edge *x, t_symbol *s, t_floatar /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_floodfill.c b/pdp_opencv_floodfill.cc index c1c6b76..2d92a3c 100644..100755 --- a/pdp_opencv_floodfill.c +++ b/pdp_opencv_floodfill.cc @@ -177,7 +177,7 @@ static void pdp_opencv_floodfill_process(t_pdp_opencv_floodfill *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_floodfill_process_rgb, pdp_opencv_floodfill_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_floodfill_process_rgb, (void*)pdp_opencv_floodfill_sendpacket, &x->x_queue_id); break; default: @@ -194,7 +194,7 @@ static void pdp_opencv_floodfill_input_0(t_pdp_opencv_floodfill *x, t_symbol *s, /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_haarcascade.c b/pdp_opencv_haarcascade.cc index 1c1edc6..cafc2fb 100644..100755 --- a/pdp_opencv_haarcascade.c +++ b/pdp_opencv_haarcascade.cc @@ -333,7 +333,7 @@ static void pdp_opencv_haarcascade_process(t_pdp_opencv_haarcascade *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_haarcascade_process_rgb, pdp_opencv_haarcascade_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_haarcascade_process_rgb, (void*)pdp_opencv_haarcascade_sendpacket, &x->x_queue_id); break; default: @@ -350,7 +350,7 @@ static void pdp_opencv_haarcascade_input_0(t_pdp_opencv_haarcascade *x, t_symbol /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_hist_compare.c b/pdp_opencv_hist_compare.cc index e08c7be..9a68e9a 100644..100755 --- a/pdp_opencv_hist_compare.c +++ b/pdp_opencv_hist_compare.cc @@ -260,7 +260,7 @@ static void pdp_opencv_hist_compare_process(t_pdp_opencv_hist_compare *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_hist_compare_process_rgb, pdp_opencv_hist_compare_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_hist_compare_process_rgb, (void*)pdp_opencv_hist_compare_sendpacket, &x->x_queue_id); break; default: @@ -277,7 +277,7 @@ static void pdp_opencv_hist_compare_input_0(t_pdp_opencv_hist_compare *x, t_symb /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_hu_moments.c b/pdp_opencv_hu_moments.cc index b64a2f5..662bf32 100755 --- a/pdp_opencv_hu_moments.c +++ b/pdp_opencv_hu_moments.cc @@ -147,7 +147,7 @@ static void pdp_opencv_hu_moments_process(t_pdp_opencv_hu_moments *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_hu_moments_process_rgb, pdp_opencv_hu_moments_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_hu_moments_process_rgb, (void*)pdp_opencv_hu_moments_sendpacket, &x->x_queue_id); break; default: @@ -164,7 +164,7 @@ static void pdp_opencv_hu_moments_input_0(t_pdp_opencv_hu_moments *x, t_symbol * /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_laplace.c b/pdp_opencv_laplace.cc index 688fe9e..91cb07f 100644..100755 --- a/pdp_opencv_laplace.c +++ b/pdp_opencv_laplace.cc @@ -149,7 +149,7 @@ static void pdp_opencv_laplace_process(t_pdp_opencv_laplace *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_laplace_process_rgb, pdp_opencv_laplace_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_laplace_process_rgb, (void*)pdp_opencv_laplace_sendpacket, &x->x_queue_id); break; default: @@ -166,7 +166,7 @@ static void pdp_opencv_laplace_input_0(t_pdp_opencv_laplace *x, t_symbol *s, t_f /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_lk.c b/pdp_opencv_lk.cc index 6f08444..432c4e7 100644..100755 --- a/pdp_opencv_lk.c +++ b/pdp_opencv_lk.cc @@ -561,7 +561,7 @@ static void pdp_opencv_lk_process(t_pdp_opencv_lk *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_lk_process_rgb, pdp_opencv_lk_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_lk_process_rgb, (void*)pdp_opencv_lk_sendpacket, &x->x_queue_id); break; default: @@ -578,7 +578,7 @@ static void pdp_opencv_lk_input_0(t_pdp_opencv_lk *x, t_symbol *s, t_floatarg f) /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_morphology.c b/pdp_opencv_morphology.cc index 6e4b9bc..4fada73 100644..100755 --- a/pdp_opencv_morphology.c +++ b/pdp_opencv_morphology.cc @@ -202,7 +202,7 @@ static void pdp_opencv_morphology_process(t_pdp_opencv_morphology *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_morphology_process_rgb, pdp_opencv_morphology_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_morphology_process_rgb, (void*)pdp_opencv_morphology_sendpacket, &x->x_queue_id); break; default: @@ -219,7 +219,7 @@ static void pdp_opencv_morphology_input_0(t_pdp_opencv_morphology *x, t_symbol * /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_motempl.c b/pdp_opencv_motempl.cc index 53808f9..5af970e 100644..100755 --- a/pdp_opencv_motempl.c +++ b/pdp_opencv_motempl.cc @@ -347,7 +347,7 @@ static void pdp_opencv_motempl_process(t_pdp_opencv_motempl *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_motempl_process_rgb, pdp_opencv_motempl_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_motempl_process_rgb, (void*)pdp_opencv_motempl_sendpacket, &x->x_queue_id); break; default: @@ -364,7 +364,7 @@ static void pdp_opencv_motempl_input_0(t_pdp_opencv_motempl *x, t_symbol *s, t_f /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { diff --git a/pdp_opencv_threshold.c b/pdp_opencv_threshold.cc index 7773a4a..80d418f 100644..100755 --- a/pdp_opencv_threshold.c +++ b/pdp_opencv_threshold.cc @@ -169,7 +169,7 @@ static void pdp_opencv_threshold_process(t_pdp_opencv_threshold *x) case PDP_BITMAP_RGB: x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); - pdp_queue_add(x, pdp_opencv_threshold_process_rgb, pdp_opencv_threshold_sendpacket, &x->x_queue_id); + pdp_queue_add(x, (void*)pdp_opencv_threshold_process_rgb, (void*)pdp_opencv_threshold_sendpacket, &x->x_queue_id); break; default: @@ -186,7 +186,7 @@ static void pdp_opencv_threshold_input_0(t_pdp_opencv_threshold *x, t_symbol *s, /* if this is a register_ro message or register_rw message, register with packet factory */ if (s == gensym("register_rw")) - x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("bitmap/rgb/*") ); + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym((char*)"bitmap/rgb/*") ); if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) { |