diff --git a/Przyklad/.dep.inc b/Przyklad/.dep.inc
new file mode 100644
index 0000000..4560e55
--- /dev/null
+++ b/Przyklad/.dep.inc
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/Przyklad/build/Debug/GNU-Linux-x86/main.o.d b/Przyklad/build/Debug/GNU-Linux-x86/main.o.d
new file mode 100644
index 0000000..fd85132
--- /dev/null
+++ b/Przyklad/build/Debug/GNU-Linux-x86/main.o.d
@@ -0,0 +1 @@
+build/Debug/GNU-Linux-x86/main.o: main.cpp
diff --git a/Przyklad/dist/Debug/GNU-Linux-x86/przyklad b/Przyklad/dist/Debug/GNU-Linux-x86/przyklad
new file mode 100755
index 0000000..1e19a13
Binary files /dev/null and b/Przyklad/dist/Debug/GNU-Linux-x86/przyklad differ
diff --git a/Przyklad/nbproject/Makefile-Debug.mk b/Przyklad/nbproject/Makefile-Debug.mk
index 44f9777..46b33fd 100644
--- a/Przyklad/nbproject/Makefile-Debug.mk
+++ b/Przyklad/nbproject/Makefile-Debug.mk
@@ -42,8 +42,8 @@ OBJECTFILES= \
CFLAGS=pkg-config --cflags --libs opencv
# CC Compiler Flags
-CCFLAGS=`pkg-config --cflags --libs opencv`
-CXXFLAGS=`pkg-config --cflags --libs opencv`
+CCFLAGS=`pkg-config --cflags --libs opencv` -lX11
+CXXFLAGS=`pkg-config --cflags --libs opencv` -lX11
# Fortran Compiler Flags
FFLAGS=
@@ -56,16 +56,16 @@ LDLIBSOPTIONS=
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
- "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/modal-handpointer
+ "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/przyklad
-${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/modal-handpointer: ${OBJECTFILES}
+${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/przyklad: ${OBJECTFILES}
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
- ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/modal-handpointer ${OBJECTFILES} ${LDLIBSOPTIONS}
+ ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/przyklad ${OBJECTFILES} ${LDLIBSOPTIONS}
${OBJECTDIR}/main.o: main.cpp
${MKDIR} -p ${OBJECTDIR}
${RM} $@.d
- $(COMPILE.cc) -g `pkg-config --cflags --libs opencv` -MMD -MP -MF $@.d -o ${OBJECTDIR}/main.o main.cpp
+ $(COMPILE.cc) -g `pkg-config --cflags --libs opencv` -lX11 -MMD -MP -MF $@.d -o ${OBJECTDIR}/main.o main.cpp
# Subprojects
.build-subprojects:
@@ -73,7 +73,7 @@ ${OBJECTDIR}/main.o: main.cpp
# Clean Targets
.clean-conf: ${CLEAN_SUBPROJECTS}
${RM} -r ${CND_BUILDDIR}/${CND_CONF}
- ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/modal-handpointer
+ ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/przyklad
# Subprojects
.clean-subprojects:
diff --git a/Przyklad/nbproject/Makefile-Release.mk b/Przyklad/nbproject/Makefile-Release.mk
index 6303314..bca5ce6 100644
--- a/Przyklad/nbproject/Makefile-Release.mk
+++ b/Przyklad/nbproject/Makefile-Release.mk
@@ -56,11 +56,11 @@ LDLIBSOPTIONS=
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
- "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/modal-handpointer
+ "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/przyklad
-${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/modal-handpointer: ${OBJECTFILES}
+${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/przyklad: ${OBJECTFILES}
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
- ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/modal-handpointer ${OBJECTFILES} ${LDLIBSOPTIONS}
+ ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/przyklad ${OBJECTFILES} ${LDLIBSOPTIONS}
${OBJECTDIR}/main.o: main.cpp
${MKDIR} -p ${OBJECTDIR}
@@ -73,7 +73,7 @@ ${OBJECTDIR}/main.o: main.cpp
# Clean Targets
.clean-conf: ${CLEAN_SUBPROJECTS}
${RM} -r ${CND_BUILDDIR}/${CND_CONF}
- ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/modal-handpointer
+ ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/przyklad
# Subprojects
.clean-subprojects:
diff --git a/Przyklad/nbproject/Makefile-impl.mk b/Przyklad/nbproject/Makefile-impl.mk
index 963d09a..adfed7d 100644
--- a/Przyklad/nbproject/Makefile-impl.mk
+++ b/Przyklad/nbproject/Makefile-impl.mk
@@ -24,7 +24,7 @@ CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
# Project Name
-PROJECTNAME=Modal-HandPointer
+PROJECTNAME=Przyklad
# Active Configuration
DEFAULTCONF=Debug
diff --git a/Przyklad/nbproject/Makefile-variables.mk b/Przyklad/nbproject/Makefile-variables.mk
index 533abee..e484060 100644
--- a/Przyklad/nbproject/Makefile-variables.mk
+++ b/Przyklad/nbproject/Makefile-variables.mk
@@ -9,19 +9,19 @@ CND_DISTDIR=dist
# Debug configuration
CND_PLATFORM_Debug=GNU-Linux-x86
CND_ARTIFACT_DIR_Debug=dist/Debug/GNU-Linux-x86
-CND_ARTIFACT_NAME_Debug=modal-handpointer
-CND_ARTIFACT_PATH_Debug=dist/Debug/GNU-Linux-x86/modal-handpointer
+CND_ARTIFACT_NAME_Debug=przyklad
+CND_ARTIFACT_PATH_Debug=dist/Debug/GNU-Linux-x86/przyklad
CND_PACKAGE_DIR_Debug=dist/Debug/GNU-Linux-x86/package
-CND_PACKAGE_NAME_Debug=modal-handpointer.tar
-CND_PACKAGE_PATH_Debug=dist/Debug/GNU-Linux-x86/package/modal-handpointer.tar
+CND_PACKAGE_NAME_Debug=przyklad.tar
+CND_PACKAGE_PATH_Debug=dist/Debug/GNU-Linux-x86/package/przyklad.tar
# Release configuration
CND_PLATFORM_Release=GNU-Linux-x86
CND_ARTIFACT_DIR_Release=dist/Release/GNU-Linux-x86
-CND_ARTIFACT_NAME_Release=modal-handpointer
-CND_ARTIFACT_PATH_Release=dist/Release/GNU-Linux-x86/modal-handpointer
+CND_ARTIFACT_NAME_Release=przyklad
+CND_ARTIFACT_PATH_Release=dist/Release/GNU-Linux-x86/przyklad
CND_PACKAGE_DIR_Release=dist/Release/GNU-Linux-x86/package
-CND_PACKAGE_NAME_Release=modal-handpointer.tar
-CND_PACKAGE_PATH_Release=dist/Release/GNU-Linux-x86/package/modal-handpointer.tar
+CND_PACKAGE_NAME_Release=przyklad.tar
+CND_PACKAGE_PATH_Release=dist/Release/GNU-Linux-x86/package/przyklad.tar
#
# include compiler specific variables
#
diff --git a/Przyklad/nbproject/Package-Debug.bash b/Przyklad/nbproject/Package-Debug.bash
index dc5b354..6c19df5 100644
--- a/Przyklad/nbproject/Package-Debug.bash
+++ b/Przyklad/nbproject/Package-Debug.bash
@@ -12,9 +12,9 @@ CND_DISTDIR=dist
CND_BUILDDIR=build
NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
TMPDIRNAME=tmp-packaging
-OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/modal-handpointer
-OUTPUT_BASENAME=modal-handpointer
-PACKAGE_TOP_DIR=modal-handpointer/
+OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/przyklad
+OUTPUT_BASENAME=przyklad
+PACKAGE_TOP_DIR=przyklad/
# Functions
function checkReturnCode
@@ -59,15 +59,15 @@ mkdir -p ${NBTMPDIR}
# Copy files and create directories and links
cd "${TOP}"
-makeDirectory "${NBTMPDIR}/modal-handpointer/bin"
+makeDirectory "${NBTMPDIR}/przyklad/bin"
copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
# Generate tar file
cd "${TOP}"
-rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/modal-handpointer.tar
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/przyklad.tar
cd ${NBTMPDIR}
-tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/modal-handpointer.tar *
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/przyklad.tar *
checkReturnCode
# Cleanup
diff --git a/Przyklad/nbproject/Package-Release.bash b/Przyklad/nbproject/Package-Release.bash
index e30113a..58f473b 100644
--- a/Przyklad/nbproject/Package-Release.bash
+++ b/Przyklad/nbproject/Package-Release.bash
@@ -12,9 +12,9 @@ CND_DISTDIR=dist
CND_BUILDDIR=build
NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
TMPDIRNAME=tmp-packaging
-OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/modal-handpointer
-OUTPUT_BASENAME=modal-handpointer
-PACKAGE_TOP_DIR=modal-handpointer/
+OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/przyklad
+OUTPUT_BASENAME=przyklad
+PACKAGE_TOP_DIR=przyklad/
# Functions
function checkReturnCode
@@ -59,15 +59,15 @@ mkdir -p ${NBTMPDIR}
# Copy files and create directories and links
cd "${TOP}"
-makeDirectory "${NBTMPDIR}/modal-handpointer/bin"
+makeDirectory "${NBTMPDIR}/przyklad/bin"
copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
# Generate tar file
cd "${TOP}"
-rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/modal-handpointer.tar
+rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/przyklad.tar
cd ${NBTMPDIR}
-tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/modal-handpointer.tar *
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/przyklad.tar *
checkReturnCode
# Cleanup
diff --git a/Przyklad/nbproject/configurations.xml b/Przyklad/nbproject/configurations.xml
index 18aabcd..fdc82b7 100644
--- a/Przyklad/nbproject/configurations.xml
+++ b/Przyklad/nbproject/configurations.xml
@@ -41,7 +41,7 @@
pkg-config --cflags --libs opencv
- `pkg-config --cflags --libs opencv`
+ `pkg-config --cflags --libs opencv` -lX11
-
diff --git a/Przyklad/main.cpp b/Przyklad/src/HandPointer/HandPointer.cpp.cpp
similarity index 100%
rename from Przyklad/main.cpp
rename to Przyklad/src/HandPointer/HandPointer.cpp.cpp
diff --git a/mariusz/.dep.inc b/mariusz/.dep.inc
new file mode 100644
index 0000000..4560e55
--- /dev/null
+++ b/mariusz/.dep.inc
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/mariusz/Makefile b/mariusz/Makefile
new file mode 100644
index 0000000..05de621
--- /dev/null
+++ b/mariusz/Makefile
@@ -0,0 +1,128 @@
+#
+# There exist several targets which are by default empty and which can be
+# used for execution of your targets. These targets are usually executed
+# before and after some main targets. They are:
+#
+# .build-pre: called before 'build' target
+# .build-post: called after 'build' target
+# .clean-pre: called before 'clean' target
+# .clean-post: called after 'clean' target
+# .clobber-pre: called before 'clobber' target
+# .clobber-post: called after 'clobber' target
+# .all-pre: called before 'all' target
+# .all-post: called after 'all' target
+# .help-pre: called before 'help' target
+# .help-post: called after 'help' target
+#
+# Targets beginning with '.' are not intended to be called on their own.
+#
+# Main targets can be executed directly, and they are:
+#
+# build build a specific configuration
+# clean remove built files from a configuration
+# clobber remove all built files
+# all build all configurations
+# help print help mesage
+#
+# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+# .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+# Available make variables:
+#
+# CND_BASEDIR base directory for relative paths
+# CND_DISTDIR default top distribution directory (build artifacts)
+# CND_BUILDDIR default top build directory (object files, ...)
+# CONF name of current configuration
+# CND_PLATFORM_${CONF} platform name (current configuration)
+# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
+# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
+# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
+# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
+# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
+# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# build tests
+build-tests: .build-tests-post
+
+.build-tests-pre:
+# Add your pre 'build-tests' code here...
+
+.build-tests-post: .build-tests-impl
+# Add your post 'build-tests' code here...
+
+
+# run tests
+test: .test-post
+
+.test-pre: build-tests
+# Add your pre 'test' code here...
+
+.test-post: .test-impl
+# Add your post 'test' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/mariusz/build/Debug/GNU-Linux-x86/Mouse.o.d b/mariusz/build/Debug/GNU-Linux-x86/Mouse.o.d
new file mode 100644
index 0000000..2b0e22d
--- /dev/null
+++ b/mariusz/build/Debug/GNU-Linux-x86/Mouse.o.d
@@ -0,0 +1,3 @@
+build/Debug/GNU-Linux-x86/Mouse.o: Mouse.cpp Mouse.hpp
+
+Mouse.hpp:
diff --git a/mariusz/build/Debug/GNU-Linux-x86/main.o.d b/mariusz/build/Debug/GNU-Linux-x86/main.o.d
new file mode 100644
index 0000000..fd85132
--- /dev/null
+++ b/mariusz/build/Debug/GNU-Linux-x86/main.o.d
@@ -0,0 +1 @@
+build/Debug/GNU-Linux-x86/main.o: main.cpp
diff --git a/mariusz/build/Debug/GNU-Linux-x86/src/HandPointer/HandPointer.cpp.o.d b/mariusz/build/Debug/GNU-Linux-x86/src/HandPointer/HandPointer.cpp.o.d
new file mode 100644
index 0000000..dbdb541
--- /dev/null
+++ b/mariusz/build/Debug/GNU-Linux-x86/src/HandPointer/HandPointer.cpp.o.d
@@ -0,0 +1,4 @@
+build/Debug/GNU-Linux-x86/src/HandPointer/HandPointer.cpp.o: \
+ src/HandPointer/HandPointer.cpp.cpp src/HandPointer/Mouse.hpp
+
+src/HandPointer/Mouse.hpp:
diff --git a/mariusz/build/Debug/GNU-Linux-x86/src/HandPointer/HandPointer.o.d b/mariusz/build/Debug/GNU-Linux-x86/src/HandPointer/HandPointer.o.d
new file mode 100644
index 0000000..901bb98
--- /dev/null
+++ b/mariusz/build/Debug/GNU-Linux-x86/src/HandPointer/HandPointer.o.d
@@ -0,0 +1,7 @@
+build/Debug/GNU-Linux-x86/src/HandPointer/HandPointer.o: \
+ src/HandPointer/HandPointer.cpp include/cvBlob/cvblob.h \
+ src/HandPointer/Mouse.hpp
+
+include/cvBlob/cvblob.h:
+
+src/HandPointer/Mouse.hpp:
diff --git a/mariusz/build/Debug/GNU-Linux-x86/src/HandPointer/Mouse.o.d b/mariusz/build/Debug/GNU-Linux-x86/src/HandPointer/Mouse.o.d
new file mode 100644
index 0000000..e51be53
--- /dev/null
+++ b/mariusz/build/Debug/GNU-Linux-x86/src/HandPointer/Mouse.o.d
@@ -0,0 +1,4 @@
+build/Debug/GNU-Linux-x86/src/HandPointer/Mouse.o: \
+ src/HandPointer/Mouse.cpp src/HandPointer/Mouse.hpp
+
+src/HandPointer/Mouse.hpp:
diff --git a/mariusz/dist/Debug/GNU-Linux-x86/mariusz b/mariusz/dist/Debug/GNU-Linux-x86/mariusz
new file mode 100755
index 0000000..3409dcc
Binary files /dev/null and b/mariusz/dist/Debug/GNU-Linux-x86/mariusz differ
diff --git a/mariusz/dist/Debug/GNU-Linux-x86/przyklad b/mariusz/dist/Debug/GNU-Linux-x86/przyklad
new file mode 100755
index 0000000..88763c5
Binary files /dev/null and b/mariusz/dist/Debug/GNU-Linux-x86/przyklad differ
diff --git a/mariusz/include/cvBlob/CMakeLists.txt b/mariusz/include/cvBlob/CMakeLists.txt
new file mode 100644
index 0000000..939f96b
--- /dev/null
+++ b/mariusz/include/cvBlob/CMakeLists.txt
@@ -0,0 +1,45 @@
+# Copyright (C) 2007 by Cristóbal Carnero Liñán
+# grendel.ccl@gmail.com
+#
+# This file is part of cvBlob.
+#
+# cvBlob is free software: you can redistribute it and/or modify
+# it under the terms of the Lesser GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# cvBlob 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
+# Lesser GNU General Public License for more details.
+#
+# You should have received a copy of the Lesser GNU General Public License
+# along with cvBlob. If not, see .
+#
+
+find_package(OpenCV REQUIRED)
+
+set(cvBlob_CVBLOB cvblob.cpp
+ cvlabel.cpp
+ cvaux.cpp
+ cvcontour.cpp
+ cvtrack.cpp
+ cvcolor.cpp
+)
+
+set_source_files_properties(${cvBlob_SRC}
+ PROPERTIES
+ COMPILE_FLAGS "-O3"
+)
+
+add_library(cvblob SHARED ${cvBlob_CVBLOB})
+
+target_link_libraries(cvblob ${OpenCV_LIBS})
+
+install(FILES cvblob.h DESTINATION include)
+
+install(TARGETS cvblob
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
diff --git a/mariusz/include/cvBlob/cvaux.cpp b/mariusz/include/cvBlob/cvaux.cpp
new file mode 100644
index 0000000..0404c88
--- /dev/null
+++ b/mariusz/include/cvBlob/cvaux.cpp
@@ -0,0 +1,79 @@
+// Copyright (C) 2007 by Cristóbal Carnero Liñán
+// grendel.ccl@gmail.com
+//
+// This file is part of cvBlob.
+//
+// cvBlob is free software: you can redistribute it and/or modify
+// it under the terms of the Lesser GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// cvBlob 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
+// Lesser GNU General Public License for more details.
+//
+// You should have received a copy of the Lesser GNU General Public License
+// along with cvBlob. If not, see .
+//
+
+#include
+
+#if (defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) || (defined(__APPLE__) & defined(__MACH__)))
+#include
+#else
+#include
+#endif
+
+#include "cvblob.h"
+
+namespace cvb
+{
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=geometry1
+
+ double cvDotProductPoints(CvPoint const &a, CvPoint const &b, CvPoint const &c)
+ {
+ double abx = b.x-a.x;
+ double aby = b.y-a.y;
+ double bcx = c.x-b.x;
+ double bcy = c.y-b.y;
+
+ return abx*bcx + aby*bcy;
+ }
+
+ double cvCrossProductPoints(CvPoint const &a, CvPoint const &b, CvPoint const &c)
+ {
+ double abx = b.x-a.x;
+ double aby = b.y-a.y;
+ double acx = c.x-a.x;
+ double acy = c.y-a.y;
+
+ return abx*acy - aby*acx;
+ }
+
+ double cvDistancePointPoint(CvPoint const &a, CvPoint const &b)
+ {
+ double abx = a.x-b.x;
+ double aby = a.y-b.y;
+
+ return sqrt(abx*abx + aby*aby);
+ }
+
+ double cvDistanceLinePoint(CvPoint const &a, CvPoint const &b, CvPoint const &c, bool isSegment)
+ {
+ if (isSegment)
+ {
+ double dot1 = cvDotProductPoints(a, b, c);
+ if (dot1>0) return cvDistancePointPoint(b, c);
+
+ double dot2 = cvDotProductPoints(b, a, c);
+ if(dot2>0) return cvDistancePointPoint(a, c);
+ }
+
+ return fabs(cvCrossProductPoints(a,b,c)/cvDistancePointPoint(a,b));
+ }
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+}
diff --git a/mariusz/include/cvBlob/cvblob.cpp b/mariusz/include/cvBlob/cvblob.cpp
new file mode 100644
index 0000000..19b40e5
--- /dev/null
+++ b/mariusz/include/cvBlob/cvblob.cpp
@@ -0,0 +1,344 @@
+// Copyright (C) 2007 by Cristóbal Carnero Liñán
+// grendel.ccl@gmail.com
+//
+// This file is part of cvBlob.
+//
+// cvBlob is free software: you can redistribute it and/or modify
+// it under the terms of the Lesser GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// cvBlob 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
+// Lesser GNU General Public License for more details.
+//
+// You should have received a copy of the Lesser GNU General Public License
+// along with cvBlob. If not, see .
+//
+
+#include
+#include
+using namespace std;
+
+#if (defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) || (defined(__APPLE__) & defined(__MACH__)))
+#include
+#include
+#else
+#include
+#include
+#endif
+
+#include "cvblob.h"
+
+namespace cvb
+{
+
+ CvLabel cvLargestBlob(const CvBlobs &blobs)
+ {
+ CvLabel label=0;
+ unsigned int maxArea=0;
+
+ for (CvBlobs::const_iterator it=blobs.begin();it!=blobs.end();++it)
+ {
+ CvBlob *blob=(*it).second;
+
+ if (blob->area > maxArea)
+ {
+ label=blob->label;
+ maxArea=blob->area;
+ }
+ }
+
+ return label;
+ }
+
+ void cvFilterByArea(CvBlobs &blobs, unsigned int minArea, unsigned int maxArea)
+ {
+ CvBlobs::iterator it=blobs.begin();
+ while(it!=blobs.end())
+ {
+ CvBlob *blob=(*it).second;
+ if ((blob->areaarea>maxArea))
+ {
+ cvReleaseBlob(blob);
+
+ CvBlobs::iterator tmp=it;
+ ++it;
+ blobs.erase(tmp);
+ }
+ else
+ ++it;
+ }
+ }
+
+ void cvFilterByLabel(CvBlobs &blobs, CvLabel label)
+ {
+ CvBlobs::iterator it=blobs.begin();
+ while(it!=blobs.end())
+ {
+ CvBlob *blob=(*it).second;
+ if (blob->label!=label)
+ {
+ delete blob;
+ CvBlobs::iterator tmp=it;
+ ++it;
+ blobs.erase(tmp);
+ }
+ else
+ ++it;
+ }
+ }
+
+ /*void cvCentralMoments(CvBlob *blob, const IplImage *img)
+ {
+ CV_FUNCNAME("cvCentralMoments");
+ __CV_BEGIN__;
+ if (!blob->centralMoments)
+ {
+ CV_ASSERT(img&&(img->depth==IPL_DEPTH_LABEL)&&(img->nChannels==1));
+
+ //cvCentroid(blob); // Here?
+
+ blob->u11=blob->u20=blob->u02=0.;
+
+ // Only in the bounding box
+ int stepIn = img->widthStep / (img->depth / 8);
+ int img_width = img->width;
+ int img_height = img->height;
+ int img_offset = 0;
+ if(0 != img->roi)
+ {
+ img_width = img->roi->width;
+ img_height = img->roi->height;
+ img_offset = img->roi->xOffset + (img->roi->yOffset * stepIn);
+ }
+
+ CvLabel *imgData=(CvLabel *)img->imageData + (blob->miny * stepIn) + img_offset;
+ for (unsigned int r=blob->miny;
+ rmaxy;
+ r++,imgData+=stepIn)
+ for (unsigned int c=blob->minx;cmaxx;c++)
+ if (imgData[c]==blob->label)
+ {
+ double tx=(c-blob->centroid.x);
+ double ty=(r-blob->centroid.y);
+ blob->u11+=tx*ty;
+ blob->u20+=tx*tx;
+ blob->u02+=ty*ty;
+ }
+
+ blob->centralMoments = true;
+ }
+ __CV_END__;
+ }*/
+
+ void cvRenderBlob(const IplImage *imgLabel, CvBlob *blob, IplImage *imgSource, IplImage *imgDest, unsigned short mode, CvScalar const &color, double alpha)
+ {
+ CV_FUNCNAME("cvRenderBlob");
+ __CV_BEGIN__;
+
+ CV_ASSERT(imgLabel&&(imgLabel->depth==IPL_DEPTH_LABEL)&&(imgLabel->nChannels==1));
+ CV_ASSERT(imgDest&&(imgDest->depth==IPL_DEPTH_8U)&&(imgDest->nChannels==3));
+
+ if (mode&CV_BLOB_RENDER_COLOR)
+ {
+ int stepLbl = imgLabel->widthStep/(imgLabel->depth/8);
+ int stepSrc = imgSource->widthStep/(imgSource->depth/8);
+ int stepDst = imgDest->widthStep/(imgDest->depth/8);
+ int imgLabel_width = imgLabel->width;
+ int imgLabel_height = imgLabel->height;
+ int imgLabel_offset = 0;
+ int imgSource_width = imgSource->width;
+ int imgSource_height = imgSource->height;
+ int imgSource_offset = 0;
+ int imgDest_width = imgDest->width;
+ int imgDest_height = imgDest->height;
+ int imgDest_offset = 0;
+ if(imgLabel->roi)
+ {
+ imgLabel_width = imgLabel->roi->width;
+ imgLabel_height = imgLabel->roi->height;
+ imgLabel_offset = (imgLabel->nChannels * imgLabel->roi->xOffset) + (imgLabel->roi->yOffset * stepLbl);
+ }
+ if(imgSource->roi)
+ {
+ imgSource_width = imgSource->roi->width;
+ imgSource_height = imgSource->roi->height;
+ imgSource_offset = (imgSource->nChannels * imgSource->roi->xOffset) + (imgSource->roi->yOffset * stepSrc);
+ }
+ if(imgDest->roi)
+ {
+ imgDest_width = imgDest->roi->width;
+ imgDest_height = imgDest->roi->height;
+ imgDest_offset = (imgDest->nChannels * imgDest->roi->xOffset) + (imgDest->roi->yOffset * stepDst);
+ }
+
+ CvLabel *labels = (CvLabel *)imgLabel->imageData + imgLabel_offset + (blob->miny * stepLbl);
+ unsigned char *source = (unsigned char *)imgSource->imageData + imgSource_offset + (blob->miny * stepSrc);
+ unsigned char *imgData = (unsigned char *)imgDest->imageData + imgDest_offset + (blob->miny * stepDst);
+
+ for (unsigned int r=blob->miny; rmaxy; r++, labels+=stepLbl, source+=stepSrc, imgData+=stepDst)
+ for (unsigned int c=blob->minx; cmaxx; c++)
+ {
+ if (labels[c]==blob->label)
+ {
+ imgData[imgDest->nChannels*c+0] = (unsigned char)((1.-alpha)*source[imgSource->nChannels*c+0]+alpha*color.val[0]);
+ imgData[imgDest->nChannels*c+1] = (unsigned char)((1.-alpha)*source[imgSource->nChannels*c+1]+alpha*color.val[1]);
+ imgData[imgDest->nChannels*c+2] = (unsigned char)((1.-alpha)*source[imgSource->nChannels*c+2]+alpha*color.val[2]);
+ }
+ }
+ }
+
+ if (mode)
+ {
+ if (mode&CV_BLOB_RENDER_TO_LOG)
+ {
+ std::clog << "Blob " << blob->label << std::endl;
+ std::clog << " - Bounding box: (" << blob->minx << ", " << blob->miny << ") - (" << blob->maxx << ", " << blob->maxy << ")" << std::endl;
+ std::clog << " - Bounding box area: " << (1 + blob->maxx - blob->minx) * (1 + blob->maxy - blob->miny) << std::endl;
+ std::clog << " - Area: " << blob->area << std::endl;
+ std::clog << " - Centroid: (" << blob->centroid.x << ", " << blob->centroid.y << ")" << std::endl;
+ std::clog << std::endl;
+ }
+
+ if (mode&CV_BLOB_RENDER_TO_STD)
+ {
+ std::cout << "Blob " << blob->label << std::endl;
+ std::cout << " - Bounding box: (" << blob->minx << ", " << blob->miny << ") - (" << blob->maxx << ", " << blob->maxy << ")" << std::endl;
+ std::cout << " - Bounding box area: " << (1 + blob->maxx - blob->minx) * (1 + blob->maxy - blob->miny) << std::endl;
+ std::cout << " - Area: " << blob->area << std::endl;
+ std::cout << " - Centroid: (" << blob->centroid.x << ", " << blob->centroid.y << ")" << std::endl;
+ std::cout << std::endl;
+ }
+
+ if (mode&CV_BLOB_RENDER_BOUNDING_BOX)
+ cvRectangle(imgDest, cvPoint(blob->minx, blob->miny), cvPoint(blob->maxx-1, blob->maxy-1), CV_RGB(255., 0., 0.));
+
+ if (mode&CV_BLOB_RENDER_ANGLE)
+ {
+ double angle = cvAngle(blob);
+
+ double x1,y1,x2,y2;
+ double lengthLine = MAX(blob->maxx-blob->minx, blob->maxy-blob->miny)/2.;
+
+ x1=blob->centroid.x-lengthLine*cos(angle);
+ y1=blob->centroid.y-lengthLine*sin(angle);
+ x2=blob->centroid.x+lengthLine*cos(angle);
+ y2=blob->centroid.y+lengthLine*sin(angle);
+ cvLine(imgDest,cvPoint(int(x1),int(y1)),cvPoint(int(x2),int(y2)),CV_RGB(0.,255.,0.));
+ }
+
+ if (mode&CV_BLOB_RENDER_CENTROID)
+ {
+ cvLine(imgDest,cvPoint(int(blob->centroid.x)-3,int(blob->centroid.y)),cvPoint(int(blob->centroid.x)+3,int(blob->centroid.y)),CV_RGB(0.,0.,255.));
+ cvLine(imgDest,cvPoint(int(blob->centroid.x),int(blob->centroid.y)-3),cvPoint(int(blob->centroid.x),int(blob->centroid.y)+3),CV_RGB(0.,0.,255.));
+ }
+ }
+
+ __CV_END__;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+ // Based on http://en.wikipedia.org/wiki/HSL_and_HSV
+
+ /// \def _HSV2RGB_(H, S, V, R, G, B)
+ /// \brief Color translation between HSV and RGB.
+#define _HSV2RGB_(H, S, V, R, G, B) \
+ { \
+ double _h = H/60.; \
+ int _hf = (int)floor(_h); \
+ int _hi = ((int)_h)%6; \
+ double _f = _h - _hf; \
+ \
+ double _p = V * (1. - S); \
+ double _q = V * (1. - _f * S); \
+ double _t = V * (1. - (1. - _f) * S); \
+ \
+ switch (_hi) \
+ { \
+ case 0: \
+ R = 255.*V; G = 255.*_t; B = 255.*_p; \
+ break; \
+ case 1: \
+ R = 255.*_q; G = 255.*V; B = 255.*_p; \
+ break; \
+ case 2: \
+ R = 255.*_p; G = 255.*V; B = 255.*_t; \
+ break; \
+ case 3: \
+ R = 255.*_p; G = 255.*_q; B = 255.*V; \
+ break; \
+ case 4: \
+ R = 255.*_t; G = 255.*_p; B = 255.*V; \
+ break; \
+ case 5: \
+ R = 255.*V; G = 255.*_p; B = 255.*_q; \
+ break; \
+ } \
+ }
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+
+ typedef std::map Palete;
+
+ void cvRenderBlobs(const IplImage *imgLabel, CvBlobs &blobs, IplImage *imgSource, IplImage *imgDest, unsigned short mode, double alpha)
+ {
+ CV_FUNCNAME("cvRenderBlobs");
+ __CV_BEGIN__;
+ {
+
+ CV_ASSERT(imgLabel&&(imgLabel->depth==IPL_DEPTH_LABEL)&&(imgLabel->nChannels==1));
+ CV_ASSERT(imgDest&&(imgDest->depth==IPL_DEPTH_8U)&&(imgDest->nChannels==3));
+
+ Palete pal;
+ if (mode&CV_BLOB_RENDER_COLOR)
+ {
+
+ unsigned int colorCount = 0;
+ for (CvBlobs::const_iterator it=blobs.begin(); it!=blobs.end(); ++it)
+ {
+ CvLabel label = (*it).second->label;
+
+ double r, g, b;
+
+ _HSV2RGB_((double)((colorCount*77)%360), .5, 1., r, g, b);
+ colorCount++;
+
+ pal[label] = CV_RGB(r, g, b);
+ }
+ }
+
+ for (CvBlobs::iterator it=blobs.begin(); it!=blobs.end(); ++it)
+ cvRenderBlob(imgLabel, (*it).second, imgSource, imgDest, mode, pal[(*it).second->label], alpha);
+
+ }
+ __CV_END__;
+ }
+
+ // Returns radians
+ double cvAngle(CvBlob *blob)
+ {
+ CV_FUNCNAME("cvAngle");
+ __CV_BEGIN__;
+
+ return .5*atan2(2.*blob->u11,(blob->u20-blob->u02));
+
+ __CV_END__;
+ }
+
+ void cvSaveImageBlob(const char *filename, IplImage *img, CvBlob const *blob)
+ {
+ CvRect roi = cvGetImageROI(img);
+ cvSetImageROItoBlob(img, blob);
+ cvSaveImage(filename, img);
+ cvSetImageROI(img, roi);
+ }
+
+}
+
+ostream& operator<< (ostream& output, const cvb::CvBlob& b)
+{
+ output << b.label << ": " << b.area << ", (" << b.centroid.x << ", " << b.centroid.y << "), [(" << b.minx << ", " << b.miny << ") - (" << b.maxx << ", " << b.maxy << ")]";
+
+ return output;
+}
diff --git a/mariusz/include/cvBlob/cvblob.h b/mariusz/include/cvBlob/cvblob.h
new file mode 100644
index 0000000..c3d8e07
--- /dev/null
+++ b/mariusz/include/cvBlob/cvblob.h
@@ -0,0 +1,587 @@
+// Copyright (C) 2007 by Cristóbal Carnero Liñán
+// grendel.ccl@gmail.com
+//
+// This file is part of cvBlob.
+//
+// cvBlob is free software: you can redistribute it and/or modify
+// it under the terms of the Lesser GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// Lesser GNU General Public License for more details.
+//
+// You should have received a copy of the Lesser GNU General Public License
+// along with cvBlob. If not, see .
+//
+
+/// \file cvblob.h
+/// \brief OpenCV Blob header file.
+
+#ifdef SWIG
+%module cvblob
+%{
+#include "cvblob.h"
+%}
+#endif
+
+#ifndef CVBLOB_H
+#define CVBLOB_H
+
+#include
+#include