This commit is contained in:
Amandinella 2015-03-12 11:26:33 +01:00
commit ecbd7b64cb
14 changed files with 139 additions and 23 deletions

View File

@ -0,0 +1,43 @@
#ifndef CALIBRATION_HPP
#define CALIBRATION_HPP
/////////////////////////////////////////////////////
/// \defgroup calibration Calibration
///
/// This module provides a program Calibration that allows to get the intrinsic
/// parameters of the camera.
///
/// You may use this program with some parameters :
/// \verbatim
/// -w <board_width> # the number of inner corners per one of board dimension
/// -h <board_height> # the number of inner corners per another board dimension
/// [-pt <pattern>] # the type of pattern: chessboard or circles grid
/// [-n <number_of_frames>] # the number of frames to use for calibration
/// # (if not specified, it will be set to the number
/// # of board views actually available)
/// [-d <delay>] # a minimum delay in ms between subsequent attempts to capture a next view
/// # (used only for video capturing)
/// [-s <squareSize>] # square size in some user-defined units (1 by default)
/// [-o <out_camera_params>] # the output filename for intrinsic [and extrinsic] parameters
/// [-op] # write detected feature points
/// [-oe] # write extrinsic parameters
/// [-zt] # assume zero tangential distortion
/// [-a <aspectRatio>] # fix aspect ratio (fx/fy)
/// [-p] # fix the principal point at the center
/// [-v] # flip the captured images around the horizontal axis
/// [-V] # use a video file, and not an image list, uses
/// # [input_data] string for the video file name
/// [-su] # show undistorted images after calibration
/// [input_data] # input data, one of the following:
/// # - text file with a list of the images of the board
/// # the text file can be generated with imagelist_creator
/// # - name of video file with a video of the board
/// # if input_data not specified, a live view from the camera is used
/// \endverbatim
/// For example, if you have a chessboard with 9 rows and 7 columns, you may use
/// \code
/// bin/Calibration -w 8 -h 6 <path_to_video> -o <path_to_output_xml_file>
/// \endcode
/////////////////////////////////////////////////////
#endif // CALIBRATION_HPP

View File

@ -5,6 +5,23 @@
/// \defgroup meshing Meshing module
///
/// Contains the function and classes to mesh 3D skeletons
///
/// This modules contains a few binaries :
/// - MainDisplay
/// - TestJunction3
/// - TestJunction4
///
/// \section maindisplay MainDisplay
/// This program simply loads a .skl file and display it with
/// OpenGL. You should call the program like so
/// \code
/// bin/MainDisplay <path_to_skl_file>
/// \endcode
///
/// \section testjunction TestJunction
/// This program simply computes the result of the junctions on three circles.
/// TestJunction3 computes a junction from three circles and
/// TestJunction4 computes it from four.
//////////////////////////////////////////////////
#include <Meshing/Skeleton3D.hpp>

View File

@ -14,6 +14,53 @@
/// \defgroup skeleton Skeleton module
///
/// Module to manage 2D-skeletons
///
/// This module contains two programs.
/// - Skeleton
/// - SkeletonDrawing
///
/// \section Skeleton
/// This is the main binary. It is meant to read two skeletons splitted, and
/// match the branches accordingly to the keypoint detected in the pictures.
/// It generates a file with the following syntax :
/// \code
/// m 1 2
/// m 4 6
/// ...
/// \endcode
///
/// Each line like
/// \code
/// m i j
/// \endcode
/// means that the i-th branch of the first skeleton was associated to the j-th
/// branch on the second one
///
/// Note that this program will probably not work if there are not the same
/// number of branches in the two skeletons.
///
/// Allowed options:
/// - -h [ --help ] produce help message
/// - --img1 arg first image (for the keypoints detection)
/// - --img2 arg second image (for the keypoints detection)
/// - --mask1 arg binary mask of the first image (to remove useless
/// - keypoints)
/// - --mask2 arg binary mask of the second image
/// - --skl1 arg first skeleton, and its branches
/// - --skl2 arg second skeleton
/// - -o [ --output ] arg output file
///
/// \section SkeletonDrawing
/// This program displays the result of a very simple test, where skeletons
/// were drawn by hand, and the keypoints are defined in the source (and not detected).
/// It shows how the program is able to work in simple cases.
///
/// This program is meant to be used like this
/// \code
/// bin/SkeletonDrawing data/skl/skullTest*
/// \endcode
///
///
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
@ -120,6 +167,7 @@ class Skeleton
////////////////////////////////////////////////////////////////////////
/// \ingroup skeleton
/// \brief match branches of two skeletons together
///
/// We consider that both skeletons have the number of branches.

