[chronojump] kneeAngle blackWithoutMarkers close to prediction
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] kneeAngle blackWithoutMarkers close to prediction
- Date: Tue, 18 May 2010 18:12:18 +0000 (UTC)
commit 0196609c9853a13ed1dd30c0f9ad7b4d32a3e221
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed May 19 02:11:49 2010 +0800
kneeAngle blackWithoutMarkers close to prediction
src/angle/kneeAngle.cpp | 54 +++++++++++++++++++++++++++++++-------
src/angle/kneeAngleFunctions.cpp | 22 +++++++++++++++
2 files changed, 66 insertions(+), 10 deletions(-)
---
diff --git a/src/angle/kneeAngle.cpp b/src/angle/kneeAngle.cpp
index b76b9e4..4d12996 100644
--- a/src/angle/kneeAngle.cpp
+++ b/src/angle/kneeAngle.cpp
@@ -554,34 +554,68 @@ int main(int argc,char **argv)
}
*/
+ //in blackWithoutMarkers, all the calculations of the bucle are done in this small if piece of code
if(ProgramMode == blackWithoutMarkers)
{
cvThreshold(gray,segmented,thresholdLargestContour,thresholdMax,CV_THRESH_BINARY_INV);
maxrect = findLargestContour(segmented, output, ShowContour);
- float rectHP = 0;
- if(maxrectHeightMax != -1)
- rectHP = 100 * (double) maxrect.height / maxrectHeightMax;
- sprintf(label, "frame: %d, rectHP %.3f%%", framesCount, rectHP);
- eraseGuiResult(gui, true);
- imageGuiResult(gui, label, font);
-
cvRectangle(frame_copy,
cvPoint(maxrect.x,maxrect.y),
cvPoint(maxrect.x + maxrect.width, maxrect.y + maxrect.height),
CV_RGB(255,0,0),1,1);
- //cvShowImage("threshold",output); //view in BW
- cvShowImage("Jump",frame_copy); //view in color
-
if(maxrect.height > maxrectHeightMax)
maxrectHeightMax = maxrect.height;
+ cvCvtColor(frame_copy,outputTemp,CV_BGR2GRAY);
+ CvPoint kneePointFront = findKneePointFront(output, maxrect, maxrectHeightMax);
+ crossPoint(frame_copy, kneePointFront, GREY, MID);
+ double myKPFY = kneePointFront.y;
+ if(myKPFY != 0)
+ myKPFY = 100 - (100 * (double) (kneePointFront.y - maxrect.y) / maxrect.height);
+
+ double rectHP = 0;
+ if(maxrectHeightMax != -1)
+ rectHP = 100 * (double) maxrect.height / maxrectHeightMax;
+// sprintf(label, "frame: %d, rectHP %.3f%%, kpfY %.3f", framesCount, rectHP, myKPFY);
+// eraseGuiResult(gui, true);
+// imageGuiResult(gui, label, font);
+ printOnScreenBWM(frame_copy, font, CV_RGB(255,255,255), labelsAtLeft,
+ framesCount, rectHP, myKPFY);
+
+ //cvShowImage("threshold",output); //view in BW
+ cvShowImage("Jump",frame_copy); //view in color
+
if(maxrect.height < maxrectHeightMin) {
maxrectHeightMin = maxrect.height;
cvCopy(frame_copy,result);
}
+
+ /* to predict angle */
+ /*
+ > load("model.RDat")
+ > rectHP = 40.274 - stored.mean.dat.90.rectHP
+ > kpfY = 74.830 - stored.mean.dat.90.kpfY
+ > newdata=data.frame(cbind(rectHP,kpfY))
+ > newdata
+ rectHP kpfY
+ 1 -27.81609 22.79087
+ > predict(lme.2, level=0, newdata=newdata)
+ [1] 57.00658
+ attr(,"label")
+ [1] "Predicted values"
+ */
+
+
+
+
+
+
+
+
+
}
else //if(ProgramMode == skinOnlyMarkers || ProgramMode == validation)
{
diff --git a/src/angle/kneeAngleFunctions.cpp b/src/angle/kneeAngleFunctions.cpp
index 9075f76..65337c0 100644
--- a/src/angle/kneeAngleFunctions.cpp
+++ b/src/angle/kneeAngleFunctions.cpp
@@ -1604,6 +1604,28 @@ void printOnScreen(IplImage * img, CvFont font, CvScalar color, bool labelsAtLef
cvPutText(img, label, cvPoint(x,height-20),&font,color);
}
}
+
+//for blackWithoutMarkers
+void printOnScreenBWM(IplImage * img, CvFont font, CvScalar color, bool labelsAtLeft,
+ int framesCount, double rectHP, double kpfY) {
+ char *label = new char[150];
+ int width = img->width;
+ int height = img->height;
+ int x;
+ if(labelsAtLeft)
+ x=10;
+ else
+ x=width-200;
+
+ sprintf(label, "frame: %d", framesCount);
+ cvPutText(img, label, cvPoint(x,height-60),&font,color);
+
+ sprintf(label, "rectHP %.3f%%", rectHP);
+ cvPutText(img, label, cvPoint(x,height-40),&font,color);
+
+ sprintf(label, "kpfY %.3f%%", kpfY);
+ cvPutText(img, label, cvPoint(x,height-20),&font,color);
+}
/*
CvSeq * GetRowsCenter(IplImage * img, CvRect maxrect, int starty, int endy)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]