[chronojump] kneeAngle improvements: If blackOnlyMarkers and hip or toe is touching top or bottom of image, findH
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] kneeAngle improvements: If blackOnlyMarkers and hip or toe is touching top or bottom of image, findH
- Date: Sat, 27 Mar 2010 14:54:50 +0000 (UTC)
commit d63b9bd9b5a75b8e733f9931696dbff7efbadcc7
Author: Xavier de Blas <xaviblas gmail com>
Date: Sat Mar 27 22:52:01 2010 +0800
kneeAngle improvements:
If blackOnlyMarkers and hip or toe is touching top or bottom of image, findHolesSkin method is used (because they are out of largest contour)
Image can start at any percent: provide .x to start at x%
Can start directly in desired mode
Help message improved
src/angle/kneeAngle.cpp | 58 ++++++++++++++++++++--------------------
src/angle/kneeAngleGlobal.cpp | 27 ++++++++++---------
2 files changed, 43 insertions(+), 42 deletions(-)
---
diff --git a/src/angle/kneeAngle.cpp b/src/angle/kneeAngle.cpp
index 3ab8498..3ea071a 100644
--- a/src/angle/kneeAngle.cpp
+++ b/src/angle/kneeAngle.cpp
@@ -160,7 +160,10 @@ int main(int argc,char **argv)
{
if(argc < 2)
{
- cout<<"Provide file location as a first argument...\noptional: provide start photogramme at 2nd argument."<<endl;
+ 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",
+ validation, blackWithoutMarkers, skinOnlyMarkers, blackOnlyMarkers, blackOnlyMarkers);
+ cout<< startMessage <<endl;
exit(1);
}
@@ -173,18 +176,19 @@ int main(int argc,char **argv)
int framesNumber = cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_COUNT);
- if(argc == 3) {
- if(atof(argv[2])==.25)
- startAt = framesNumber*.25; //start at 25%
- else if(atof(argv[2])==.5)
- startAt = framesNumber*.5; //start at 50%
- else if(atof(argv[2])==.75)
- startAt = framesNumber*.75; //start at 75%
+ if(argc >= 3) {
+ if(atof(argv[2]) < 1)
+ startAt = framesNumber * atof(argv[2]);
else
startAt = atoi(argv[2]); //start at selected frame
}
printf("Number of frames: %d\t Start at:%d\n\n", framesNumber, startAt);
+
+ int programMode = undefined;
+ if(argc == 4)
+ programMode = atoi(argv[3]);
+
//3D
//printf("framesCount;hip.x;hip.y;knee.x;knee.y;toe.x;toe.y;angle seen;angle side;angle real\n");
@@ -208,10 +212,13 @@ int main(int argc,char **argv)
cvInitFont(&font, CV_FONT_HERSHEY_COMPLEX, fontSize, fontSize, 0.0, 1, fontLineType);
cvNamedWindow("gui",1);
- gui = cvLoadImage("kneeAngle_intro.png");
- cvShowImage("gui", gui);
- int programMode = menu(gui, font);
- //printf("programMode: %d\n", programMode);
+ //if programMode is not defined or is invalid, ask user
+ if(programMode < validation || programMode > blackOnlyMarkers) {
+ gui = cvLoadImage("kneeAngle_intro.png");
+ cvShowImage("gui", gui);
+ programMode = menu(gui, font);
+ //printf("programMode: %d\n", programMode);
+ }
if(programMode == skinOnlyMarkers)
gui = cvLoadImage("kneeAngle_skin.png");
@@ -568,6 +575,16 @@ int main(int argc,char **argv)
seqHolesEnd = findHoles(
outputTemp, segmentedValidationHoles, foundHoles, frame_copy,
maxrect, hipOld, kneeOld, toeOld, font);
+
+ //if hip or toe is touching a border of the image
+ //then will not be included in largest contour
+ //then use findHolesSkin to find points
+ CvPoint myHip = pointToZero();
+ CvPoint myToe = pointToZero();
+ myHip = *CV_GET_SEQ_ELEM( CvPoint, seqHolesEnd, 0);
+ myToe = *CV_GET_SEQ_ELEM( CvPoint, seqHolesEnd, 2 );
+ if(pointIsNull(myHip) || pointIsNull(myToe))
+ seqHolesEnd = findHolesSkin(output, frame_copy, hipMarked, kneeMarked, toeMarked, font);
}
@@ -1257,23 +1274,6 @@ int main(int argc,char **argv)
if(mouseClicked == quit || key == 27 || key == 'q') // 'ESC'
shouldEnd = true;
- /*
- else if (mouseClicked == TGLOBALMORE)
- threshold += thresholdInc;
- else if (mouseClicked == TGLOBALLESS) {
- threshold -= thresholdInc;
- if(threshold < 0)
- threshold = 0;
- */
- /*
- else if (key == 'l')
- labelsAtLeft = ! labelsAtLeft;
- else if (key == 'r') { //reset legs length
- upLegMarkedDistMax = 0;
- downLegMarkedDistMax = 0;
- }
- */
-
if (mouseClicked == FORWARD) {
forward = true;
imageGuiResult(gui, "Forwarding...", font);
diff --git a/src/angle/kneeAngleGlobal.cpp b/src/angle/kneeAngleGlobal.cpp
index bc32531..6ce1300 100644
--- a/src/angle/kneeAngleGlobal.cpp
+++ b/src/angle/kneeAngleGlobal.cpp
@@ -72,22 +72,23 @@ enum { SMALL = 1, MID = 2, BIG = 3 };
* skinOnlyMarkers uses markers to find three points and angle (easiest)
* skinOnlyMarkers uses markers to find three points and angle but in pants (it uses findLargestContour and finds inside it)
*/
-enum { quit = -2, undefined = -1, validation = 0, blackWithoutMarkers = 1, skinOnlyMarkers = 2, blackOnlyMarkers = 3};
+//NOTE: if this changes, change also in kneeangle.cpp menu
+enum { quit = -1, undefined = 0, validation = 1, blackWithoutMarkers = 2, skinOnlyMarkers = 3, blackOnlyMarkers = 4};
//used on gui
enum {
- QUIT = -2,
- UNDEFINED = -1,
- YES = 0, NO = 1, NEVER = 2,
- PLAYPAUSE = 3, FORWARDONE = 4, FORWARD = 5, FASTFORWARD = 6, BACKWARD = 7,
- HIPMARK = 8, KNEEMARK = 9, TOEMARK = 10, ZOOM = 11,
- THIPMORE = 12, THIPLESS = 13,
- TKNEEMORE = 14, TKNEELESS = 15,
- TTOEMORE = 16, TTOELESS = 17,
- TGLOBALMORE = 18, TGLOBALLESS = 19,
- SHIPMORE = 20, SHIPLESS = 21,
- SKNEEMORE = 22, SKNEELESS = 23,
- STOEMORE = 24, STOELESS = 25
+ QUIT = -1,
+ UNDEFINED = 0,
+ YES = 1, NO = 2, NEVER = 3,
+ PLAYPAUSE = 4, FORWARDONE = 5, FORWARD = 6, FASTFORWARD = 7, BACKWARD = 8,
+ HIPMARK = 9, KNEEMARK = 10, TOEMARK = 11, ZOOM = 12,
+ THIPMORE = 13, THIPLESS = 14,
+ TKNEEMORE = 15, TKNEELESS = 16,
+ TTOEMORE = 17, TTOELESS = 18,
+ TGLOBALMORE = 19, TGLOBALLESS = 20,
+ SHIPMORE = 21, SHIPLESS = 22,
+ SKNEEMORE = 23, SKNEELESS = 24,
+ STOEMORE = 25, STOELESS = 26
};
enum { TOGGLENOTHING = -1, TOGGLEHIP = 0, TOGGLEKNEE = 1, TOGGLETOE = 2};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]