View File

@ -1,5 +1,2 @@
add_executable(MainClick MainClick.cpp Click.cpp)
target_link_libraries(MainClick Geometry ${SFML_LIBRARIES})
add_executable(AnimatedMain AnimatedMain.cpp AnimatedMesh.cpp Click.cpp Menu.cpp)
target_link_libraries(AnimatedMain Geometry SFMLTools ${SFML_LIBRARIES} ${OPENGL_LIBRARIES})

View File

@ -1,3 +1,8 @@
// This file is under the BSD license of opencv
// It has been slightly modified by Simone Gapsarini
//
// The original license is available at https://github.com/Itseez/opencv/blob/master/LICENSE
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"

View File

@ -4,4 +4,6 @@
The main difficulty we had to face happened during the first part of our project. The first part was shared between us and an other "Projet long" team. Some parts were also provided by the client. Unfortunately problems happened with some of his binaries, and the integration had to be abandoned. However the client was still satisfied with the results on this first part, since as a researcher it showed him problems to work on.
The technical part of the project was very interesting, we learned a lot about C++ programming. We obtained good results on the second part of the project, which produces interesting animations.
The technical part of the project was very interesting, we learned a lot about C++ programming. We obtained good results on the second part of the project, which produces interesting animations.
To conclude, this project was an opportunity for us to apply management on a real project and an interesting technical experience.

View File

@ -2,9 +2,9 @@
The second important aspect of our project was its management.
Indeed project management will soon be part of our everyday life in our future work. That is why becoming familiar with the management tools studied in class is important and the "Projet Long" was a great opportunity to put it into practice.
We spent the first week on this part. We tried to define clearly the client need, in order to achieve good product specification. Unfortunately it had to evolve during the first part of our project. We took decisions about the way we would work, for example we decided to use pair programming, and to spend time on our tests before developing. We also worked especially on our risks table to anticipate problems, on our actions table to prevent risks realization, and on our schedule to make sure we would finish on time. \\
Indeed project management will soon be part of our everyday life in our future work. This is why becoming familiar with the management tools studied in class is important and the "Projet Long" was a great opportunity to put it into practice.
We spent our first project week on this part. We tried to define clearly the client need, in order to achieve good product specification. Unfortunately it had to evolve during the first part of our project. We took decisions about the way we would work, for example we decided to use pair programming, and to spend time on our tests before developing. We also worked especially on our risks table to anticipate problems, on our actions table to prevent risks realization, and on our schedule to make sure we would finish on time. \\
We have been updating this documents during the project in order to always anticipate problems.

View File

@ -18,4 +18,4 @@ Here is our pipeline :
\item animation
\end{itemize}
We are two Projet Long groups working on these subject. The first part was split into two subsections : the other group got to work on the segmentation and B-splines computation, while we were given the matching part and the camera calibration. The second part, concerning the meshing and the animation, is done completely by the two groups.
We were two Projet Long groups working on these subject. The first part was split into two subsections : the other group got to work on the segmentation and B-splines computation, while we were given the matching part and the camera calibration. The second part, concerning the meshing and the animation, was done completely by the two groups.

View File

