Monday, March 29, 2010

Demo From My Graduation Project!

As the title says…
Demo from my graduation project… Done on June 2009.
Project Name: “Free Hand Sketch Recognition For Visualizing Interactive Physics”
Code Name: Raccoon
Video:
About:
The aim of the project is to develop a natural sketching system that allows the users to sketch different objects to draw simple two-dimensional classical mechanics physical model in natural and freely way as they would on paper. The user then shall be able to interact with the design, simulate and visualize the model at any point of time in design process, and watch how the objects interact together.
Main Modules: Recognition, Reasoning, Simulator and User Interface
My Responsibility: The Simulator module; which consists of two components:  Physics Engine & Graphical Layer.
Technology used: Microsoft .Net framework 3.5 [C#] ; Visual C++ (Visual Studio 2008) ; Matlab 7.3 ; OpenGL 2.1 [ + GLUT (The OpenGL Utility Toolkit)] ; LyX: to write the documentation
Notes!
The project targets two sections: students study physics and mechanics, and mechanical engineers to prototype quite simple machines.
Actually, the project isn't completed yet, there is a 'gap' in the graphical layer part (visualization); it does not support all the features provided by the physics engine (simulation) or the recognition module. Besides, the reasoning module still needs some work. (The main rule of reasoning module: make the system understands (not recognize) 'every' stroke the user draws; so s/he doesn't need the menus at all but draws as s/he would exactly do on a piece of paper)
Example of features kind of lost because of the gaps between the modules: pin-joint, rod, complex polygon, spring (spring system).., analysis and plot certain object's info.. and even analysis the whole scene.
When you have those ones, you could ‘just draw’ a complete -quite simple- machine (or complete physical system) and visualize it without any CAD system.

5 comments:

Unknown said...

Hey It was really interesting to see your project.Can you tell me how did you theoretically approach this project? any research papers you referred to?

M said...

Thank you! :)
I will reply back this Weekend.

Unknown said...

He Magdy......I am eagery waiting for your reply....

M said...

Hey.. I am so sorry for being that late to reply. ^^
----

The whole project was inspired by "MIT ASSIST project", which was the actual motivation for the work.

The project is composed of four mains modules: Graphical User Interface (GUI), Recognition,
Reasoning and Simulator.

Check these papers:
- C. Alvarado. A Natural Sketching Environment: Bringing the Computer into the Early Stages of Mechanical Design. Master’s Thesis, MIT, 2000. (This was so very useful for the whole project)
- The four papers in the Publications section in MIT ASSIST project website might be useful:
url: rationale.csail.mit.edu/project_assist_a_shrewd_sketch_interpretation.html

---

“Sketch Recognition”

First of all, Recognition is a process to distinguish something depending on some rules or templates. Sketch recognition is a type of recognition that its role is to distinguish shapes drawn. In our project, it is mainly designed for recognizing the free hand sketch, which the user draws by her hand.

Input: It takes from the interface a stroke that is a set of graphical points drawn by the user
Output: an interpretation of that stroke

Remember here, you seek a good level of accuracy. The fewer mistakes the system makes, the less the user will have to pause in her work to correct the system’s mistakes.

I am not fully aware of the sketch recognition part! However, I think this might be useful:

- We used geometrical approaches to recognize the sketched shapes! Another option is to use statistical methods (pattern recognition, machine learning)!
- This paper, [Jorge, J., Fonseca, M., 2000. A Simple Approach to Recognise Geometric Shapes Interactively.], was quite helpful, and I think the recognition algorithm used was based on it.

- Book: Hastie, T., Tibshirani, R. & Friedman, J.H., 2003. The Elements of Statistical Learning Corrected., Springer.
(Highly recommended if you are going to follow the statistical methods and machine learning)

---

“Reasoning”

There is where you give your application some knowledge (rules) to take some decisions. Example, the user has drawn a circle, and the Recognizer did recognize its geometrical shape. The Reasoning, on the other hand, is the part that tells us what that circle is exactly! Is it a circular body, a pin-joint, selection circle, or wheel … so on!
The goal is to scores each interpretation for the last stroke drawn, and order interpretations in order of likelihood! You will spend time on Reasoning’s Rules (Categorical rules, Situational rules, .. etc)

Likewise, I am not fully aware of that module, but some references from the Bibliography are:

- Brachman, R. & Levesque, H., 2004. Knowledge Representation and Reasoning 1st ed., Morgan Kaufmann.
- Siler, W. & Buckley, J.J., 2004. Fuzzy Expert Systems and Fuzzy Reasoning 1st ed., Wiley-Interscience.
- Reich, K.H., 2002. Developing the Horizons of the Mind: Relational and Contextual Reasoning and the Resolution of Cognitive Conflict, Cambridge University Press.

Note: the reasoning part was not powerful in our project, at least when you compare it to MIT ASSIST's one. (You can say, in MIT project, the reasoning was the "main" or motivation part of the project)

M said...

[Cont.]

---

Simulator:

In MIT project, they did not build that part, but they used a simulation software called: Working Model.

In our project, The Simulator, which responsible to simulate and visualize a physical model has been drawn by the user, consists of two components:

* Physics Engine: is the core competent in the simulator module, which is responsible for simulating the rigid bodies, detects collisions between objects, and realistically resolves those collisions.

* Graphical Layer: Responsible for rendering model generated from the Recognition phase (Recognition and Reasoning modules) and simulated by the physics engine.

The simulation is based on a mathematical model, which is a set of equations that describe the physical behaviors for modeling classical mechanics physical system where the motion of a body is described by its position and velocity as the time varies.
The numerical method I used in the integral part of the physics engine is the first order Euler integration method.

Some Main References:
- Zill, D.G., 2000. A First Course in Differential Equations with Modeling Applications
7th ed., Brooks Cole.
- Serway, R.A. & Jewett, J.W., 2003. Physics for Scientists and Engineers 6th ed.,
Brooks Cole.
- Ericson, C., 2005. Real-Time Collision Detection, Morgan Kaufmann.
- Millington, I., 2007. Game Physics Engine Development 1st ed., Morgan Kaufmann.

---

Hope that helps! =)