diff options
author | N.N. <sevyves@users.sourceforge.net> | 2009-09-02 21:42:01 +0000 |
---|---|---|
committer | N.N. <sevyves@users.sourceforge.net> | 2009-09-02 21:42:01 +0000 |
commit | f1531ff7bb1b23443b3b8492ae48b1e43ce451fa (patch) | |
tree | 67c252fc4a9978f3208139fa429a5ad5d1bd977e | |
parent | 3665beb5e68906fd62a88ebee278f1353c0d4364 (diff) |
added contours comparison objects : hu_compare and pgh_compare
svn path=/trunk/externals/pix_opencv/; revision=12196
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | pix_opencv_athreshold.h | 8 | ||||
-rwxr-xr-x | pix_opencv_bgstats.h | 6 | ||||
-rwxr-xr-x | pix_opencv_camshift.h | 6 | ||||
-rw-r--r-- | pix_opencv_contours_boundingrect.h | 4 | ||||
-rw-r--r-- | pix_opencv_contours_convexity.h | 4 | ||||
-rwxr-xr-x | pix_opencv_dft.h | 8 | ||||
-rw-r--r-- | pix_opencv_distrans.h | 4 | ||||
-rw-r--r-- | pix_opencv_edge.h | 4 | ||||
-rwxr-xr-x | pix_opencv_floodfill.h | 8 | ||||
-rw-r--r-- | pix_opencv_haarcascade.h | 8 | ||||
-rwxr-xr-x | pix_opencv_hist_compare.h | 6 | ||||
-rwxr-xr-x | pix_opencv_hu_compare-help.pd | 170 | ||||
-rwxr-xr-x | pix_opencv_hu_compare.cc | 460 | ||||
-rwxr-xr-x | pix_opencv_hu_compare.h | 89 | ||||
-rwxr-xr-x | pix_opencv_knear.h | 6 | ||||
-rw-r--r-- | pix_opencv_laplace.h | 4 | ||||
-rwxr-xr-x | pix_opencv_lk.h | 4 | ||||
-rw-r--r-- | pix_opencv_morphology.h | 4 | ||||
-rw-r--r-- | pix_opencv_motempl.h | 4 | ||||
-rwxr-xr-x | pix_opencv_pgh_compare-help.pd | 162 | ||||
-rwxr-xr-x | pix_opencv_pgh_compare.cc | 473 | ||||
-rwxr-xr-x | pix_opencv_pgh_compare.h | 86 | ||||
-rw-r--r-- | pix_opencv_threshold.h | 8 |
24 files changed, 1489 insertions, 49 deletions
@@ -35,7 +35,7 @@ endif .SUFFIXES = $(EXTENSION) -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 +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 all: $(SOURCES:.cc=.$(EXTENSION)) diff --git a/pix_opencv_athreshold.h b/pix_opencv_athreshold.h index 87c8e40..071449c 100644 --- a/pix_opencv_athreshold.h +++ b/pix_opencv_athreshold.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Adaptive threshold object Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -13,8 +13,8 @@ LOG -----------------------------------------------------------------*/ -#ifndef INCLUDE_PIX_OPENCV_EDGE_H_ -#define INCLUDE_PIX_OPENCV_EDGE_H_ +#ifndef INCLUDE_PIX_OPENCV_ATHRESHOLD_H_ +#define INCLUDE_PIX_OPENCV_ATHRESHOLD_H_ #include "Base/GemPixObj.h" @@ -27,7 +27,7 @@ LOG CLASS pix_opencv_athreshold - Adapative threshold object + Adaptive threshold object KEYWORDS pix diff --git a/pix_opencv_bgstats.h b/pix_opencv_bgstats.h index 9d1aff3..09bbf80 100755 --- a/pix_opencv_bgstats.h +++ b/pix_opencv_bgstats.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Statistical background substraction Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -13,8 +13,8 @@ LOG -----------------------------------------------------------------*/ -#ifndef INCLUDE_PIX_OPENCV_BGSUBSTRACT_H_ -#define INCLUDE_PIX_OPENCV_BGSUBSTRACT_H_ +#ifndef INCLUDE_PIX_OPENCV_BGSTATS_H +#define INCLUDE_PIX_OPENCV_BGSTATS_H #include "Base/GemPixObj.h" diff --git a/pix_opencv_camshift.h b/pix_opencv_camshift.h index 6dd4a83..5ec988e 100755 --- a/pix_opencv_camshift.h +++ b/pix_opencv_camshift.h @@ -13,8 +13,8 @@ LOG -----------------------------------------------------------------*/ -#ifndef INCLUDE_PIX_OPENCV_LK_H_ -#define INCLUDE_PIX_OPENCV_LK_H_ +#ifndef INCLUDE_PIX_OPENCV_CAMSHIFT_H_ +#define INCLUDE_PIX_OPENCV_CAMSHIFT_H_ #include "Base/GemPixObj.h" @@ -30,7 +30,7 @@ const int MAX_COUNT = 500; CLASS pix_opencv_camshift - Change pix to greyscale + Continously adaptive mean-shift tracker KEYWORDS pix diff --git a/pix_opencv_contours_boundingrect.h b/pix_opencv_contours_boundingrect.h index 81517b9..0c23402 100644 --- a/pix_opencv_contours_boundingrect.h +++ b/pix_opencv_contours_boundingrect.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Contours Bounding Rectangle detection Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -29,7 +29,7 @@ LOG CLASS pix_opencv_contours_boundingrect - Change pix to greyscale + Contours Bounding Rectangle detection KEYWORDS pix diff --git a/pix_opencv_contours_convexity.h b/pix_opencv_contours_convexity.h index 51bef59..045cb96 100644 --- a/pix_opencv_contours_convexity.h +++ b/pix_opencv_contours_convexity.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Contours convexity detection Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -27,7 +27,7 @@ LOG CLASS pix_opencv_contours_convexity - Change pix to greyscale + Contours convexity detection KEYWORDS pix diff --git a/pix_opencv_dft.h b/pix_opencv_dft.h index a3c4a08..6af0a5e 100755 --- a/pix_opencv_dft.h +++ b/pix_opencv_dft.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Discrete Fourier Transform Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -13,8 +13,8 @@ LOG -----------------------------------------------------------------*/ -#ifndef INCLUDE_PIX_OPENCV_DISTRANS_H_ -#define INCLUDE_PIX_OPENCV_DISTRANS_H_ +#ifndef INCLUDE_PIX_OPENCV_DFT_H_ +#define INCLUDE_PIX_OPENCV_DFT_H_ #include "Base/GemPixObj.h" @@ -27,7 +27,7 @@ LOG CLASS pix_opencv_dft - Change pix to greyscale + Discrete Fourier Transform KEYWORDS pix diff --git a/pix_opencv_distrans.h b/pix_opencv_distrans.h index 491df0f..ef283ff 100644 --- a/pix_opencv_distrans.h +++ b/pix_opencv_distrans.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Distrans algorithm Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -27,7 +27,7 @@ LOG CLASS pix_opencv_distrans - Change pix to greyscale + Distrans algorithm KEYWORDS pix diff --git a/pix_opencv_edge.h b/pix_opencv_edge.h index e76fcb4..e67de6c 100644 --- a/pix_opencv_edge.h +++ b/pix_opencv_edge.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Edge detection Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -27,7 +27,7 @@ LOG CLASS pix_opencv_edge - Change pix to greyscale + Edge detection KEYWORDS pix diff --git a/pix_opencv_floodfill.h b/pix_opencv_floodfill.h index c265f10..380730a 100755 --- a/pix_opencv_floodfill.h +++ b/pix_opencv_floodfill.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Color blob tracker Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -13,8 +13,8 @@ LOG -----------------------------------------------------------------*/ -#ifndef INCLUDE_PIX_OPENCV_LK_H_ -#define INCLUDE_PIX_OPENCV_LK_H_ +#ifndef INCLUDE_PIX_OPENCV_FLOODFILL_H_ +#define INCLUDE_PIX_OPENCV_FLOODFILL_H_ #include "Base/GemPixObj.h" @@ -29,7 +29,7 @@ LOG CLASS pix_opencv_floodfill - Color blobs tracker + Color blob tracker KEYWORDS pix diff --git a/pix_opencv_haarcascade.h b/pix_opencv_haarcascade.h index 640a6b4..ecdc92e 100644 --- a/pix_opencv_haarcascade.h +++ b/pix_opencv_haarcascade.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Trained classifier using Haar's cascade Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -13,8 +13,8 @@ LOG -----------------------------------------------------------------*/ -#ifndef INCLUDE_PIX_OPENCV_FACEDETECT_H_ -#define INCLUDE_PIX_OPENCV_FACEDETECT_H_ +#ifndef INCLUDE_PIX_OPENCV_HAARSCASCADE_H_ +#define INCLUDE_PIX_OPENCV_HAARSCASCADE_H_ #include "Base/GemPixObj.h" @@ -31,7 +31,7 @@ const char* cascade_name ="./haarcascade_frontalface_alt.xml"; CLASS pix_opencv_haarcascade - Change pix to greyscale + Trained classifier using Haar's cascade KEYWORDS pix diff --git a/pix_opencv_hist_compare.h b/pix_opencv_hist_compare.h index 7e07f0b..987dff3 100755 --- a/pix_opencv_hist_compare.h +++ b/pix_opencv_hist_compare.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Histogram reognition object using Open CV Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -13,8 +13,8 @@ LOG -----------------------------------------------------------------*/ -#ifndef INCLUDE_PIX_OPENCV_HISTO_H_ -#define INCLUDE_PIX_OPENCV_HISTO_H_ +#ifndef INCLUDE_PIX_OPENCV_HIST_COMPARE_H_ +#define INCLUDE_PIX_OPENCV_HIST_COMPARE_H_ #include "Base/GemPixObj.h" diff --git a/pix_opencv_hu_compare-help.pd b/pix_opencv_hu_compare-help.pd new file mode 100755 index 0000000..cf36bcc --- /dev/null +++ b/pix_opencv_hu_compare-help.pd @@ -0,0 +1,170 @@ +#N canvas 98 117 1154 642 10; +#X obj 821 9 gemhead; +#X obj 372 500 pix_texture; +#X obj 372 528 square 2; +#X obj 9 -28 cnv 15 220 70 empty empty empty 20 12 0 14 -195568 -66577 +0; +#N canvas 0 22 454 304 gemwin 0; +#X obj 67 89 outlet; +#X obj 67 10 inlet; +#X obj 67 41 route create; +#X msg 67 70 set destroy; +#X msg 182 68 set create; +#N canvas 87 154 247 179 Gem.init 0; +#X obj 118 46 loadbang; +#X msg 118 81 reset; +#X obj 118 113 outlet; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X restore 289 80 pd Gem.init; +#X obj 160 260 gemwin; +#X msg 159 207 create \, 1; +#X msg 235 208 destroy; +#X msg 281 180 frame 15; +#X obj 162 170 t b b b; +#X connect 1 0 2 0; +#X connect 2 0 3 0; +#X connect 2 0 10 0; +#X connect 2 1 4 0; +#X connect 2 1 8 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 7 0 6 0; +#X connect 8 0 6 0; +#X connect 9 0 6 0; +#X connect 10 0 7 0; +#X connect 10 2 9 0; +#X restore 14 16 pd gemwin; +#X msg 14 -5 create; +#X text 15 -23 Create window and render; +#X obj 363 232 cnv 15 700 250 empty empty empty 20 12 0 14 -24198 -66577 +0; +#X obj 485 -90 bng 25 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 542 85 bng 15 250 50 0 empty empty end_reached 20 7 0 10 -262144 +-1 -1; +#X floatatom 524 50 5 0 10000 1 frame# - -; +#X obj 485 -61 openpanel; +#X msg 485 -41 open \$1; +#X obj 473 68 pix_film; +#X msg 491 2 auto \$1; +#X obj 491 -16 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 554 2 loadbang; +#X msg 502 26 colorspace RGBA; +#X obj 373 395 pix_opencv_hu_compare; +#X floatatom 506 439 30 0 0 0 - - -; +#X text 511 422 distance; +#X obj 722 457 route 1; +#X obj 774 457 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 683 458 < 0.1; +#X obj 783 437 hsl 128 15 0 0.2 0 0 cdist empty empty -2 -8 0 10 -262144 +-1 -1 0 1; +#X text 696 420 criteria value; +#X floatatom 701 439 10 0 0 0 - - -; +#X text 528 376 calculating their hu moments ( CvMatchShape ); +#X text 527 364 compares the contours to the pattern reference contour +; +#X msg 511 333 criteria \$1; +#X obj 595 334 r cdist; +#X text 648 328 criteria value under which the contour is recongnized +; +#X text 646 339 ( adjust to your situation : default : 0.1 ); +#X obj 575 283 hradio 15 1 0 3 empty empty empty 0 -8 0 10 -262144 +-1 -1 0; +#X text 626 277 method used for comparison : one of : CV_CONTOURS_MATCH_I1 +\, CV_CONTOURS_MATCH_I2 or CV_CONTOURS_MATCH_I3; +#X obj 547 282 + 1; +#X msg 477 282 method \$1; +#X msg 463 255 minsize \$1; +#X floatatom 537 256 5 0 0 0 - - -; +#X text 578 256 minimum size of selected contours ( default : 10x10 +); +#X msg 513 304 clear; +#X text 621 304 recalculates the pattern contour; +#X obj 562 305 r reset; +#X text 12 -57 Written by Yves Degoyon ( ydegoyon@gmail.com ); +#X text 13 -85 pix_opencv_hu_compare :: compare contours using their +hu moments using CvMatchShape.; +#X text 532 -88 playing a video file; +#X text 550 -75 ( try estrella.mov ); +#X msg 755 -67 bang; +#X text 801 -74 loading a pattern image; +#X text 800 -61 ( try estrella.jpg ); +#X text 754 -92 Compare to a pattern; +#X obj 755 9 pix_image; +#X obj 757 -40 openpanel; +#X obj 755 159 separator; +#X msg 756 -13 open \$1; +#X floatatom 908 126 5 0 0 0 - - -; +#X text 946 125 threshold (default 13) to use when comparing pixel +colors; +#X obj 976 99 loadbang; +#X msg 945 99 160; +#X obj 877 98 r tresh; +#X floatatom 606 154 5 0 0 0 - - -; +#X obj 674 152 loadbang; +#X msg 646 152 160; +#X obj 607 172 s tresh; +#X obj 886 158 pix_texture; +#X obj 754 125 pix_opencv_threshold; +#X obj 473 173 pix_opencv_threshold; +#X obj 886 186 square 2; +#X obj 754 71 translateXYZ -2 0 0; +#X obj 755 39 pix_resize 320 240; +#X obj 755 186 translateXYZ 4 0 0; +#X obj 474 122 pix_resize 320 240; +#X connect 0 0 51 0; +#X connect 1 0 2 0; +#X connect 4 0 5 0; +#X connect 5 0 4 0; +#X connect 8 0 11 0; +#X connect 9 0 10 0; +#X connect 10 0 13 1; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 13 0 71 0; +#X connect 13 2 9 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 16 0 17 0; +#X connect 17 0 13 0; +#X connect 18 0 1 0; +#X connect 18 1 19 0; +#X connect 19 0 23 0; +#X connect 21 0 22 0; +#X connect 23 0 21 0; +#X connect 24 0 23 1; +#X connect 24 0 26 0; +#X connect 29 0 18 0; +#X connect 30 0 29 0; +#X connect 33 0 35 0; +#X connect 35 0 36 0; +#X connect 36 0 18 0; +#X connect 37 0 18 0; +#X connect 38 0 37 0; +#X connect 40 0 18 0; +#X connect 42 0 40 0; +#X connect 47 0 52 0; +#X connect 51 0 69 0; +#X connect 52 0 54 0; +#X connect 53 0 70 0; +#X connect 54 0 51 0; +#X connect 55 0 65 2; +#X connect 57 0 58 0; +#X connect 58 0 55 0; +#X connect 59 0 55 0; +#X connect 60 0 63 0; +#X connect 60 0 66 2; +#X connect 61 0 62 0; +#X connect 62 0 60 0; +#X connect 64 0 67 0; +#X connect 65 0 53 0; +#X connect 65 0 64 0; +#X connect 65 0 18 1; +#X connect 66 0 18 0; +#X connect 68 0 65 0; +#X connect 69 0 68 0; +#X connect 70 0 13 0; +#X connect 71 0 66 0; diff --git a/pix_opencv_hu_compare.cc b/pix_opencv_hu_compare.cc new file mode 100755 index 0000000..03e91b5 --- /dev/null +++ b/pix_opencv_hu_compare.cc @@ -0,0 +1,460 @@ +//////////////////////////////////////////////////////// +// +// GEM - Graphics Environment for Multimedia +// +// zmoelnig@iem.kug.ac.at +// +// Implementation file +// +// Copyright (c) 1997-1998 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_hu_compare.h" + +CPPEXTERN_NEW_WITH_GIMME(pix_opencv_hu_compare) + +///////////////////////////////////////////////////////// +// +// pix_opencv_hu_compare +// +///////////////////////////////////////////////////////// +// Constructor +// +///////////////////////////////////////////////////////// +pix_opencv_hu_compare :: pix_opencv_hu_compare(int argc, t_atom*argv) +{ + m_dataout = outlet_new(this->x_obj, &s_anything); + + comp_xsize=320; + comp_ysize=240; + + rgba = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgb = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + gray = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + rgbar = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgbr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + grayr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + + x_method = CV_CONTOURS_MATCH_I1; + x_storage = cvCreateMemStorage(0); + + x_bcontourr = NULL; + x_minsize = 10*10; + x_cdistance = 0.1; +} + +///////////////////////////////////////////////////////// +// Destructor +// +///////////////////////////////////////////////////////// +pix_opencv_hu_compare :: ~pix_opencv_hu_compare() +{ + cvReleaseImage(&rgba); + cvReleaseImage(&rgb); + cvReleaseImage(&gray); + cvReleaseImage(&rgbar); + cvReleaseImage(&rgbr); + cvReleaseImage(&grayr); +} + +///////////////////////////////////////////////////////// +// processDualImage +// +///////////////////////////////////////////////////////// +void pix_opencv_hu_compare :: processRGBA_RGBA(imageStruct &left, imageStruct &right) +{ + double dist = 100.0, ndist; + int i = 0; // Indicator of cycles. + CvSeq *contourl=NULL, *contourlp; + CvRect rect; + CvMemStorage *mstorage; + CvSeq *contourr = NULL; + int size; + + if ((left.xsize!=right.xsize) || (left.ysize!=right.ysize) ) + { + post( "pix_opencv_hu_compare : left and right image are not of the same size" ); + return; + } + + if ((this->comp_xsize!=left.xsize)&&(this->comp_ysize!=left.ysize)) + { + this->comp_xsize=left.xsize; + this->comp_ysize=left.ysize; + + cvReleaseImage(&rgba); + cvReleaseImage(&rgb); + cvReleaseImage(&gray); + cvReleaseImage(&rgbar); + cvReleaseImage(&rgbr); + cvReleaseImage(&grayr); + + rgba = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgb = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + gray = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + rgbar = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgbr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + grayr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + } + + memcpy( rgbar->imageData, right.data, right.xsize*right.ysize*4 ); + cvCvtColor(rgbar, grayr, CV_BGRA2GRAY); + + // calculate the biggest contour + try { + cvFindContours( grayr, x_storage, &contourr, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + } + catch(...) { + post( "pix_opencv_hu_compare : error calculating contours" ); + return; + } + + if ( contourr ) + { + size=0; + for( ; contourr != 0; contourr = contourr->h_next ) + { + rect = cvContourBoundingRect( contourr, 1); + if ( rect.width*rect.height > size && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + x_bcontourr = contourr; + size = rect.width*rect.height; + } + } + } + + memcpy( rgba->imageData, left.data, left.xsize*left.ysize*4 ); + cvCvtColor(rgba, gray, CV_BGRA2GRAY); + + mstorage = cvCreateMemStorage(0); + + cvFindContours( gray, mstorage, &contourl, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + + if ( contourl && x_bcontourr ) + { + contourlp=contourl; + for( ; contourlp != 0; contourlp = contourlp->h_next ) + { + rect = cvContourBoundingRect( contourlp, 1); + if ( rect.width*rect.height > x_minsize && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + ndist = cvMatchShapes( x_bcontourr, contourlp, x_method, 0 ); + if ( ndist < dist ) dist = ndist; + if ( ndist < x_cdistance ) + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(255,255,255), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(255,255,255), CV_RGB(255,255,255), 0, 1, 8, cvPoint(0,0) ); + } + else + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(128,128,128), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(128,128,128), CV_RGB(128,128,128), 0, 1, 8, cvPoint(0,0) ); + } + } + } + } + + if ( dist < 100.00 ) outlet_float( m_dataout, dist ); + + cvReleaseMemStorage(&mstorage); + + cvCvtColor(gray, rgba, CV_GRAY2BGR); + memcpy( left.data, rgba->imageData, left.xsize*left.ysize*4 ); + +} + +///////////////////////////////////////////////////////// +// processDualImage +// +///////////////////////////////////////////////////////// +void pix_opencv_hu_compare :: processRGB_RGB(imageStruct &left, imageStruct &right) +{ + double dist = 100.0, ndist; + int i = 0; // Indicator of cycles. + CvSeq *contourl=NULL, *contourlp; + CvRect rect; + CvMemStorage *mstorage; + CvSeq *contourr = NULL; + int size; + + if ((left.xsize!=right.xsize) || (left.ysize!=right.ysize) ) + { + post( "pix_opencv_hu_compare : left and right image are not of the same size" ); + return; + } + + if ((this->comp_xsize!=left.xsize)&&(this->comp_ysize!=left.ysize)) + { + this->comp_xsize=left.xsize; + this->comp_ysize=left.ysize; + + cvReleaseImage(&rgba); + cvReleaseImage(&rgb); + cvReleaseImage(&gray); + cvReleaseImage(&rgbar); + cvReleaseImage(&rgbr); + cvReleaseImage(&grayr); + + rgba = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgb = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + gray = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + rgbar = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgbr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + grayr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + } + + memcpy( rgbr->imageData, right.data, right.xsize*right.ysize*3 ); + cvCvtColor(rgbr, grayr, CV_BGRA2GRAY); + + // calculate the biggest contour + try { + cvFindContours( grayr, x_storage, &contourr, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + } + catch(...) { + post( "pix_opencv_hu_compare : error calculating contours" ); + return; + } + + if ( contourr ) + { + size=0; + for( ; contourr != 0; contourr = contourr->h_next ) + { + rect = cvContourBoundingRect( contourr, 1); + if ( rect.width*rect.height > size && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + x_bcontourr = contourr; + size = rect.width*rect.height; + } + } + } + + memcpy( rgb->imageData, left.data, left.xsize*left.ysize*3 ); + cvCvtColor(rgb, gray, CV_BGRA2GRAY); + + mstorage = cvCreateMemStorage(0); + + cvFindContours( gray, mstorage, &contourl, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + + if ( contourl && x_bcontourr ) + { + contourlp=contourl; + for( ; contourlp != 0; contourlp = contourlp->h_next ) + { + rect = cvContourBoundingRect( contourlp, 1); + if ( rect.width*rect.height > x_minsize && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + ndist = cvMatchShapes( x_bcontourr, contourlp, x_method, 0 ); + if ( ndist < dist ) dist = ndist; + if ( ndist < x_cdistance ) + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(255,255,255), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(255,255,255), CV_RGB(255,255,255), 0, 1, 8, cvPoint(0,0) ); + } + else + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(128,128,128), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(128,128,128), CV_RGB(128,128,128), 0, 1, 8, cvPoint(0,0) ); + } + } + } + } + + if ( dist < 100.00 ) outlet_float( m_dataout, dist ); + + cvReleaseMemStorage(&mstorage); + + cvCvtColor(gray, rgb, CV_GRAY2BGR); + memcpy( left.data, rgb->imageData, left.xsize*left.ysize*3 ); + +} + +///////////////////////////////////////////////////////// +// processDualImage +// +///////////////////////////////////////////////////////// +void pix_opencv_hu_compare :: processGray_Gray(imageStruct &left, imageStruct &right) +{ + double dist = 100.0, ndist; + int i = 0; // Indicator of cycles. + CvSeq *contourl=NULL, *contourlp; + CvRect rect; + CvMemStorage *mstorage; + CvSeq *contourr = NULL; + int size; + + if ((left.xsize!=right.xsize) || (left.ysize!=right.ysize) ) + { + post( "pix_opencv_hu_compare : left and right image are not of the same size" ); + return; + } + + if ((this->comp_xsize!=left.xsize)&&(this->comp_ysize!=left.ysize)) + { + this->comp_xsize=left.xsize; + this->comp_ysize=left.ysize; + + cvReleaseImage(&rgba); + cvReleaseImage(&rgb); + cvReleaseImage(&gray); + cvReleaseImage(&rgbar); + cvReleaseImage(&rgbr); + cvReleaseImage(&grayr); + + rgba = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgb = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + gray = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + rgbar = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgbr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + grayr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + } + + memcpy( grayr->imageData, right.data, right.xsize*right.ysize ); + + // calculate the biggest contour + try { + cvFindContours( grayr, x_storage, &contourr, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + } + catch(...) { + post( "pix_opencv_hu_compare : error calculating contours" ); + return; + } + + if ( contourr ) + { + size=0; + for( ; contourr != 0; contourr = contourr->h_next ) + { + rect = cvContourBoundingRect( contourr, 1); + if ( rect.width*rect.height > size && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + x_bcontourr = contourr; + size = rect.width*rect.height; + } + } + } + + memcpy( gray->imageData, left.data, left.xsize*left.ysize ); + + mstorage = cvCreateMemStorage(0); + + cvFindContours( gray, mstorage, &contourl, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + + if ( contourl && x_bcontourr ) + { + contourlp=contourl; + for( ; contourlp != 0; contourlp = contourlp->h_next ) + { + rect = cvContourBoundingRect( contourlp, 1); + if ( rect.width*rect.height > x_minsize && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + ndist = cvMatchShapes( x_bcontourr, contourlp, x_method, 0 ); + if ( ndist < dist ) dist = ndist; + if ( ndist < x_cdistance ) + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(255,255,255), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(255,255,255), CV_RGB(255,255,255), 0, 1, 8, cvPoint(0,0) ); + } + else + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(128,128,128), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(128,128,128), CV_RGB(128,128,128), 0, 1, 8, cvPoint(0,0) ); + } + } + } + } + + if ( dist < 100.00 ) outlet_float( m_dataout, dist ); + + cvReleaseMemStorage(&mstorage); + + memcpy( left.data, gray->imageData, left.xsize*left.ysize ); + +} + +void pix_opencv_hu_compare :: processYUV_YUV(imageStruct &left, imageStruct &right) +{ + post( "pix_opencv_hu_compare : YUV colorspace not supported" ); +} + +///////////////////////////////////////////////////////// +// static member function +// +///////////////////////////////////////////////////////// +void pix_opencv_hu_compare :: obj_setupCallback(t_class *classPtr) +{ + class_addmethod(classPtr, (t_method)&pix_opencv_hu_compare::floatMethodMessCallback, + gensym("gain"), A_FLOAT, A_NULL); + class_addmethod(classPtr, (t_method)&pix_opencv_hu_compare::floatMinSizeMessCallback, + gensym("minsize"), A_FLOAT, A_NULL); + class_addmethod(classPtr, (t_method)&pix_opencv_hu_compare::clearMessCallback, + gensym("clear"), A_NULL); + class_addmethod(classPtr, (t_method)&pix_opencv_hu_compare::floatCriteriaMessCallback, + gensym("criteria"), A_FLOAT, A_NULL); +} + +void pix_opencv_hu_compare :: floatMethodMessCallback(void *data, t_floatarg method) +{ + GetMyClass(data)->floatMethodMess((float)method); +} + +void pix_opencv_hu_compare :: floatMinSizeMessCallback(void *data, t_floatarg minsize) +{ + GetMyClass(data)->floatMinSizeMess((float)minsize); +} + +void pix_opencv_hu_compare :: clearMessCallback(void *data) +{ + GetMyClass(data)->clearMess(); +} + +void pix_opencv_hu_compare :: floatCriteriaMessCallback(void *data, t_floatarg criteria) +{ + GetMyClass(data)->floatCriteriaMess((float)criteria); +} + +void pix_opencv_hu_compare :: floatMethodMess(float method) +{ + if ((int)method==CV_CONTOURS_MATCH_I1) + { + post( "pix_opencv_hu_compare : method set to CV_CONTOURS_MATCH_I1" ); + x_method = (int)method; + } + if ((int)method==CV_CONTOURS_MATCH_I2) + { + post( "pix_opencv_hu_compare : method set to CV_CONTOURS_MATCH_I2" ); + x_method = (int)method; + } + if ((int)method==CV_CONTOURS_MATCH_I3) + { + post( "pix_opencv_hu_compare : method set to CV_CONTOURS_MATCH_I3" ); + x_method = (int)method; + } +} + +void pix_opencv_hu_compare :: floatMinSizeMess(float minsize) +{ + if ( (int)minsize > 0 ) + { + x_minsize = (int)minsize; + } +} + +void pix_opencv_hu_compare :: clearMess(void) +{ + x_bcontourr = NULL; +} + +void pix_opencv_hu_compare :: floatCriteriaMess(float criteria) +{ + if ( criteria > 0.0 ) + { + x_cdistance = criteria; + } +} diff --git a/pix_opencv_hu_compare.h b/pix_opencv_hu_compare.h new file mode 100755 index 0000000..50dd20c --- /dev/null +++ b/pix_opencv_hu_compare.h @@ -0,0 +1,89 @@ +/*----------------------------------------------------------------- +LOG + GEM - Graphics Environment for Multimedia + + Hu moments comparison used to compare contours + + Copyright (c) 1997-1998 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_HU_COMPARE_H_ +#define INCLUDE_PIX_OPENCV_HU_COMPARE_H_ + +#include "Base/GemPixDualObj.h" + +#ifndef _EiC +#include "cv.h" +#endif + +/*----------------------------------------------------------------- +CLASS + pix_opencv_hu_compare + + Hu moments comparison used to compare contours + +-----------------------------------------------------------------*/ + +class GEM_EXTERN pix_opencv_hu_compare : public GemPixDualObj +{ + CPPEXTERN_HEADER(pix_opencv_hu_compare, GemPixDualObj) + + public: + + ////////// + // Constructor + pix_opencv_hu_compare(int,t_atom*); + + protected: + + ////////// + // Destructor + virtual ~pix_opencv_hu_compare(); + + ////////// + // Do the processing + virtual void processRGBA_RGBA(imageStruct &left, imageStruct &right); + virtual void processRGB_RGB(imageStruct &left, imageStruct &right); + virtual void processYUV_YUV(imageStruct &left, imageStruct &right); + virtual void processGray_Gray(imageStruct &left, imageStruct &right); + + ////////// + // change method used + void floatMethodMess(float method); + void floatMinSizeMess(float minsize); + void clearMess(void); + void floatCriteriaMess(float criteria); + + int comp_xsize; + int comp_ysize; + + t_outlet *m_dataout; + + int x_method; + int x_minsize; + float x_cdistance; + + private: + + ////////// + // Static member functions + static void floatMethodMessCallback(void *data, float method); + static void floatMinSizeMessCallback(void *data, float minsize); + static void clearMessCallback(void *data); + static void floatCriteriaMessCallback(void *data, float criteria); + + IplImage *rgba, *rgb, *gray; + IplImage *rgbar, *rgbr, *grayr; + + CvMemStorage *x_storage; + CvSeq *x_bcontourr; + +}; + +#endif // for header file diff --git a/pix_opencv_knear.h b/pix_opencv_knear.h index f66d4cd..faa9483 100755 --- a/pix_opencv_knear.h +++ b/pix_opencv_knear.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Simple distance classifier Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -13,8 +13,8 @@ LOG -----------------------------------------------------------------*/ -#ifndef INCLUDE_PIX_OPENCV_CVK_H_ -#define INCLUDE_PIX_OPENCV_CVK_H_ +#ifndef INCLUDE_PIX_OPENCV_KNEAR_H_ +#define INCLUDE_PIX_OPENCV_KNEAR_H_ #include "Base/GemPixObj.h" diff --git a/pix_opencv_laplace.h b/pix_opencv_laplace.h index b705211..674126b 100644 --- a/pix_opencv_laplace.h +++ b/pix_opencv_laplace.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Laplace transform / edge detection Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -27,7 +27,7 @@ LOG CLASS pix_opencv_laplace - Change pix to greyscale + Laplace transform / edge detection KEYWORDS pix diff --git a/pix_opencv_lk.h b/pix_opencv_lk.h index 13b8ba3..0a5c6e4 100755 --- a/pix_opencv_lk.h +++ b/pix_opencv_lk.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + LK point detection and tracking Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -30,7 +30,7 @@ const int MAX_COUNT = 500; CLASS pix_opencv_lk - Change pix to greyscale + LK point detection and tracking KEYWORDS pix diff --git a/pix_opencv_morphology.h b/pix_opencv_morphology.h index 2042750..be1e143 100644 --- a/pix_opencv_morphology.h +++ b/pix_opencv_morphology.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Morphology filter Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -27,7 +27,7 @@ LOG CLASS pix_opencv_morphology - Change pix to greyscale + Morphology filter KEYWORDS pix diff --git a/pix_opencv_motempl.h b/pix_opencv_motempl.h index e50d635..f8bf1cb 100644 --- a/pix_opencv_motempl.h +++ b/pix_opencv_motempl.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Motion detection based on motion history Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -32,7 +32,7 @@ LOG CLASS pix_opencv_motempl - Change pix to greyscale + Motion detection based on motion history KEYWORDS pix diff --git a/pix_opencv_pgh_compare-help.pd b/pix_opencv_pgh_compare-help.pd new file mode 100755 index 0000000..1209a6d --- /dev/null +++ b/pix_opencv_pgh_compare-help.pd @@ -0,0 +1,162 @@ +#N canvas 98 117 1154 642 10; +#X obj 821 9 gemhead; +#X obj 372 500 pix_texture; +#X obj 372 528 square 2; +#X obj 18 26 cnv 15 220 70 empty empty empty 20 12 0 14 -195568 -66577 +0; +#N canvas 0 22 454 304 gemwin 0; +#X obj 67 89 outlet; +#X obj 67 10 inlet; +#X obj 67 41 route create; +#X msg 67 70 set destroy; +#X msg 182 68 set create; +#N canvas 87 154 247 179 Gem.init 0; +#X obj 118 46 loadbang; +#X msg 118 81 reset; +#X obj 118 113 outlet; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X restore 289 80 pd Gem.init; +#X obj 160 260 gemwin; +#X msg 159 207 create \, 1; +#X msg 235 208 destroy; +#X msg 281 180 frame 15; +#X obj 162 170 t b b b; +#X connect 1 0 2 0; +#X connect 2 0 3 0; +#X connect 2 0 10 0; +#X connect 2 1 4 0; +#X connect 2 1 8 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 7 0 6 0; +#X connect 8 0 6 0; +#X connect 9 0 6 0; +#X connect 10 0 7 0; +#X connect 10 2 9 0; +#X restore 24 69 pd gemwin; +#X msg 24 48 create; +#X text 25 30 Create window and render; +#X obj 363 232 cnv 15 700 250 empty empty empty 20 12 0 14 -24198 -66577 +0; +#X obj 485 -90 bng 25 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 542 85 bng 15 250 50 0 empty empty end_reached 20 7 0 10 -262144 +-1 -1; +#X floatatom 524 50 5 0 10000 1 frame# - -; +#X obj 485 -61 openpanel; +#X msg 485 -41 open \$1; +#X obj 473 68 pix_film; +#X msg 491 2 auto \$1; +#X obj 491 -16 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 554 2 loadbang; +#X msg 502 26 colorspace RGBA; +#X floatatom 506 439 30 0 0 0 - - -; +#X text 511 422 distance; +#X obj 730 457 route 1; +#X obj 782 457 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 783 437 hsl 128 15 0 0.2 0 0 cdist empty empty -2 -8 0 10 -262144 +-1 -1 0 1; +#X text 696 420 criteria value; +#X floatatom 701 439 10 0 0 0 - - -; +#X text 528 376 calculating their hu moments ( CvMatchShape ); +#X text 527 364 compares the contours to the pattern reference contour +; +#X msg 478 319 criteria \$1; +#X obj 562 320 r cdist; +#X text 615 314 criteria value under which the contour is recongnized +; +#X msg 463 255 minsize \$1; +#X floatatom 537 256 5 0 0 0 - - -; +#X text 578 256 minimum size of selected contours ( default : 10x10 +); +#X msg 480 290 clear; +#X text 588 290 recalculates the pattern contour; +#X obj 529 291 r reset; +#X text 532 -88 playing a video file; +#X text 550 -75 ( try estrella.mov ); +#X msg 755 -67 bang; +#X text 801 -74 loading a pattern image; +#X text 800 -61 ( try estrella.jpg ); +#X text 754 -92 Compare to a pattern; +#X obj 755 9 pix_image; +#X obj 757 -40 openpanel; +#X obj 755 159 separator; +#X msg 756 -13 open \$1; +#X floatatom 908 126 5 0 0 0 - - -; +#X text 946 125 threshold (default 13) to use when comparing pixel +colors; +#X obj 976 99 loadbang; +#X msg 945 99 160; +#X obj 877 98 r tresh; +#X floatatom 606 154 5 0 0 0 - - -; +#X obj 674 152 loadbang; +#X msg 646 152 160; +#X obj 607 172 s tresh; +#X obj 886 158 pix_texture; +#X obj 754 125 pix_opencv_threshold; +#X obj 473 173 pix_opencv_threshold; +#X obj 886 186 square 2; +#X obj 754 71 translateXYZ -2 0 0; +#X obj 755 39 pix_resize 320 240; +#X obj 755 186 translateXYZ 4 0 0; +#X obj 474 122 pix_resize 320 240; +#X obj 374 395 pix_opencv_pgh_compare; +#X text 17 -80 pix_opencv_pgh_compare :: compare contours calculating +their PGH histograms.; +#X text 17 -53 Written by Yves Degoyon ( ydegoyon@gmail.com ) using +example code from OpenCV book; +#X obj 683 458 < 0.05; +#X text 612 326 ( adjust to your situation : default : 0.05 ); +#X connect 0 0 42 0; +#X connect 1 0 2 0; +#X connect 4 0 5 0; +#X connect 5 0 4 0; +#X connect 8 0 11 0; +#X connect 9 0 10 0; +#X connect 10 0 13 1; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 13 0 62 0; +#X connect 13 2 9 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 16 0 17 0; +#X connect 17 0 13 0; +#X connect 18 0 66 0; +#X connect 20 0 21 0; +#X connect 22 0 24 0; +#X connect 22 0 66 1; +#X connect 27 0 63 0; +#X connect 28 0 27 0; +#X connect 30 0 63 0; +#X connect 31 0 30 0; +#X connect 33 0 63 0; +#X connect 35 0 33 0; +#X connect 38 0 43 0; +#X connect 42 0 60 0; +#X connect 43 0 45 0; +#X connect 44 0 61 0; +#X connect 45 0 42 0; +#X connect 46 0 56 2; +#X connect 48 0 49 0; +#X connect 49 0 46 0; +#X connect 50 0 46 0; +#X connect 51 0 54 0; +#X connect 51 0 57 2; +#X connect 52 0 53 0; +#X connect 53 0 51 0; +#X connect 55 0 58 0; +#X connect 56 0 44 0; +#X connect 56 0 55 0; +#X connect 56 0 63 1; +#X connect 57 0 63 0; +#X connect 59 0 56 0; +#X connect 60 0 59 0; +#X connect 61 0 13 0; +#X connect 62 0 57 0; +#X connect 63 0 1 0; +#X connect 63 1 18 0; +#X connect 66 0 20 0; diff --git a/pix_opencv_pgh_compare.cc b/pix_opencv_pgh_compare.cc new file mode 100755 index 0000000..b4633a7 --- /dev/null +++ b/pix_opencv_pgh_compare.cc @@ -0,0 +1,473 @@ +//////////////////////////////////////////////////////// +// +// GEM - Graphics Environment for Multimedia +// +// zmoelnig@iem.kug.ac.at +// +// Implementation file +// +// Copyright (c) 1997-1998 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_pgh_compare.h" + +CPPEXTERN_NEW_WITH_GIMME(pix_opencv_pgh_compare) + +///////////////////////////////////////////////////////// +// +// pix_opencv_pgh_compare +// +///////////////////////////////////////////////////////// +// Constructor +// +///////////////////////////////////////////////////////// +pix_opencv_pgh_compare :: pix_opencv_pgh_compare(int argc, t_atom*argv) +{ + m_dataout = outlet_new(this->x_obj, &s_anything); + + comp_xsize=320; + comp_ysize=240; + + rgba = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgb = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + gray = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + rgbar = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgbr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + grayr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + + x_storage = cvCreateMemStorage(0); + + x_bcontourr = NULL; + x_minsize = 10*10; + x_cdistance = 0.05; +} + +///////////////////////////////////////////////////////// +// Destructor +// +///////////////////////////////////////////////////////// +pix_opencv_pgh_compare :: ~pix_opencv_pgh_compare() +{ + cvReleaseImage(&rgba); + cvReleaseImage(&rgb); + cvReleaseImage(&gray); + cvReleaseImage(&rgbar); + cvReleaseImage(&rgbr); + cvReleaseImage(&grayr); +} + +///////////////////////////////////////////////////////// +// processDualImage +// +///////////////////////////////////////////////////////// +void pix_opencv_pgh_compare :: processRGBA_RGBA(imageStruct &left, imageStruct &right) +{ + double dist = 100.0, ndist; + int i = 0; // Indicator of cycles. + CvSeq *contourl=NULL, *contourlp; + CvRect rect; + CvMemStorage *mstorage; + CvSeq *contourr = NULL; + int size; + int dims[] = {8, 8}; + float range[] = {-180, 180, -100, 100}; + float *ranges[] = {&range[0], &range[2]}; + CvHistogram *histl, *histr ; + + if ((left.xsize!=right.xsize) || (left.ysize!=right.ysize) ) + { + post( "pix_opencv_pgh_compare : left and right image are not of the same size" ); + return; + } + + if ((this->comp_xsize!=left.xsize)&&(this->comp_ysize!=left.ysize)) + { + this->comp_xsize=left.xsize; + this->comp_ysize=left.ysize; + + cvReleaseImage(&rgba); + cvReleaseImage(&rgb); + cvReleaseImage(&gray); + cvReleaseImage(&rgbar); + cvReleaseImage(&rgbr); + cvReleaseImage(&grayr); + + rgba = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgb = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + gray = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + rgbar = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgbr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + grayr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + } + + memcpy( rgbar->imageData, right.data, right.xsize*right.ysize*4 ); + cvCvtColor(rgbar, grayr, CV_BGRA2GRAY); + + // calculate the biggest contour + try { + cvFindContours( grayr, x_storage, &contourr, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + } + catch(...) { + post( "pix_opencv_pgh_compare : error calculating contours" ); + return; + } + + if ( contourr ) + { + size=0; + for( ; contourr != 0; contourr = contourr->h_next ) + { + rect = cvContourBoundingRect( contourr, 1); + if ( rect.width*rect.height > size && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + x_bcontourr = contourr; + size = rect.width*rect.height; + } + } + } + + memcpy( rgba->imageData, left.data, left.xsize*left.ysize*4 ); + cvCvtColor(rgba, gray, CV_BGRA2GRAY); + + mstorage = cvCreateMemStorage(0); + + cvFindContours( gray, mstorage, &contourl, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + + if ( contourl && x_bcontourr ) + { + contourlp=contourl; + for( ; contourlp != 0; contourlp = contourlp->h_next ) + { + rect = cvContourBoundingRect( contourlp, 1); + if ( rect.width*rect.height > x_minsize && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + histr = cvCreateHist(2, dims, CV_HIST_ARRAY, ranges, 1); + histl = cvCreateHist(2, dims, CV_HIST_ARRAY, ranges, 1); + cvCalcPGH(x_bcontourr, histr); + cvCalcPGH(contourlp, histl); + cvNormalizeHist(histr, 100.0f); + cvNormalizeHist(histl, 100.0f); + ndist = cvCompareHist(histr, histl, CV_COMP_BHATTACHARYYA); + cvReleaseHist(&histr); + cvReleaseHist(&histl); + + if ( ndist < dist ) dist = ndist; + if ( ndist < x_cdistance ) + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(255,255,255), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(255,255,255), CV_RGB(255,255,255), 0, 1, 8, cvPoint(0,0) ); + } + else + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(128,128,128), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(128,128,128), CV_RGB(128,128,128), 0, 1, 8, cvPoint(0,0) ); + } + } + } + } + + if ( dist < 100.00 ) outlet_float( m_dataout, dist ); + + cvReleaseMemStorage(&mstorage); + + cvCvtColor(gray, rgba, CV_GRAY2BGR); + memcpy( left.data, rgba->imageData, left.xsize*left.ysize*4 ); + +} + +///////////////////////////////////////////////////////// +// processDualImage +// +///////////////////////////////////////////////////////// +void pix_opencv_pgh_compare :: processRGB_RGB(imageStruct &left, imageStruct &right) +{ + double dist = 100.0, ndist; + int i = 0; // Indicator of cycles. + CvSeq *contourl=NULL, *contourlp; + CvRect rect; + CvMemStorage *mstorage; + CvSeq *contourr = NULL; + int size; + int dims[] = {8, 8}; + float range[] = {-180, 180, -100, 100}; + float *ranges[] = {&range[0], &range[2]}; + CvHistogram *histl, *histr ; + + if ((left.xsize!=right.xsize) || (left.ysize!=right.ysize) ) + { + post( "pix_opencv_pgh_compare : left and right image are not of the same size" ); + return; + } + + if ((this->comp_xsize!=left.xsize)&&(this->comp_ysize!=left.ysize)) + { + this->comp_xsize=left.xsize; + this->comp_ysize=left.ysize; + + cvReleaseImage(&rgba); + cvReleaseImage(&rgb); + cvReleaseImage(&gray); + cvReleaseImage(&rgbar); + cvReleaseImage(&rgbr); + cvReleaseImage(&grayr); + + rgba = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgb = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + gray = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + rgbar = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgbr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + grayr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + } + + memcpy( rgbr->imageData, right.data, right.xsize*right.ysize*3 ); + cvCvtColor(rgbr, grayr, CV_BGRA2GRAY); + + // calculate the biggest contour + try { + cvFindContours( grayr, x_storage, &contourr, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + } + catch(...) { + post( "pix_opencv_pgh_compare : error calculating contours" ); + return; + } + + if ( contourr ) + { + size=0; + for( ; contourr != 0; contourr = contourr->h_next ) + { + rect = cvContourBoundingRect( contourr, 1); + if ( rect.width*rect.height > size && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + x_bcontourr = contourr; + size = rect.width*rect.height; + } + } + } + + memcpy( rgb->imageData, left.data, left.xsize*left.ysize*3 ); + cvCvtColor(rgb, gray, CV_BGRA2GRAY); + + mstorage = cvCreateMemStorage(0); + + cvFindContours( gray, mstorage, &contourl, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + + if ( contourl && x_bcontourr ) + { + contourlp=contourl; + for( ; contourlp != 0; contourlp = contourlp->h_next ) + { + rect = cvContourBoundingRect( contourlp, 1); + if ( rect.width*rect.height > x_minsize && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + histr = cvCreateHist(2, dims, CV_HIST_ARRAY, ranges, 1); + histl = cvCreateHist(2, dims, CV_HIST_ARRAY, ranges, 1); + cvCalcPGH(x_bcontourr, histr); + cvCalcPGH(contourlp, histl); + cvNormalizeHist(histr, 100.0f); + cvNormalizeHist(histl, 100.0f); + ndist = cvCompareHist(histr, histl, CV_COMP_BHATTACHARYYA); + cvReleaseHist(&histr); + cvReleaseHist(&histl); + + if ( ndist < dist ) dist = ndist; + if ( ndist < x_cdistance ) + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(255,255,255), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(255,255,255), CV_RGB(255,255,255), 0, 1, 8, cvPoint(0,0) ); + } + else + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(128,128,128), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(128,128,128), CV_RGB(128,128,128), 0, 1, 8, cvPoint(0,0) ); + } + } + } + } + + if ( dist < 100.00 ) outlet_float( m_dataout, dist ); + + cvReleaseMemStorage(&mstorage); + + cvCvtColor(gray, rgb, CV_GRAY2BGR); + memcpy( left.data, rgb->imageData, left.xsize*left.ysize*3 ); + +} + +///////////////////////////////////////////////////////// +// processDualImage +// +///////////////////////////////////////////////////////// +void pix_opencv_pgh_compare :: processGray_Gray(imageStruct &left, imageStruct &right) +{ + double dist = 100.0, ndist; + int i = 0; // Indicator of cycles. + CvSeq *contourl=NULL, *contourlp; + CvRect rect; + CvMemStorage *mstorage; + CvSeq *contourr = NULL; + int size; + int dims[] = {8, 8}; + float range[] = {-180, 180, -100, 100}; + float *ranges[] = {&range[0], &range[2]}; + CvHistogram *histl, *histr ; + + + if ((left.xsize!=right.xsize) || (left.ysize!=right.ysize) ) + { + post( "pix_opencv_pgh_compare : left and right image are not of the same size" ); + return; + } + + if ((this->comp_xsize!=left.xsize)&&(this->comp_ysize!=left.ysize)) + { + this->comp_xsize=left.xsize; + this->comp_ysize=left.ysize; + + cvReleaseImage(&rgba); + cvReleaseImage(&rgb); + cvReleaseImage(&gray); + cvReleaseImage(&rgbar); + cvReleaseImage(&rgbr); + cvReleaseImage(&grayr); + + rgba = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgb = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + gray = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + rgbar = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 4); + rgbr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 3); + grayr = cvCreateImage(cvSize(comp_xsize,comp_ysize), IPL_DEPTH_8U, 1); + } + + memcpy( grayr->imageData, right.data, right.xsize*right.ysize ); + + // calculate the biggest contour + try { + cvFindContours( grayr, x_storage, &contourr, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + } + catch(...) { + post( "pix_opencv_pgh_compare : error calculating contours" ); + return; + } + + if ( contourr ) + { + size=0; + for( ; contourr != 0; contourr = contourr->h_next ) + { + rect = cvContourBoundingRect( contourr, 1); + if ( rect.width*rect.height > size && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + x_bcontourr = contourr; + size = rect.width*rect.height; + } + } + } + + memcpy( gray->imageData, left.data, left.xsize*left.ysize ); + + mstorage = cvCreateMemStorage(0); + + cvFindContours( gray, mstorage, &contourl, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) ); + + if ( contourl && x_bcontourr ) + { + contourlp=contourl; + for( ; contourlp != 0; contourlp = contourlp->h_next ) + { + rect = cvContourBoundingRect( contourlp, 1); + if ( rect.width*rect.height > x_minsize && rect.width*rect.height < (comp_xsize-2)*(comp_ysize-2)) + { + histr = cvCreateHist(2, dims, CV_HIST_ARRAY, ranges, 1); + histl = cvCreateHist(2, dims, CV_HIST_ARRAY, ranges, 1); + cvCalcPGH(x_bcontourr, histr); + cvCalcPGH(contourlp, histl); + cvNormalizeHist(histr, 100.0f); + cvNormalizeHist(histl, 100.0f); + ndist = cvCompareHist(histr, histl, CV_COMP_BHATTACHARYYA); + cvReleaseHist(&histr); + cvReleaseHist(&histl); + + if ( ndist < dist ) dist = ndist; + if ( ndist < x_cdistance ) + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(255,255,255), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(255,255,255), CV_RGB(255,255,255), 0, 1, 8, cvPoint(0,0) ); + } + else + { + cvRectangle( gray, cvPoint(rect.x,rect.y), cvPoint(rect.x+rect.width,rect.y+rect.height), CV_RGB(128,128,128), 2, 8 , 0 ); + cvDrawContours( gray, contourlp, CV_RGB(128,128,128), CV_RGB(128,128,128), 0, 1, 8, cvPoint(0,0) ); + } + } + } + } + + if ( dist < 100.00 ) outlet_float( m_dataout, dist ); + + cvReleaseMemStorage(&mstorage); + + memcpy( left.data, gray->imageData, left.xsize*left.ysize ); + +} + +void pix_opencv_pgh_compare :: processYUV_YUV(imageStruct &left, imageStruct &right) +{ + post( "pix_opencv_pgh_compare : YUV colorspace not supported" ); +} + +///////////////////////////////////////////////////////// +// static member function +// +///////////////////////////////////////////////////////// +void pix_opencv_pgh_compare :: obj_setupCallback(t_class *classPtr) +{ + class_addmethod(classPtr, (t_method)&pix_opencv_pgh_compare::floatMinSizeMessCallback, + gensym("minsize"), A_FLOAT, A_NULL); + class_addmethod(classPtr, (t_method)&pix_opencv_pgh_compare::clearMessCallback, + gensym("clear"), A_NULL); + class_addmethod(classPtr, (t_method)&pix_opencv_pgh_compare::floatCriteriaMessCallback, + gensym("criteria"), A_FLOAT, A_NULL); +} + +void pix_opencv_pgh_compare :: floatMinSizeMessCallback(void *data, t_floatarg minsize) +{ + GetMyClass(data)->floatMinSizeMess((float)minsize); +} + +void pix_opencv_pgh_compare :: clearMessCallback(void *data) +{ + GetMyClass(data)->clearMess(); +} + +void pix_opencv_pgh_compare :: floatCriteriaMessCallback(void *data, t_floatarg criteria) +{ + GetMyClass(data)->floatCriteriaMess((float)criteria); +} + +void pix_opencv_pgh_compare :: floatMinSizeMess(float minsize) +{ + if ( (int)minsize > 0 ) + { + x_minsize = (int)minsize; + } +} + +void pix_opencv_pgh_compare :: clearMess(void) +{ + x_bcontourr = NULL; +} + +void pix_opencv_pgh_compare :: floatCriteriaMess(float criteria) +{ + if ( criteria > 0.0 ) + { + x_cdistance = criteria; + } +} diff --git a/pix_opencv_pgh_compare.h b/pix_opencv_pgh_compare.h new file mode 100755 index 0000000..f190ac3 --- /dev/null +++ b/pix_opencv_pgh_compare.h @@ -0,0 +1,86 @@ +/*----------------------------------------------------------------- +LOG + GEM - Graphics Environment for Multimedia + + PGH histogram comparison used to compare contours + + Copyright (c) 1997-1998 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_PGH_COMPARE_H_ +#define INCLUDE_PIX_OPENCV_PGH_COMPARE_H_ + +#include "Base/GemPixDualObj.h" + +#ifndef _EiC +#include "cv.h" +#endif + +/*----------------------------------------------------------------- +CLASS + pix_opencv_pgh_compare + + PGH histogram comparison used to compare contours + +-----------------------------------------------------------------*/ + +class GEM_EXTERN pix_opencv_pgh_compare : public GemPixDualObj +{ + CPPEXTERN_HEADER(pix_opencv_pgh_compare, GemPixDualObj) + + public: + + ////////// + // Constructor + pix_opencv_pgh_compare(int,t_atom*); + + protected: + + ////////// + // Destructor + virtual ~pix_opencv_pgh_compare(); + + ////////// + // Do the processing + virtual void processRGBA_RGBA(imageStruct &left, imageStruct &right); + virtual void processRGB_RGB(imageStruct &left, imageStruct &right); + virtual void processYUV_YUV(imageStruct &left, imageStruct &right); + virtual void processGray_Gray(imageStruct &left, imageStruct &right); + + ////////// + // change method used + void floatMinSizeMess(float minsize); + void clearMess(void); + void floatCriteriaMess(float criteria); + + int comp_xsize; + int comp_ysize; + + t_outlet *m_dataout; + + int x_minsize; + float x_cdistance; + + private: + + ////////// + // Static member functions + static void floatMinSizeMessCallback(void *data, float minsize); + static void clearMessCallback(void *data); + static void floatCriteriaMessCallback(void *data, float criteria); + + IplImage *rgba, *rgb, *gray; + IplImage *rgbar, *rgbr, *grayr; + + CvMemStorage *x_storage; + CvSeq *x_bcontourr; + +}; + +#endif // for header file diff --git a/pix_opencv_threshold.h b/pix_opencv_threshold.h index 66286cf..018002b 100644 --- a/pix_opencv_threshold.h +++ b/pix_opencv_threshold.h @@ -2,7 +2,7 @@ LOG GEM - Graphics Environment for Multimedia - Change pix to greyscale + Threshold filter Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at @@ -13,8 +13,8 @@ LOG -----------------------------------------------------------------*/ -#ifndef INCLUDE_PIX_OPENCV_EDGE_H_ -#define INCLUDE_PIX_OPENCV_EDGE_H_ +#ifndef INCLUDE_PIX_OPENCV_THRESHOLD_H_ +#define INCLUDE_PIX_OPENCV_THRESHOLD_H_ #include "Base/GemPixObj.h" @@ -27,7 +27,7 @@ LOG CLASS pix_opencv_threshold - Change pix to greyscale + Threshold filter KEYWORDS pix |