Weitere ähnliche Inhalte Ähnlich wie 肉体言語 Tython (20) Kürzlich hochgeladen (20) 肉体言語 Tython7. Tython is …
• Interface
• Not use keyboard
• Not use mouse
• Use own body ! muscle !
• Programming Style
• Exercise
• No experience welcome !
. . . . . .
13. License
MAHALO License (based on MIT License)
Copyright (c) 2011 Wataru MIYAGUNI
( )
•
• ( )
.(
https://github.com/gongo/Tython/raw/development/LICENSE )
. . . . . .
17. Detector Vector
− · − = |− ||− | cos θ
→ →
a b → →
a b
→·−
− →
..
. cos θ =
a b
→||→|
− −
|a b
−
→
− · b = x x +y y +z z
→a 1 2 1 2 1 2
−| =
→
|a x 2+y 2+z 2
1 1 1
. . . . . .
22. InputMethod
Detector
Detector Command input string
LeftJab “a”
RightStraight “@”
RightUpper “g”
LeftHook ““
Detector
Detector Command
Thanks
. . . . . .
24. Others (Like Typhon)
• Compiler
• Typhon
Typhon Middle language explain
aa#{NUM}g pushNUM add to stack
a@a#{NUM}g copyNUM copy stack value
.. ..
• Typhon
string binary decimal
aa@a@ +0101 5
@@a@a -1010 -10
• VM (Virtual Machine)
Typhon
. . . . . .
33. Using Testing Framework
• GoogleTest
• Google C++ Testing Framework
http://code.google.com/p/googletest/
• Google Test
http://opencv.jp/googletestdocs/
. . . . . .
34. GoogleTest Sample 1
ASSERT
TEST_F(VectorTest, TestDot) {
Vector vec1(3.0f, 0.0f, 0.0f);
Vector vec2(0.0f, 1.0f, 0.0f);
Vector vec3(1.0f, 1.0f, 1.0f);
Vector vec4(-12.0f, 0.0f, 0.0f);
ASSERT_EQ( 1.0f, vec1.dot(vec1)); // ( )
ASSERT_EQ( 0.0f, vec1.dot(vec2)); //
ASSERT_LT( 0.0f, vec1.dot(vec3)); //
ASSERT_EQ(-1.0f, vec1.dot(vec4)); // ( )
ASSERT_GT( 0.0f, vec3.dot(vec4)); //
}
. . . . . .
35. GoogleTest Sample 2
/**
*
* 1. push 7 #=> aaaaaag
* 2. push 2 #=> aaa@a@g
* 3. add #=> @aaa stack top 2+7 = 9
* 4. num_out #=> @ a@ stack top
*/
insns = compiler->compile("aaaaaagaaa@a@g@aaa@ a@");
testing::internal::CaptureStdout();
object->run(insns);
ASSERT_STREQ("9", testing::internal::GetCapturedStdout().c_str());
. . . . . .
36. Problem about testing
…
1
.. PoseDetector
•
• (Kinect)
2
.. CommandDetector
• hogehoge
• sleep()
•
• 1,2
• Kinect (30 )
•
. . . . . .
37. GoogleMock
• Google C++ Mocking Framework
http://code.google.com/p/googlemock/
• Google Mock
http://opencv.jp/googlemockdocs/
. . . . . .
38. How?
•
Tython / test / CommandDetectorTest.cc
•
Tython / test / LeftJabCommandDetectorTest.cc
. . . . . .
41. Finish!!
GKD
(Gongo Kinect Diet)
. . . . . .