[chronojump] kneeAngle: on all markers mode, starts at last highest hipY
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] kneeAngle: on all markers mode, starts at last highest hipY
- Date: Sat, 1 May 2010 05:35:38 +0000 (UTC)
commit 1dc4c00af9318eda0161a6d476547e9dd13858e6
Author: Xavier de Blas <xaviblas gmail com>
Date: Sat May 1 13:34:46 2010 +0800
kneeAngle: on all markers mode, starts at last highest hipY
src/angle/kneeAngle.cpp | 10 ++++++++--
src/angle/kneeAngleUtil.cpp | 9 +++++++++
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/angle/kneeAngle.cpp b/src/angle/kneeAngle.cpp
index d65256b..729afd3 100644
--- a/src/angle/kneeAngle.cpp
+++ b/src/angle/kneeAngle.cpp
@@ -2056,13 +2056,19 @@ int main(int argc,char **argv)
//start of flexion is the
//last position of smoothed (and filtered) max vector size
- //except for skinOnyMarkers, that has no rectVector
+ //on blackWithoutMarkers do it using rect height,
+ //but on the rest, use hip marker because has less problems
int flexionStartsAtFrame = 0;
- if(ProgramMode != skinOnlyMarkers)
+ if(ProgramMode == blackWithoutMarkers)
flexionStartsAtFrame = findLastPositionInVector(
smoothVectorInt(rectVector),
findMaxInVector(smoothVectorInt(rectVector))
);
+ else
+ flexionStartsAtFrame = findLastPositionInVector(
+ smoothVectorInt(hipYVector),
+ findMinInVector(smoothVectorInt(hipYVector)) //min because here hipYVector has still 0 at the top
+ );
//---------------- write raw data file -------------------------------------
if((fDataRaw=fopen(fDataRawName,"w"))==NULL){
diff --git a/src/angle/kneeAngleUtil.cpp b/src/angle/kneeAngleUtil.cpp
index 2e32068..9fb46ee 100644
--- a/src/angle/kneeAngleUtil.cpp
+++ b/src/angle/kneeAngleUtil.cpp
@@ -496,6 +496,15 @@ int findMaxInVector(std::vector<int> vect) {
return max;
}
+int findMinInVector(std::vector<int> vect) {
+ int min = 100000;
+ for(int i=0; i < vect.size() ; i++)
+ if(vect[i] < min)
+ min = vect[i];
+ return min;
+}
+
+
int findLastPositionInVector(std::vector<int> vect, int searched) {
int lastFound = 0;
for(int i=0; i < vect.size() ; i++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]