[chronojump] kneeAngle: blackOnlyMarkers uses foundHoles (only inside contour)



commit f58b25ead645f1fd3188fa2987c53c6391086bec
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Mar 25 14:46:47 2010 +0800

    kneeAngle: blackOnlyMarkers uses foundHoles (only inside contour)

 src/angle/kneeAngle.cpp          |   18 +++++++++++-------
 src/angle/kneeAngleFunctions.cpp |   14 +++-----------
 2 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/src/angle/kneeAngle.cpp b/src/angle/kneeAngle.cpp
index 0b5acb0..bbef52e 100644
--- a/src/angle/kneeAngle.cpp
+++ b/src/angle/kneeAngle.cpp
@@ -528,16 +528,15 @@ int main(int argc,char **argv)
 			}
 
 			if(framesCount >1) {
-					
+
 				//this segmented is to find the three holes
 				cvThreshold(gray,segmented,threshold,thresholdMax,CV_THRESH_BINARY_INV);
 
+				CvSeq* seqHolesEnd;
 
 				//TODO validation?
-				if(programMode == skinOnlyMarkers) {
-					maxrect.x = 0; maxrect.y = 0;
-					maxrect.width = gray->width; maxrect.height = gray->height; 
-				}
+				if(programMode == skinOnlyMarkers) 
+					seqHolesEnd = findHolesSkin(output, frame_copy, hipMarked, kneeMarked, toeMarked, font);
 				else { //if(programMode == blackOnlyMarkers) 
 
 					//this segmented is to find the contour (threshold is lot little)
@@ -546,9 +545,14 @@ int main(int argc,char **argv)
 
 					//maxrect = findLargestContour(segmented, output, showContour);
 					maxrect = findLargestContour(segmentedValidationHoles, outputTemp, showContour);
+
+					//search in output all the black places (pants) and 
+					//see if there's a hole in that pixel on segmentedValidationHoles
+					seqHolesEnd = findHoles(
+							outputTemp, segmentedValidationHoles, foundHoles, frame_copy,  
+							maxrect, hipOld, kneeOld, toeOld);
 				}
-					
-				CvSeq* seqHolesEnd = findHolesSkin(output, frame_copy, maxrect, hipMarked, kneeMarked, toeMarked, font);
+
 
 				hipMarked = *CV_GET_SEQ_ELEM( CvPoint, seqHolesEnd, 0); 
 				kneeMarked = *CV_GET_SEQ_ELEM( CvPoint, seqHolesEnd, 1 ); 
diff --git a/src/angle/kneeAngleFunctions.cpp b/src/angle/kneeAngleFunctions.cpp
index 0fc4a84..146e757 100644
--- a/src/angle/kneeAngleFunctions.cpp
+++ b/src/angle/kneeAngleFunctions.cpp
@@ -587,7 +587,7 @@ CvSeq* findHoles(IplImage *imgC, IplImage *imgH, IplImage *foundHoles, IplImage
  * this function is realy similiar to findHoles
  * try to do only a function
  */
-CvSeq* findHolesSkin(IplImage *imgThresh, IplImage *imgColor, CvRect roirect, CvPoint hipOld, CvPoint kneeOld, CvPoint toeOld, CvFont font)
+CvSeq* findHolesSkin(IplImage *imgThresh, IplImage *imgColor, CvPoint hipOld, CvPoint kneeOld, CvPoint toeOld, CvFont font)
 {
 	CvPoint pt;
 	pt.x =0;pt.y=0;
@@ -597,13 +597,7 @@ CvSeq* findHolesSkin(IplImage *imgThresh, IplImage *imgColor, CvRect roirect, Cv
 	uchar *srcdata = srcmat->data.ptr;
 	
 	int width = imgThresh->width;
-	//int minx = imgThresh->width;
-	//int endy = imgThresh->height;
-	
-	int startx = roirect.x;
-	int endx = startx + roirect.width;
-	int starty = roirect.y;
-	int endy = starty + roirect.height;
+	int endy = imgThresh->height;
 	
 	//stick storage
 	CvMemStorage* storage = cvCreateMemStorage(0);
@@ -613,12 +607,10 @@ CvSeq* findHolesSkin(IplImage *imgThresh, IplImage *imgColor, CvRect roirect, Cv
 
 	
 	//put all hole points on seqAllHoles
-	//for(int y=0;y<endy;y++)
-	for(int y=starty; y < endy; y++)
+	for(int y=0;y<endy;y++)
 	{
 		uchar *srcdataptr = srcdata + y*imgThresh->width;
 		for(int x=0;x<width;x++)
-//		for(int x=startx; x < endx; x++)
 		{
 			if(srcdataptr[x] == 0)
 			{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]