@ -1,6 +1,6 @@
\chapter{Product specification}
During the first week of our project we tried to clearly define the need of the client and the specifications. In industrial context it is really fundamental to describe the best that we can the client expectations. It will protect us from the client if he wants something not intended at the beginning or if he is disappointed because he forget to specify a certain problem. But it also give us some duties to the client about the deliveries for instance. That is why it is really important to take it seriously.
During the first week of our project we tried to clearly define the need of the client and the specifications. In an industrial context it is really fundamental to describe the client expectations as well as possible. It protects us from the client if he suddenly wants something not intended at the beginning or if he is disappointed because he forgot to specify certain problems. But it also gives us some duties toward the client concerning the deliveries for instance. This is why it is really important to take it seriously.
Here is our product specification.
\section{General constraints}

View File

@ -1,11 +1,9 @@
% Here we go
\subsection{Camera calibration}
The camera calibration is needed for the client during the reconstruction
of the 3D skeleton. The calibration consists in two steps :
The camera calibration is needed by the client during the reconstruction of the 3D skeleton. The calibration consists in two steps :
\begin{enumerate}
\item the \textbf{internal calibration} which is the estimation of the
instrinsic parameters of the camera (such as the focal length, or the
\item the \textbf{internal calibration} which is the estimation of the instrinsic parameters of the camera (such as the focal length, or the
principal point)
\item the \textbf{external calibration} which is the estimation of the
@ -13,12 +11,7 @@
\end{enumerate}
\subsubsection{Internal calibration}
The internal calibration is based on a program that we completed during
a lesson last semester. By detecting chessboards in numerous positions
of the camera, we are able to estimate the intrinsic parameters. This
programs use as input a video of a chessboard where the position of
camera changes, and it captures some frames where the chessboard is
detected. With these pictures, we estimate the intrinsic parameters.
The internal calibration is based on a program that we completed during a lesson last semester. By detecting chessboards from numerous positions of the camera, we are able to estimate the intrinsic parameters. This program takes as input a video of a chessboard where the camera position changes, and it captures some frames on which the chessboard is detected. With these pictures, we estimate the intrinsic parameters.
\subsubsection{External calibration}
For the external calibration, we wrote a program that uses an

View File

@ -1,7 +1,7 @@
\subsection{Extremities}
After computing the mesh around the splines we need to draw the extremities using subdivisions to obtain smoother extremities.
The first step is to calculate the projection of the extremity circle on the correspondent sphere. Then for a subdivision of depth 0 we link this projection with the mesh points along the extrem circle (see Figure \ref{projection}). For one subdivision we take the middle of each segments compute earlier and we project it on the sphere (see Figure \ref{sub}). Finally we made a triangular mesh the way you can see on Figure \ref{mesh}).
The first step is to calculate the projection of the extremity circle on the correspondent sphere. Then for a subdivision of depth 0 we link this projection with the mesh points along the extrem circle (see Figure \ref{projection}). For one subdivision we take the middle of each segments computed earlier and we project it on the sphere (see Figure \ref{sub}). Finally we made a triangular mesh the way you can see on Figure \ref{mesh}).
The rendering of our extremities on dino.skl for example can be seen on Figures \ref{extremity2} (2 subdivisions) and \ref{extremity10}
(10 subdivisions).

View File

@ -45,11 +45,22 @@ X =
\]
Then subtract it with the centroid matrix associated.
\[
X - X_{m}
X_{c} = X - X_{m}
\]
The normal vector of the best-fitting plane is the left singular vector corresponding to the least singular value of \[ XX^T \]
The normal vector $N$ of the best-fitting plane will be the cross product of the 2 eigenvectors $v_1,v_2$ corresponding to the two biggest singular values of the covariance matrix of $X_{c}$ :
\[
X_{c}X_{c}^T
\]
\[
N = v_1 \wedge v_2
\]
Then to compute the constant value of the equation we the centroid.
Then to compute the constant value of the equation we use the centroid.
\[
d = -N*X_m
\]
At the end we have the parameters of the plane in N and d.
\begin{figure}[H]
\begin{center}