[chronojump] kneeAngle: use blackOnlyMarkers instead of validation. kneePointFront & back now always 0 if undetec



commit 18720c47c52a67c8b6362f1bfb20d69d96248e21
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon May 3 17:53:34 2010 +0800

    kneeAngle: use blackOnlyMarkers instead of validation. kneePointFront & back now always 0 if undetected

 src/angle/kneeAngle.cpp          |   35 ++++++++++++++++---
 src/angle/kneeAngleFunctions.cpp |    1 -
 src/angle/kneeAngle_intro.png    |  Bin 38016 -> 45833 bytes
 src/angle/kneeAngle_intro.svg    |   71 +++++++++++++++++++++++++++++++++++--
 4 files changed, 97 insertions(+), 10 deletions(-)
---
diff --git a/src/angle/kneeAngle.cpp b/src/angle/kneeAngle.cpp
index 729afd3..1aeffc4 100644
--- a/src/angle/kneeAngle.cpp
+++ b/src/angle/kneeAngle.cpp
@@ -165,7 +165,7 @@ int main(int argc,char **argv)
 	if(argc < 2)
 	{
 		char *startMessage = new char[300];
-		sprintf(startMessage, "\nkneeAngle HELP.\n\nProvide file location as a first argument...\nOptional: as 2nd argument provide a fraction of video to start at that frame, or a concrete frame.\nOptional: as 3rd argument provide mode you want to execute (avoiding main menu).\n\t%d: validation; %d: blackWithoutMarkers; %d: skinOnlyMarkers; %d: blackOnlyMarkers.\n\nEg: Start at frame 5375:\n\tkneeAngle myfile.mov 5375\nEg:start at 80 percent of video and directly as blackOnlyMarkers:\n\tkneeAngle myFile.mov .8 %d\n\nNote another param can be used to default trhesholdLargestContour on blackOnly and on validation", 
+		sprintf(startMessage, "\nkneeAngle HELP.\n\nProvide file location as a first argument...\nOptional: as 2nd argument provide a fraction of video to start at that frame, or a concrete frame.\nOptional: as 3rd argument provide mode you want to execute (avoiding main menu).\n\t%d: validation (don't use this, use blackOnlyMarkers); %d: blackWithoutMarkers; %d: skinOnlyMarkers; %d: blackOnlyMarkers.\n\nEg: Start at frame 5375:\n\tkneeAngle myfile.mov 5375\nEg:start at 80 percent of video and directly as blackOnlyMarkers:\n\tkneeAngle myFile.mov .8 %d\n\nNote another param can be used to default trhesholdLargestContour on blackOnly and on validation", 
 				validation, blackWithoutMarkers, skinOnlyMarkers, blackOnlyMarkers, blackOnlyMarkers);
 		std::cout<< startMessage <<std::endl;
 		exit(1);
@@ -2085,12 +2085,23 @@ int main(int argc,char **argv)
 			if(ProgramMode != skinOnlyMarkers)
 				rectHeightPercent = 100 * (double) rectVector[i] / rectHeightMax;
 
+			//if kneePointFront is not detected, it's 0.
+			//verticalHeight is used to convert Y of OpenCV (top) to Y of R (bottom)
+			//don't convert to 384 when it's undetected
+			//same for KneePointBack
+			int myKPFY = kneePointFrontYVector[i];
+			if(myKPFY != 0)
+				myKPFY = verticalHeight - kneePointFrontYVector[i];
+			int myKPBY = kneePointBackYVector[i];
+			if(myKPBY != 0)
+				myKPBY = verticalHeight - kneePointBackYVector[i];
+
 			fprintf(fDataRaw, "%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%f;%d;%f\n", 
 					hipXVector[i], verticalHeight - hipYVector[i],
 					kneeXVector[i], verticalHeight - kneeYVector[i],
 					toeXVector[i], verticalHeight - toeYVector[i],
-					kneePointFrontXVector[i], verticalHeight - kneePointFrontYVector[i], 
-					kneePointBackXVector[i], verticalHeight - kneePointBackYVector[i],
+					kneePointFrontXVector[i], myKPFY, 
+					kneePointBackXVector[i], myKPBY,
 					angleVector[i], rectVector[i], 
 					rectHeightPercent);
 		}
@@ -2098,6 +2109,8 @@ int main(int argc,char **argv)
 	fclose(fDataRaw);
 
 	//---------------- write smooth data file -------------------------------------
+	/* currently unused */
+	/*
 	if((fDataSmooth=fopen(fDataSmoothName,"w"))==NULL){
 		printf("Error, no se puede escribir en el fichero %s\n",fDataSmoothName);
 	} else {
@@ -2133,18 +2146,30 @@ int main(int argc,char **argv)
 			if(ProgramMode != skinOnlyMarkers)
 				rectHeightPercent = 100 * (double) rectVector[i] / rectHeightMax;
 
+			//if kneePointFront is not detected, it's 0.
+			//verticalHeight is used to convert Y of OpenCV (top) to Y of R (bottom)
+			//don't convert to 384 when it's undetected
+			//same for KneePointBack
+			int myKPFY = kneePointFrontYVector[i];
+			if(myKPFY != 0)
+				myKPFY = verticalHeight - kneePointFrontYVector[i];
+			int myKPBY = kneePointBackYVector[i];
+			if(myKPBY != 0)
+				myKPBY = verticalHeight - kneePointBackYVector[i];
+
 			fprintf(fDataSmooth, "%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%f;%f;%d;%f\n", 
 					hipXVector[i], verticalHeight - hipYVector[i],
 					kneeXVector[i], verticalHeight - kneeYVector[i],
 					toeXVector[i], verticalHeight - toeYVector[i],
-					kneePointFrontXVector[i], verticalHeight - kneePointFrontYVector[i], 
-					kneePointBackXVector[i], verticalHeight - kneePointBackYVector[i],
+					kneePointFrontXVector[i], myKPFY, 
+					kneePointBackXVector[i], myKPBY,
 					angleVector[i], //trying angle smoothed
 					angleSmoothed, rectVector[i], 
 					rectHeightPercent);
 		}
 	}
 	fclose(fDataSmooth);
+	*/
 
 	//------------------ clear memory ----------------------
 	cvClearMemStorage( stickStorage );
diff --git a/src/angle/kneeAngleFunctions.cpp b/src/angle/kneeAngleFunctions.cpp
index 35464e8..b48700a 100644
--- a/src/angle/kneeAngleFunctions.cpp
+++ b/src/angle/kneeAngleFunctions.cpp
@@ -118,7 +118,6 @@ CvPoint findHipPoint(IplImage* img,CvRect roirect)
  * Knee point is a white pixel below the hip point and having maximum x coordinate in the bounding box
  * Returns the coordinate of the knee point
  */
-//CvPoint findKneePointFront(IplImage *img, CvRect roirect, bool foundAngleOneTime)
 CvPoint findKneePointFront(IplImage *img, CvRect roirect, int rectHMax)
 {
 	CvPoint pt;
diff --git a/src/angle/kneeAngle_intro.png b/src/angle/kneeAngle_intro.png
index 0194048..b9a50cd 100644
Binary files a/src/angle/kneeAngle_intro.png and b/src/angle/kneeAngle_intro.png differ
diff --git a/src/angle/kneeAngle_intro.svg b/src/angle/kneeAngle_intro.svg
index f6a4ffd..eb7e44a 100644
--- a/src/angle/kneeAngle_intro.svg
+++ b/src/angle/kneeAngle_intro.svg
@@ -439,6 +439,20 @@
        inkscape:vp_y="0 : 1000 : 0"
        inkscape:vp_x="0 : 0.5 : 1"
        sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective3811"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <inkscape:perspective
+       id="perspective3837"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
   </defs>
   <sodipodi:namedview
      id="base"
@@ -450,9 +464,9 @@
      objecttolerance="10"
      inkscape:pageopacity="1"
      inkscape:pageshadow="2"
-     inkscape:zoom="1.2166491"
-     inkscape:cx="251.26426"
-     inkscape:cy="180.22972"
+     inkscape:zoom="0.86030083"
+     inkscape:cx="232.58729"
+     inkscape:cy="178.58586"
      inkscape:document-units="px"
      inkscape:current-layer="capa1"
      showgrid="false"
@@ -461,7 +475,7 @@
      inkscape:window-width="1016"
      inkscape:window-height="711"
      inkscape:window-x="0"
-     inkscape:window-y="25"
+     inkscape:window-y="18"
      inkscape:window-maximized="0">
     <inkscape:grid
        type="xygrid"
@@ -966,5 +980,54 @@
          x="408.37946"
          y="262.07037"
          id="tspan15220-4">WITH markers</tspan></text>
+    <g
+       id="g3825"
+       transform="translate(6,-16)">
+      <path
+         id="path2975"
+         d="M 28.450532,97.688578 122.58424,185.04657"
+         style="fill:none;stroke:#ff0303;stroke-width:2.06655812;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+      <path
+         id="path2975-6"
+         d="M 122.68438,96.86665 28.550676,184.22464"
+         style="fill:none;stroke:#ff0303;stroke-width:2.06655812;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+    </g>
+    <g
+       id="g4066">
+      <rect
+         y="174.24477"
+         x="32.877186"
+         height="46.028061"
+         width="96.165771"
+         id="rect3860"
+         style="fill:#e9afaf;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.29999995000000013;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+      <text
+         id="text3319-5"
+         y="182.40225"
+         x="32.921394"
+         style="font-size:10px;font-style:normal;font-weight:normal;fill:#ff0000;fill-opacity:1;stroke:none;font-family:Chandas"
+         xml:space="preserve"><tspan
+           y="182.40225"
+           x="32.921394"
+           id="tspan3321-5"
+           sodipodi:role="line">Don't use,</tspan><tspan
+           id="tspan3854"
+           y="194.90225"
+           x="32.921394"
+           sodipodi:role="line">use this</tspan><tspan
+           id="tspan3856"
+           y="207.40225"
+           x="32.921394"
+           sodipodi:role="line">it manages better</tspan><tspan
+           id="tspan3858"
+           y="219.90225"
+           x="32.921394"
+           sodipodi:role="line">contour and holes</tspan></text>
+    </g>
+    <path
+       style="fill:none;stroke:#ff0000;stroke-width:2.1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#EmptyTriangleOutL);stroke-miterlimit:4;stroke-dasharray:none"
+       d="M 83.836827,190.68335 387.95081,158.62809"
+       id="path3864"
+       sodipodi:nodetypes="cc" />
   </g>
 </svg>



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