Added license to files

This commit is contained in:
Thomas FORGIONE 2015-03-12 18:12:50 +01:00
parent cc799cb04b
commit 3644326d72
73 changed files with 2551 additions and 1000 deletions

View File

@ -1,146 +1,173 @@
#ifndef ANIMATEDMESH_HPP
#define ANIMATEDMESH_HPP
#include <vector>
#include <unordered_map>
#include <memory>
#include <Geometry/Tree.hpp>
#include <Geometry/Mesh.hpp>
#include <Geometry/Point.hpp>
#include <Geometry/MathFunctions.hpp>
#include <Geometry/Rotation.hpp>
#include <Meshing/Skeleton3D.hpp>
#include <GL/gl.h>
namespace pae
{
///////////////////////////////////////////////////////////
/// \ingroup animation
/// \brief Class representing an animated mesh
///////////////////////////////////////////////////////////
class AnimatedMesh
{
public:
///////////////////////////////////////////////////////////
/// \brief Usual constructor
/// \param skeleton Skeleton to animate
///
/// Create an animated mesh from the skeletton. It opens
/// a GUI to create patellas with the left clic, and choose a root for
/// the trees. The right click must be on an extremity of the mesh.
///////////////////////////////////////////////////////////
AnimatedMesh(Skeleton3D<geo::Vector3<float>,float> const& skeleton);
///////////////////////////////////////////////////////////
/// \brief OpenGL render function
///
/// Draw the animated mesh with OpenGL
///////////////////////////////////////////////////////////
void draw() const;
geo::Tree<geo::Rotation> rotations; ///< Tree of rotations
std::vector<geo::Path> paths; ///< Vector of paths to access elements in the order
private:
/////////////////////////////////////////////////////////////////////
///
/// \brief find the nearest segment of each point
///
/// \param segments takes a vector for the different splines, containing vectors corresponding to the different segments
/// \param mesh the mesh
///
/// \return the associated segment for each point
///
/////////////////////////////////////////////////////////////////////
void associateBranches(std::vector<geo::Segment<float,3>> const& segments, geo::Mesh& mesh);
//////////////////////////////////////////////////////////////////////
///
/// \brief find a point nearest segment
///
/// \param segments list of skeleton's segments
/// \param p point to project
///
/// \return nearest segment index
///
//////////////////////////////////////////////////////////////////////
unsigned int findNearestSegment(std::vector<geo::Segment<float,3>> const& segments, geo::Point<float> const& p);
//////////////////////////////////////////////////////////////////////
///
/// \brief find the faces associated to each segment
///
/// \param associatedSegments the associated segment for each point
/// \param mesh the mesh
/// \param nbSegments number of segments
///
/// \return faces associated to each segment
///
//////////////////////////////////////////////////////////////////////
void findFaces(std::vector<unsigned int> const& associatedSegments, geo::Mesh& mesh, unsigned int nbSegments);
std::vector<geo::Segment<float,3>> segments; ///< segments of the skeleton
std::vector<geo::Vector3<float>> vertices; ///< Vertices of the mesh
std::vector<unsigned int> associatedSegment; ///< Each element of this vector is the indexes of the associated segment
std::vector<std::vector<geo::Vector3<unsigned int>>> facesPerSegment; ///< Each vector contains the faces of one segment
geo::Tree<int> structure; ///< Tree containing the indices of the vertices. The root is -1
geo::Tree<geo::Vector3<float>> roots; ///< Tree containing the vertices corresponding to the centers of the rotations
geo::Tree<std::vector<geo::Vector3<unsigned int>>> structuredFaces; ///< Faces structured as a tree
std::unordered_map<unsigned int, geo::Path> otherVertices; ///< map providing path to access to vertices in the trees (usefull to find the rotations)
geo::Tree<std::array<float,3>> colors; ///< Tree containg the colors of vertices
};
geo::Tree<int>& genStructure(std::vector<geo::Segment<float,3>> const& segments, geo::Tree<geo::Vector3<float>> const& tree, geo::Tree<int>& ret);
geo::Tree<geo::Vector3<float>>& genStructure(std::vector<geo::Segment<float,3>> const& segments, geo::Tree<geo::Vector3<float>> const& tree, geo::Tree<geo::Vector3<float>>& ret);
geo::Tree<std::vector<geo::Vector3<unsigned int>>>&
genStructuredFaces(
std::vector<std::vector<geo::Vector3<unsigned int>>> const& facesPerSegment,
geo::Tree<int> const& structure,
geo::Tree<std::vector<geo::Vector3<unsigned int>>>& faces
);
std::unordered_map<unsigned int, geo::Path>&
genOtherVertices(
std::vector<geo::Vector3<float>> const& vertices,
std::vector<geo::Vector3<unsigned int>> const& otherFaces,
std::vector<unsigned int> associatedSegment,
geo::Tree<int> const& structure,
std::unordered_map<unsigned int, geo::Path>& ret,
geo::Path path = {}
);
geo::Tree<std::array<float,3>>&
genColors(
geo::Tree<int> const& structure,
geo::Tree<std::array<float,3>>& colors);
geo::Tree<geo::Rotation>&
genRotations(
geo::Tree<geo::Vector3<float>> const& extremities,
geo::Tree<geo::Rotation>& ret
);
std::vector<geo::Path>&
genPaths(
geo::Tree<int> const& structure,
std::vector<geo::Path>& paths,
geo::Path currentPath = {});
void drawTree(std::vector<geo::Vector3<float>> const& vertices, geo::Tree<std::vector<geo::Vector3<unsigned int>>> const& faces, geo::Tree<std::array<float,3>> const& colors, geo::Tree<geo::Vector3<float>> const& extremities, geo::Tree<geo::Rotation> const& rotations);
void drawOthers(std::vector<geo::Vector3<float>> const& vertices, std::unordered_map<unsigned int, geo::Path> const& other_vertices, std::vector<geo::Vector3<unsigned int>> const& faces, geo::Tree<std::array<float,3>> const& colors, geo::Tree<geo::Rotation> const& rotations);
} // namespace pae
#endif // ANIMATEDMESH_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <vector>
#include <unordered_map>
#include <memory>
#include <Geometry/Tree.hpp>
#include <Geometry/Mesh.hpp>
#include <Geometry/Point.hpp>
#include <Geometry/MathFunctions.hpp>
#include <Geometry/Rotation.hpp>
#include <Meshing/Skeleton3D.hpp>
#include <GL/gl.h>
namespace pae
{
///////////////////////////////////////////////////////////
/// \ingroup animation
/// \brief Class representing an animated mesh
///////////////////////////////////////////////////////////
class AnimatedMesh
{
public:
///////////////////////////////////////////////////////////
/// \brief Usual constructor
/// \param skeleton Skeleton to animate
///
/// Create an animated mesh from the skeletton. It opens
/// a GUI to create patellas with the left clic, and choose a root for
/// the trees. The right click must be on an extremity of the mesh.
///////////////////////////////////////////////////////////
AnimatedMesh(Skeleton3D<geo::Vector3<float>,float> const& skeleton);
///////////////////////////////////////////////////////////
/// \brief OpenGL render function
///
/// Draw the animated mesh with OpenGL
///////////////////////////////////////////////////////////
void draw() const;
geo::Tree<geo::Rotation> rotations; ///< Tree of rotations
std::vector<geo::Path> paths; ///< Vector of paths to access elements in the order
private:
/////////////////////////////////////////////////////////////////////
///
/// \brief find the nearest segment of each point
///
/// \param segments takes a vector for the different splines, containing vectors corresponding to the different segments
/// \param mesh the mesh
///
/// \return the associated segment for each point
///
/////////////////////////////////////////////////////////////////////
void associateBranches(std::vector<geo::Segment<float,3>> const& segments, geo::Mesh& mesh);
//////////////////////////////////////////////////////////////////////
///
/// \brief find a point nearest segment
///
/// \param segments list of skeleton's segments
/// \param p point to project
///
/// \return nearest segment index
///
//////////////////////////////////////////////////////////////////////
unsigned int findNearestSegment(std::vector<geo::Segment<float,3>> const& segments, geo::Point<float> const& p);
//////////////////////////////////////////////////////////////////////
///
/// \brief find the faces associated to each segment
///
/// \param associatedSegments the associated segment for each point
/// \param mesh the mesh
/// \param nbSegments number of segments
///
/// \return faces associated to each segment
///
//////////////////////////////////////////////////////////////////////
void findFaces(std::vector<unsigned int> const& associatedSegments, geo::Mesh& mesh, unsigned int nbSegments);
std::vector<geo::Segment<float,3>> segments; ///< segments of the skeleton
std::vector<geo::Vector3<float>> vertices; ///< Vertices of the mesh
std::vector<unsigned int> associatedSegment; ///< Each element of this vector is the indexes of the associated segment
std::vector<std::vector<geo::Vector3<unsigned int>>> facesPerSegment; ///< Each vector contains the faces of one segment
geo::Tree<int> structure; ///< Tree containing the indices of the vertices. The root is -1
geo::Tree<geo::Vector3<float>> roots; ///< Tree containing the vertices corresponding to the centers of the rotations
geo::Tree<std::vector<geo::Vector3<unsigned int>>> structuredFaces; ///< Faces structured as a tree
std::unordered_map<unsigned int, geo::Path> otherVertices; ///< map providing path to access to vertices in the trees (usefull to find the rotations)
geo::Tree<std::array<float,3>> colors; ///< Tree containg the colors of vertices
};
geo::Tree<int>& genStructure(std::vector<geo::Segment<float,3>> const& segments, geo::Tree<geo::Vector3<float>> const& tree, geo::Tree<int>& ret);
geo::Tree<geo::Vector3<float>>& genStructure(std::vector<geo::Segment<float,3>> const& segments, geo::Tree<geo::Vector3<float>> const& tree, geo::Tree<geo::Vector3<float>>& ret);
geo::Tree<std::vector<geo::Vector3<unsigned int>>>&
genStructuredFaces(
std::vector<std::vector<geo::Vector3<unsigned int>>> const& facesPerSegment,
geo::Tree<int> const& structure,
geo::Tree<std::vector<geo::Vector3<unsigned int>>>& faces
);
std::unordered_map<unsigned int, geo::Path>&
genOtherVertices(
std::vector<geo::Vector3<float>> const& vertices,
std::vector<geo::Vector3<unsigned int>> const& otherFaces,
std::vector<unsigned int> associatedSegment,
geo::Tree<int> const& structure,
std::unordered_map<unsigned int, geo::Path>& ret,
geo::Path path = {}
);
geo::Tree<std::array<float,3>>&
genColors(
geo::Tree<int> const& structure,
geo::Tree<std::array<float,3>>& colors);
geo::Tree<geo::Rotation>&
genRotations(
geo::Tree<geo::Vector3<float>> const& extremities,
geo::Tree<geo::Rotation>& ret
);
std::vector<geo::Path>&
genPaths(
geo::Tree<int> const& structure,
std::vector<geo::Path>& paths,
geo::Path currentPath = {});
void drawTree(std::vector<geo::Vector3<float>> const& vertices, geo::Tree<std::vector<geo::Vector3<unsigned int>>> const& faces, geo::Tree<std::array<float,3>> const& colors, geo::Tree<geo::Vector3<float>> const& extremities, geo::Tree<geo::Rotation> const& rotations);
void drawOthers(std::vector<geo::Vector3<float>> const& vertices, std::unordered_map<unsigned int, geo::Path> const& other_vertices, std::vector<geo::Vector3<unsigned int>> const& faces, geo::Tree<std::array<float,3>> const& colors, geo::Tree<geo::Rotation> const& rotations);
} // namespace pae
#endif // ANIMATEDMESH_HPP

View File

@ -1,5 +1,32 @@
#ifndef ANIMATION_HPP
#define ANIMATION_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////
/// \defgroup animation Animation module

View File

@ -1,5 +1,32 @@
#ifndef CLICK_HPP
#define CLICK_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <vector>
#include <Geometry/MathFunctions.hpp>

View File

@ -1,5 +1,32 @@
#ifndef MENU_HPP
#define MENU_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <memory>

View File

@ -1,5 +1,32 @@
#ifndef CALIBRATION_HPP
#define CALIBRATION_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
/// \defgroup calibration Calibration

View File

@ -1,5 +1,32 @@
#ifndef DETECTIONANDMATCHING_HPP
#define DETECTIONANDMATCHING_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
/// \defgroup detectionandmatching Detection and Matching module

View File

@ -1,5 +1,32 @@
#ifndef _CAMERA_HPP_
#define _CAMERA_HPP_
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <opencv2/core/core.hpp>

View File

@ -1,5 +1,32 @@
#ifndef _CHESSBOARDCAMERATRACKER_HPP_
#define _CHESSBOARDCAMERATRACKER_HPP_
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include "Camera.hpp"
#include "utility.hpp"

View File

@ -1,5 +1,32 @@
#ifndef _UTILITY_HPP_
#define _UTILITY_HPP_
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include "Camera.hpp"

View File

@ -1,5 +1,32 @@
#ifndef BASE_HPP
#define BASE_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <vector>
#include <Geometry/Vector.hpp>

View File

@ -1,5 +1,32 @@
#ifndef CIRCLE_HPP
#define CIRCLE_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <vector>
#include <utility>

View File

@ -1,5 +1,32 @@
#ifndef GEOMETRY_HPP
#define GEOMETRY_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include<Base.hpp>

View File

@ -1,5 +1,32 @@
#ifndef MATHFUNCTIONS_HPP
#define MATHFUNCTIONS_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <vector>

View File

@ -1,5 +1,32 @@
#include <limits>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <opencv2/features2d/features2d.hpp>
#include "Geometry/Vector.hpp"

View File

@ -1,5 +1,32 @@
#ifndef MESH_HPP
#define MESH_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <vector>
#include <Geometry/Spline.hpp>

View File

@ -1,5 +1,32 @@
#ifndef POINT_HPP
#define POINT_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <utility>

View File

@ -1,5 +1,32 @@
#ifndef ROTATION_HPP
#define ROTATION_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <GL/gl.h>
#include <Geometry/Vector.hpp>

View File

@ -1,5 +1,32 @@
#ifndef SPLINE_HPP
#define SPLINE_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <vector>
#include <tuple>

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <fstream>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <sstream>
#include <cmath>
#include "Geometry/Vector.hpp"

View File

@ -1,5 +1,32 @@
#ifndef TREE_HPP
#define TREE_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <vector>

View File

@ -1,5 +1,32 @@
#ifndef VECTOR_HPP
#define VECTOR_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <cmath>
#include <array>

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <cmath>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include "Geometry/Vector.hpp"
namespace geo

View File

@ -1,5 +1,32 @@
#ifndef MESHING_HPP
#define MESHING_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////
/// \defgroup meshing Meshing module

View File

@ -1,5 +1,32 @@
#ifndef SKELETON3D_HPP
#define SKELETON3D_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <vector>
#include <list>

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <fstream>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <sstream>
#include <cmath>
#include <list>

View File

@ -1,5 +1,32 @@
#ifndef CAMERA_HPP
#define CAMERA_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
namespace sft
{

View File

@ -1,5 +1,32 @@
#ifndef FREE_FLY_CAMERA_HPP
#define FREE_FLY_CAMERA_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <SFML/System/Vector3.hpp>
#include <SFML/Window/Event.hpp>

View File

@ -1,5 +1,32 @@
#ifndef JOY_CAM_HPP
#define JOY_CAM_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <SFML/System/Vector3.hpp>
#include <SFML/Window/Event.hpp>

View File

@ -1,5 +1,32 @@
#ifndef SFML_TOOLS_HPP
#define SFML_TOOLS_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
/// \defgroup sfmltools SFML Tools

View File

@ -1,5 +1,32 @@
#ifndef VECTOR_FUNCTIONS_HPP
#define VECTOR_FUNCTIONS_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <cmath>
#include <SFML/System/Vector2.hpp>

View File

@ -1,5 +1,32 @@
#ifndef BOX_HPP
#define BOX_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
class Box
{

View File

@ -1,5 +1,32 @@
#ifndef BRANCH_HPP
#define BRANCH_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <vector>

View File

@ -1,5 +1,32 @@
#ifndef SKELETON_HPP
#define SKELETON_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <string>
#include <vector>

View File

@ -1,5 +1,32 @@
#ifndef VECTOR_FUNCTIONS_HPP
#define VECTOR_FUNCTIONS_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <cmath>
#include <SFML/System/Vector3.hpp>

View File

@ -1,5 +1,32 @@
#ifndef TUPLEFUNCTIONS_HPP
#define TUPLEFUNCTIONS_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <sstream>
#include <tuple>

View File

@ -1,5 +1,32 @@
#include <iostream>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include "TupleFunctions.hpp"
namespace pae

View File

@ -1,5 +1,32 @@
#ifndef UTILITY_HPP
#define UTILITY_HPP
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////
/// \defgroup utility Utility module

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <vector>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <memory>
#include <cmath>
#include <SFML/Window.hpp>

View File

@ -1,370 +1,397 @@
#include <GL/glu.h>
#include <Animation/AnimatedMesh.hpp>
#include <Animation/Click.hpp>
namespace pae
{
AnimatedMesh::AnimatedMesh(Skeleton3D<geo::Vector3<float>,float> const& skeleton)
{
auto segments = click(skeleton);
this->segments = segments.first;
auto mesh = skeleton.computeMesh();
associateBranches(segments.first, mesh);
findFaces(associatedSegment, mesh, segments.first.size());
mesh.prepare();
vertices = mesh.vertices;
geo::Tree<geo::Vector3<float>> tree{segments.second};
listToTree(this->segments, tree);
genStructure(this->segments, tree, structure);
genStructure(this->segments, tree, roots);
genRotations(roots, rotations);
genStructuredFaces(facesPerSegment, structure, structuredFaces);
genOtherVertices(vertices, facesPerSegment[facesPerSegment.size()-1], associatedSegment, structure, otherVertices);
genColors(structure, colors);
paths.push_back({});
genPaths(structure, paths);
structure.node = -1;
std::cout << tree << std::endl << "-------------------------" << std::endl;
std::cout << structure << std::endl;
std::cout << "structure size = " << structure.size() << std::endl;
}
geo::Tree<int>& genStructure(std::vector<geo::Segment<float,3>> const& segments, geo::Tree<geo::Vector3<float>> const& tree, geo::Tree<int>& ret)
{
constexpr float eps = 0.0001;
for (auto& child : tree.children)
{
for (unsigned int i = 0; i < segments.size(); i++)
{
// Compare segments[i] and (tree, child)
if ( (((segments[i].first - tree.node).norm2() < eps)
&& ((segments[i].second - child.node).norm2() < eps))
|| (((segments[i].first - child.node).norm2() < eps)
&& ((segments[i].second - tree.node).norm2() < eps)))
{
ret.children.push_back(geo::Tree<int>{static_cast<int>(i)});
genStructure(segments, child, ret.children[ret.children.size()-1]);
}
}
}
return ret;
}
geo::Tree<geo::Vector3<float>>& genStructure(std::vector<geo::Segment<float,3>> const& segments, geo::Tree<geo::Vector3<float>> const& tree, geo::Tree<geo::Vector3<float>>& ret)
{
constexpr float eps = 0.0001;
for (auto& child : tree.children)
{
for (unsigned int i = 0; i < segments.size(); i++)
{
// Compare segments[i] and (tree, child)
if ( (((segments[i].first - tree.node).norm2() < eps)
&& ((segments[i].second - child.node).norm2() < eps))
|| (((segments[i].first - child.node).norm2() < eps)
&& ((segments[i].second - tree.node).norm2() < eps)))
{
ret.children.push_back(geo::Tree<geo::Vector3<float>>{child.node});
genStructure(segments, child, ret.children[ret.children.size()-1]);
}
}
}
return ret;
}
geo::Tree<std::vector<geo::Vector3<unsigned int>>>&
genStructuredFaces(
std::vector<std::vector<geo::Vector3<unsigned int>>> const& facesPerSegment,
geo::Tree<int> const& structure,
geo::Tree<std::vector<geo::Vector3<unsigned int>>>& faces
)
{
// for (auto const& face_group : facesPerSegment)
for (auto child : structure.children)
{
auto tree = geo::Tree<std::vector<geo::Vector3<unsigned int>>>{};
tree.node = facesPerSegment[child.node];
faces.children.push_back(tree);
genStructuredFaces(facesPerSegment, child, faces.children[faces.children.size()-1]);
}
return faces;
}
std::unordered_map<unsigned int, geo::Path>&
genOtherVertices(
std::vector<geo::Vector3<float>> const& vertices,
std::vector<geo::Vector3<unsigned int>> const& otherFaces,
std::vector<unsigned int> associatedSegment,
geo::Tree<int> const& structure,
std::unordered_map<unsigned int, geo::Path>& ret,
geo::Path path
)
{
// for (auto const& child : structure.children)
path.push_back(0);
for (unsigned int i = 0; i < structure.children.size(); i++)
{
path[path.size()-1] = i;
for (auto const& f : otherFaces)
{
if (associatedSegment[f.x()] == static_cast<unsigned int>(structure.children[i].node))
{
ret.insert({f.x(), path});
}
if (associatedSegment[f.y()] == static_cast<unsigned int>(structure.children[i].node))
{
ret.insert({f.y(), path});
}
if (associatedSegment[f.z()] == static_cast<unsigned int>(structure.children[i].node))
{
ret.insert({f.z(), path});
}
}
genOtherVertices(vertices, otherFaces, associatedSegment, structure.children[i], ret, path);
}
return ret;
}
geo::Tree<std::array<float,3>>&
genColors(
geo::Tree<int> const& structure,
geo::Tree<std::array<float,3>>& colors)
{
for (auto const& child : structure.children)
{
geo::Tree<std::array<float,3>> tree;
tree.node = {
static_cast<float>(std::rand())/RAND_MAX,
static_cast<float>(std::rand())/RAND_MAX,
static_cast<float>(std::rand())/RAND_MAX
};
colors.children.push_back(tree);
genColors(child, colors.children[colors.children.size()-1]);
}
return colors;
}
geo::Tree<geo::Rotation>&
genRotations(
geo::Tree<geo::Vector3<float>> const& extremities,
geo::Tree<geo::Rotation>& ret
)
{
for (auto const& child : extremities.children)
{
geo::Rotation r;
r.center = extremities.node;
geo::Tree<geo::Rotation> tree;
tree.node = r;
ret.children.push_back(tree);
genRotations(child, ret.children[ret.children.size()-1]);
}
return ret;
}
std::vector<geo::Path>&
genPaths(
geo::Tree<int> const& structure,
std::vector<geo::Path>& paths,
geo::Path currentPath)
{
currentPath.push_back(0);
// for (auto const& child : structure.children)
for (unsigned int i = 0; i < structure.children.size(); i++)
{
currentPath[currentPath.size()-1] = i;
paths.push_back(currentPath);
genPaths(structure.children[i], paths, currentPath);
}
return paths;
}
void AnimatedMesh::associateBranches(std::vector<geo::Segment<float,3>> const& segments, geo::Mesh& mesh)
{
// stock each point at the index corresponding to the nearest segment
for(unsigned int i=0;i<mesh.vertices.size();i++)
{
geo::Point<float> p = geo::Point<float>{i,mesh.vertices[i]};
associatedSegment.push_back(findNearestSegment(segments, p));
}
}
//finds the nearest segment to a point
unsigned int AnimatedMesh::findNearestSegment(std::vector<geo::Segment<float,3>> const& segments, geo::Point<float> const& p)
{
unsigned int nearestSegment = 0;
float shortest_distance = std::numeric_limits<float>::max();
for(unsigned int i=0;i<segments.size();i++)
{
// find distance between point and segment
float distance = geo::distanceToSegment(p.second, segments[i].first, segments[i].second);
if (shortest_distance > distance)
{
shortest_distance = distance;
nearestSegment = i;
}
}
return nearestSegment;
}
void AnimatedMesh::findFaces(std::vector<unsigned int> const& associatedSegments, geo::Mesh& mesh, unsigned int nbSegments)
{
for (unsigned int i=0;i<nbSegments+1;i++)
{
facesPerSegment.push_back(std::vector<geo::Vector3<unsigned int>>{});
}
unsigned int segment;
for(unsigned int i=0;i<mesh.faces.size();i++)
{
segment = associatedSegments[mesh.faces[i].x()];
if ((segment == associatedSegments[mesh.faces[i].y()]) && (segment == associatedSegments[mesh.faces[i].z()]))
{
facesPerSegment[segment].push_back(mesh.faces[i]);
}
else
{
facesPerSegment[nbSegments].push_back(mesh.faces[i]);
}
}
}
void drawTree(std::vector<geo::Vector3<float>> const& vertices, geo::Tree<std::vector<geo::Vector3<unsigned int>>> const& faces, geo::Tree<std::array<float,3>> const& colors, geo::Tree<geo::Vector3<float>> const& extremities, geo::Tree<geo::Rotation> const& rotations)
{
// for (auto const& child : faces.children)
for (unsigned int i = 0; i < faces.children.size(); i++)
{
// Apply good rotation
glPushMatrix();
rotations.children[i].node();
glBegin(GL_TRIANGLES);
for (auto const& face : faces.children[i].node)
{
glColor3fv(&colors.children[i].node[0]);
glVertex3fv(&vertices[face.x()].data[0]);
glVertex3fv(&vertices[face.y()].data[0]);
glVertex3fv(&vertices[face.z()].data[0]);
}
glEnd();
drawTree(vertices, faces.children[i], colors.children[i], extremities.children[i], rotations.children[i]);
glPopMatrix();
}
}
void drawOthers(std::vector<geo::Vector3<float>> const& vertices, std::unordered_map<unsigned int, geo::Path> const& other_vertices, std::vector<geo::Vector3<unsigned int>> const& faces, geo::Tree<std::array<float,3>> const& colors, geo::Tree<geo::Rotation> const& rotations)
{
// OpenGL is shit, so this will be a bit tricky
// The thing is you can't use glRotatef, or glPush/PopMatrix inside glBegin() ... glEnd()
// but we need to do this since the transformation we have to apply is different for each
// vertex (since the vertices of the face are not mapped to the same segment)
// What we'll do is to call gluProject after applying the rotations, and glUnProject
// after reseting the modelview matrix. This way, each vertex will have the good transform
// and we will be able to draw the face.
for (auto const& f : faces)
{
// To avoid some copies of GL_MODELVIEW_MATRIX, we will first project everything,
// and then unproject everything.
// Ok, let's do the projection
// Some variables needed to store de matrices
GLdouble modelview[16];
GLdouble projection[16];
GLint viewport[4];
// tmp will be the projected vertices, and v will be the unprojected ones
geo::Vector3<double> tmp1,tmp2,tmp3;
geo::Vector3<double> v1,v2,v3;
// First, let's save the state of the projection and viewport matrices
glGetDoublev(GL_PROJECTION_MATRIX, projection);
glGetIntegerv(GL_VIEWPORT, viewport);
// Now Let's project the vertices, after applying the transformation
// Projection of the first vertex
glPushMatrix();
// Apply the transformation to the vertex
rotations.execPath(other_vertices.at(f.x()));
// Get the new modelview matrix
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
// Compute the result of the projection and store it into tmp1
gluProject(vertices[f.x()].x(), vertices[f.x()].y(), vertices[f.x()].z(),
modelview, projection, viewport,
&tmp1.data[0], &tmp1.data[1], &tmp1.data[2]);
glPopMatrix();
// Same for the second
glPushMatrix();
rotations.execPath(other_vertices.at(f.y()));
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
gluProject(vertices[f.y()].x(), vertices[f.y()].y(), vertices[f.y()].z(),
modelview, projection, viewport,
&tmp2.data[0], &tmp2.data[1], &tmp2.data[2]);
glPopMatrix();
// And for the third
glPushMatrix();
rotations.execPath(other_vertices.at(f.z()));
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
gluProject(vertices[f.z()].x(), vertices[f.z()].y(), vertices[f.z()].z(),
modelview, projection, viewport,
&tmp3.data[0], &tmp3.data[1], &tmp3.data[2]);
glPopMatrix();
// Here, tmp1 tmp2 and tmp3 store the projected vertices. We will now
// unproject them with the modelview matrix WITHOUT taking account
// of the vertex-dependant transformation
// We will get back the first modelview matrix WITHOUT transformations
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
// And unproject everything with this modelview matrix
gluUnProject(tmp1.data[0], tmp1.data[1], tmp1.data[2],
modelview, projection, viewport,
&v1.data[0], &v1.data[1], &v1.data[2]);
// Same for v2
gluUnProject(tmp2.data[0], tmp2.data[1], tmp2.data[2],
modelview, projection, viewport,
&v2.data[0], &v2.data[1], &v2.data[2]);
// And for v3
gluUnProject(tmp3.data[0], tmp3.data[1], tmp3.data[2],
modelview, projection, viewport,
&v3.data[0], &v3.data[1], &v3.data[2]);
// Here we are, by doing this "hack", we used opengl to compute the
// result of the transformations on the vertices
// That is to say, v1, v2 and v3 are now the three vertices of the face
// with the transformation done correctly.
// Now, we just have to render the triangle with the classic opengl way
glBegin(GL_TRIANGLES);
glColor3fv(&colors.applyPath(other_vertices.at(f.x())).node[0]);
glVertex3d(v1.data[0], v1.data[1], v1.data[2]);
glColor3fv(&colors.applyPath(other_vertices.at(f.y())).node[0]);
glVertex3d(v2.data[0], v2.data[1], v2.data[2]);
glColor3fv(&colors.applyPath(other_vertices.at(f.z())).node[0]);
glVertex3d(v3.data[0], v3.data[1], v3.data[2]);
glEnd();
}
}
void AnimatedMesh::draw() const
{
drawTree(vertices, structuredFaces, colors, roots, rotations);
drawOthers(vertices, otherVertices, facesPerSegment[facesPerSegment.size()-1], colors, rotations);
}
} // namespace pae
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <Animation/AnimatedMesh.hpp>
#include <Animation/Click.hpp>
namespace pae
{
AnimatedMesh::AnimatedMesh(Skeleton3D<geo::Vector3<float>,float> const& skeleton)
{
auto segments = click(skeleton);
this->segments = segments.first;
auto mesh = skeleton.computeMesh();
associateBranches(segments.first, mesh);
findFaces(associatedSegment, mesh, segments.first.size());
mesh.prepare();
vertices = mesh.vertices;
geo::Tree<geo::Vector3<float>> tree{segments.second};
listToTree(this->segments, tree);
genStructure(this->segments, tree, structure);
genStructure(this->segments, tree, roots);
genRotations(roots, rotations);
genStructuredFaces(facesPerSegment, structure, structuredFaces);
genOtherVertices(vertices, facesPerSegment[facesPerSegment.size()-1], associatedSegment, structure, otherVertices);
genColors(structure, colors);
paths.push_back({});
genPaths(structure, paths);
structure.node = -1;
std::cout << tree << std::endl << "-------------------------" << std::endl;
std::cout << structure << std::endl;
std::cout << "structure size = " << structure.size() << std::endl;
}
geo::Tree<int>& genStructure(std::vector<geo::Segment<float,3>> const& segments, geo::Tree<geo::Vector3<float>> const& tree, geo::Tree<int>& ret)
{
constexpr float eps = 0.0001;
for (auto& child : tree.children)
{
for (unsigned int i = 0; i < segments.size(); i++)
{
// Compare segments[i] and (tree, child)
if ( (((segments[i].first - tree.node).norm2() < eps)
&& ((segments[i].second - child.node).norm2() < eps))
|| (((segments[i].first - child.node).norm2() < eps)
&& ((segments[i].second - tree.node).norm2() < eps)))
{
ret.children.push_back(geo::Tree<int>{static_cast<int>(i)});
genStructure(segments, child, ret.children[ret.children.size()-1]);
}
}
}
return ret;
}
geo::Tree<geo::Vector3<float>>& genStructure(std::vector<geo::Segment<float,3>> const& segments, geo::Tree<geo::Vector3<float>> const& tree, geo::Tree<geo::Vector3<float>>& ret)
{
constexpr float eps = 0.0001;
for (auto& child : tree.children)
{
for (unsigned int i = 0; i < segments.size(); i++)
{
// Compare segments[i] and (tree, child)
if ( (((segments[i].first - tree.node).norm2() < eps)
&& ((segments[i].second - child.node).norm2() < eps))
|| (((segments[i].first - child.node).norm2() < eps)
&& ((segments[i].second - tree.node).norm2() < eps)))
{
ret.children.push_back(geo::Tree<geo::Vector3<float>>{child.node});
genStructure(segments, child, ret.children[ret.children.size()-1]);
}
}
}
return ret;
}
geo::Tree<std::vector<geo::Vector3<unsigned int>>>&
genStructuredFaces(
std::vector<std::vector<geo::Vector3<unsigned int>>> const& facesPerSegment,
geo::Tree<int> const& structure,
geo::Tree<std::vector<geo::Vector3<unsigned int>>>& faces
)
{
// for (auto const& face_group : facesPerSegment)
for (auto child : structure.children)
{
auto tree = geo::Tree<std::vector<geo::Vector3<unsigned int>>>{};
tree.node = facesPerSegment[child.node];
faces.children.push_back(tree);
genStructuredFaces(facesPerSegment, child, faces.children[faces.children.size()-1]);
}
return faces;
}
std::unordered_map<unsigned int, geo::Path>&
genOtherVertices(
std::vector<geo::Vector3<float>> const& vertices,
std::vector<geo::Vector3<unsigned int>> const& otherFaces,
std::vector<unsigned int> associatedSegment,
geo::Tree<int> const& structure,
std::unordered_map<unsigned int, geo::Path>& ret,
geo::Path path
)
{
// for (auto const& child : structure.children)
path.push_back(0);
for (unsigned int i = 0; i < structure.children.size(); i++)
{
path[path.size()-1] = i;
for (auto const& f : otherFaces)
{
if (associatedSegment[f.x()] == static_cast<unsigned int>(structure.children[i].node))
{
ret.insert({f.x(), path});
}
if (associatedSegment[f.y()] == static_cast<unsigned int>(structure.children[i].node))
{
ret.insert({f.y(), path});
}
if (associatedSegment[f.z()] == static_cast<unsigned int>(structure.children[i].node))
{
ret.insert({f.z(), path});
}
}
genOtherVertices(vertices, otherFaces, associatedSegment, structure.children[i], ret, path);
}
return ret;
}
geo::Tree<std::array<float,3>>&
genColors(
geo::Tree<int> const& structure,
geo::Tree<std::array<float,3>>& colors)
{
for (auto const& child : structure.children)
{
geo::Tree<std::array<float,3>> tree;
tree.node = {
static_cast<float>(std::rand())/RAND_MAX,
static_cast<float>(std::rand())/RAND_MAX,
static_cast<float>(std::rand())/RAND_MAX
};
colors.children.push_back(tree);
genColors(child, colors.children[colors.children.size()-1]);
}
return colors;
}
geo::Tree<geo::Rotation>&
genRotations(
geo::Tree<geo::Vector3<float>> const& extremities,
geo::Tree<geo::Rotation>& ret
)
{
for (auto const& child : extremities.children)
{
geo::Rotation r;
r.center = extremities.node;
geo::Tree<geo::Rotation> tree;
tree.node = r;
ret.children.push_back(tree);
genRotations(child, ret.children[ret.children.size()-1]);
}
return ret;
}
std::vector<geo::Path>&
genPaths(
geo::Tree<int> const& structure,
std::vector<geo::Path>& paths,
geo::Path currentPath)
{
currentPath.push_back(0);
// for (auto const& child : structure.children)
for (unsigned int i = 0; i < structure.children.size(); i++)
{
currentPath[currentPath.size()-1] = i;
paths.push_back(currentPath);
genPaths(structure.children[i], paths, currentPath);
}
return paths;
}
void AnimatedMesh::associateBranches(std::vector<geo::Segment<float,3>> const& segments, geo::Mesh& mesh)
{
// stock each point at the index corresponding to the nearest segment
for(unsigned int i=0;i<mesh.vertices.size();i++)
{
geo::Point<float> p = geo::Point<float>{i,mesh.vertices[i]};
associatedSegment.push_back(findNearestSegment(segments, p));
}
}
//finds the nearest segment to a point
unsigned int AnimatedMesh::findNearestSegment(std::vector<geo::Segment<float,3>> const& segments, geo::Point<float> const& p)
{
unsigned int nearestSegment = 0;
float shortest_distance = std::numeric_limits<float>::max();
for(unsigned int i=0;i<segments.size();i++)
{
// find distance between point and segment
float distance = geo::distanceToSegment(p.second, segments[i].first, segments[i].second);
if (shortest_distance > distance)
{
shortest_distance = distance;
nearestSegment = i;
}
}
return nearestSegment;
}
void AnimatedMesh::findFaces(std::vector<unsigned int> const& associatedSegments, geo::Mesh& mesh, unsigned int nbSegments)
{
for (unsigned int i=0;i<nbSegments+1;i++)
{
facesPerSegment.push_back(std::vector<geo::Vector3<unsigned int>>{});
}
unsigned int segment;
for(unsigned int i=0;i<mesh.faces.size();i++)
{
segment = associatedSegments[mesh.faces[i].x()];
if ((segment == associatedSegments[mesh.faces[i].y()]) && (segment == associatedSegments[mesh.faces[i].z()]))
{
facesPerSegment[segment].push_back(mesh.faces[i]);
}
else
{
facesPerSegment[nbSegments].push_back(mesh.faces[i]);
}
}
}
void drawTree(std::vector<geo::Vector3<float>> const& vertices, geo::Tree<std::vector<geo::Vector3<unsigned int>>> const& faces, geo::Tree<std::array<float,3>> const& colors, geo::Tree<geo::Vector3<float>> const& extremities, geo::Tree<geo::Rotation> const& rotations)
{
// for (auto const& child : faces.children)
for (unsigned int i = 0; i < faces.children.size(); i++)
{
// Apply good rotation
glPushMatrix();
rotations.children[i].node();
glBegin(GL_TRIANGLES);
for (auto const& face : faces.children[i].node)
{
glColor3fv(&colors.children[i].node[0]);
glVertex3fv(&vertices[face.x()].data[0]);
glVertex3fv(&vertices[face.y()].data[0]);
glVertex3fv(&vertices[face.z()].data[0]);
}
glEnd();
drawTree(vertices, faces.children[i], colors.children[i], extremities.children[i], rotations.children[i]);
glPopMatrix();
}
}
void drawOthers(std::vector<geo::Vector3<float>> const& vertices, std::unordered_map<unsigned int, geo::Path> const& other_vertices, std::vector<geo::Vector3<unsigned int>> const& faces, geo::Tree<std::array<float,3>> const& colors, geo::Tree<geo::Rotation> const& rotations)
{
// OpenGL is shit, so this will be a bit tricky
// The thing is you can't use glRotatef, or glPush/PopMatrix inside glBegin() ... glEnd()
// but we need to do this since the transformation we have to apply is different for each
// vertex (since the vertices of the face are not mapped to the same segment)
// What we'll do is to call gluProject after applying the rotations, and glUnProject
// after reseting the modelview matrix. This way, each vertex will have the good transform
// and we will be able to draw the face.
for (auto const& f : faces)
{
// To avoid some copies of GL_MODELVIEW_MATRIX, we will first project everything,
// and then unproject everything.
// Ok, let's do the projection
// Some variables needed to store de matrices
GLdouble modelview[16];
GLdouble projection[16];
GLint viewport[4];
// tmp will be the projected vertices, and v will be the unprojected ones
geo::Vector3<double> tmp1,tmp2,tmp3;
geo::Vector3<double> v1,v2,v3;
// First, let's save the state of the projection and viewport matrices
glGetDoublev(GL_PROJECTION_MATRIX, projection);
glGetIntegerv(GL_VIEWPORT, viewport);
// Now Let's project the vertices, after applying the transformation
// Projection of the first vertex
glPushMatrix();
// Apply the transformation to the vertex
rotations.execPath(other_vertices.at(f.x()));
// Get the new modelview matrix
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
// Compute the result of the projection and store it into tmp1
gluProject(vertices[f.x()].x(), vertices[f.x()].y(), vertices[f.x()].z(),
modelview, projection, viewport,
&tmp1.data[0], &tmp1.data[1], &tmp1.data[2]);
glPopMatrix();
// Same for the second
glPushMatrix();
rotations.execPath(other_vertices.at(f.y()));
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
gluProject(vertices[f.y()].x(), vertices[f.y()].y(), vertices[f.y()].z(),
modelview, projection, viewport,
&tmp2.data[0], &tmp2.data[1], &tmp2.data[2]);
glPopMatrix();
// And for the third
glPushMatrix();
rotations.execPath(other_vertices.at(f.z()));
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
gluProject(vertices[f.z()].x(), vertices[f.z()].y(), vertices[f.z()].z(),
modelview, projection, viewport,
&tmp3.data[0], &tmp3.data[1], &tmp3.data[2]);
glPopMatrix();
// Here, tmp1 tmp2 and tmp3 store the projected vertices. We will now
// unproject them with the modelview matrix WITHOUT taking account
// of the vertex-dependant transformation
// We will get back the first modelview matrix WITHOUT transformations
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
// And unproject everything with this modelview matrix
gluUnProject(tmp1.data[0], tmp1.data[1], tmp1.data[2],
modelview, projection, viewport,
&v1.data[0], &v1.data[1], &v1.data[2]);
// Same for v2
gluUnProject(tmp2.data[0], tmp2.data[1], tmp2.data[2],
modelview, projection, viewport,
&v2.data[0], &v2.data[1], &v2.data[2]);
// And for v3
gluUnProject(tmp3.data[0], tmp3.data[1], tmp3.data[2],
modelview, projection, viewport,
&v3.data[0], &v3.data[1], &v3.data[2]);
// Here we are, by doing this "hack", we used opengl to compute the
// result of the transformations on the vertices
// That is to say, v1, v2 and v3 are now the three vertices of the face
// with the transformation done correctly.
// Now, we just have to render the triangle with the classic opengl way
glBegin(GL_TRIANGLES);
glColor3fv(&colors.applyPath(other_vertices.at(f.x())).node[0]);
glVertex3d(v1.data[0], v1.data[1], v1.data[2]);
glColor3fv(&colors.applyPath(other_vertices.at(f.y())).node[0]);
glVertex3d(v2.data[0], v2.data[1], v2.data[2]);
glColor3fv(&colors.applyPath(other_vertices.at(f.z())).node[0]);
glVertex3d(v3.data[0], v3.data[1], v3.data[2]);
glEnd();
}
}
void AnimatedMesh::draw() const
{
drawTree(vertices, structuredFaces, colors, roots, rotations);
drawOthers(vertices, otherVertices, facesPerSegment[facesPerSegment.size()-1], colors, rotations);
}
} // namespace pae

View File

@ -1,5 +1,32 @@
#include <Animation/Click.hpp>
#include <SFML/Window.hpp>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFMLTools/VectorFunctions.hpp>

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <Animation/Click.hpp>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <Meshing/Skeleton3D.hpp>
int main(int argc, char** argv)

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <cmath>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <boost/lexical_cast.hpp>
#include <Animation/Menu.hpp>

View File

@ -2,7 +2,6 @@ add_subdirectory(Calibration)
add_subdirectory(DetectionAndMatching)
add_subdirectory(Extern)
add_subdirectory(HelloCV)
add_subdirectory(Segmentation)
add_subdirectory(Skeleton)
add_subdirectory(Meshing)
add_subdirectory(Animation)

View File

@ -1,9 +1,38 @@
// 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
////////////////////////////////////////////////////////////////////////////////
// This file was forked from OpenCV and the original file is under BSD license
// Check https://github.com/Itseez/opencv/blob/master/LICENSE for the license
// This file was modified by us.
////////////////////////////////////////////////////////////////////////////////
#include "opencv2/core/core.hpp"
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/highgui/highgui.hpp"

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <cmath>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <tuple>
#include <algorithm>

View File

@ -1,5 +1,33 @@
#include "Extern/Camera.hpp"
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
// Simone GASPARINI
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
/**

View File

@ -1,5 +1,33 @@
#include "Extern/ChessboardCameraTracker.hpp"
#include "Extern/utility.hpp"
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
// Simone GASPARINI
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/calib3d/calib3d.hpp>

View File

@ -1,5 +1,33 @@
#include "Extern/ChessboardCameraTracker.hpp"
#include "Extern/utility.hpp"
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
// Simone GASPARINI
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>

View File

@ -1,5 +1,33 @@
#include "Extern/utility.hpp"
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
// Simone GASPARINI
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/imgproc/imgproc.hpp>

View File

@ -1,5 +1,32 @@
#include <cmath>
#include <iostream>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <Geometry/Base.hpp>

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <fstream>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <sstream>
#include <GL/gl.h>

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <vector>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <Geometry/Vector.hpp>
#include <Geometry/MathFunctions.hpp>

View File

@ -1,5 +1,32 @@
#include <Geometry/Rotation.hpp>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
namespace geo
{

View File

@ -1,5 +1,32 @@
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#ifdef _WIN32
#define CV_ESCAPE 27

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <vector>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <memory>
#include <cmath>
#include <SFML/Window.hpp>

View File

@ -1,5 +1,32 @@
auto c1 = geo::Circle<float>{};
c1.center = geo::Vector3<float>{2.0000f, 0.0000f, 0.0000f};
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
c1.points.push_back(std::make_pair(0, geo::Vector3<float>{2.0000f, 0.0000f, 1.0000f}));
c1.points.push_back(std::make_pair(1, geo::Vector3<float>{2.0000f, 0.5878f, 0.8090f}));
c1.points.push_back(std::make_pair(2, geo::Vector3<float>{2.0000f, 0.9511f, 0.3090f}));

View File

@ -1,5 +1,32 @@
auto c1 = geo::Circle<float>{};
c1.center = geo::Vector3<float>{2.0000f, 0.0000f, 0.0000f};
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
c1.points.push_back(std::make_pair(0, geo::Vector3<float>{2.0000f, 0.0000f, 1.0000f}));
c1.points.push_back(std::make_pair(1, geo::Vector3<float>{2.0000f, 0.5878f, 0.8090f}));
c1.points.push_back(std::make_pair(2, geo::Vector3<float>{2.0000f, 0.9511f, 0.3090f}));

View File

@ -1,5 +1,32 @@
auto c1 = geo::Circle<float>{};
c1.center = geo::Vector3<float>{2.0000f, 0.0000f, 0.0000f};
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
c1.points.push_back(std::make_pair(0, geo::Vector3<float>{2.0000f, 0.0000f, 1.0000f}));
c1.points.push_back(std::make_pair(1, geo::Vector3<float>{2.0000f, 0.5878f, 0.8090f}));
c1.points.push_back(std::make_pair(2, geo::Vector3<float>{2.0000f, 0.9511f, 0.3090f}));

View File

@ -1,5 +1,32 @@
auto c1 = geo::Circle<float>{};
c1.center = geo::Vector3<float>{2.0000f, 0.0000f, 0.0000f};
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
c1.points.push_back(std::make_pair(0, geo::Vector3<float>{2.0000f, 0.0000f, 1.0000f}));
c1.points.push_back(std::make_pair(1, geo::Vector3<float>{2.0000f, 0.5878f, 0.8090f}));
c1.points.push_back(std::make_pair(2, geo::Vector3<float>{2.0000f, 0.9511f, 0.3090f}));

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <vector>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <memory>
#include <cmath>
#include <SFML/Window.hpp>

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <vector>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <memory>
#include <cmath>
#include <SFML/Window.hpp>

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <vector>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <memory>
#include <cmath>
#include <SFML/Window.hpp>

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <string>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include "Geometry/Vector.hpp"
#include "Geometry/Spline.hpp"

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <cmath>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <GL/glu.h>
#include <boost/algorithm/clamp.hpp>

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <cmath>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <GL/glu.h>
#include <boost/algorithm/clamp.hpp>

View File

@ -1,3 +0,0 @@
add_executable(Segmentation grabcut.cpp)
target_link_libraries(Segmentation ${OpenCV_LIBS})

View File

@ -1,341 +0,0 @@
// #include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
using namespace std;
using namespace cv;
static void help()
{
cout << "\nThis program demonstrates GrabCut segmentation -- select an object in a region\n"
"and then grabcut will attempt to segment it out.\n"
"Call:\n"
"./grabcut <image_name>\n"
"\nSelect a rectangular area around the object you want to segment\n" <<
"\nHot keys: \n"
"\tESC - quit the program\n"
"\tr - restore the original image\n"
"\tn - next iteration\n"
"\n"
"\tleft mouse button - set rectangle\n"
"\n"
"\tCTRL+left mouse button - set GC_BGD pixels\n"
"\tSHIFT+left mouse button - set GC_FGD pixels\n"
"\n"
"\tCTRL+right mouse button - set GC_PR_BGD pixels\n"
"\tSHIFT+right mouse button - set GC_PR_FGD pixels\n" << endl;
}
const Scalar RED = Scalar(0,0,255);
const Scalar PINK = Scalar(230,130,255);
const Scalar BLUE = Scalar(255,0,0);
const Scalar LIGHTBLUE = Scalar(255,255,160);
const Scalar GREEN = Scalar(0,255,0);
const int BGD_KEY = EVENT_FLAG_CTRLKEY;
const int FGD_KEY = EVENT_FLAG_SHIFTKEY;
static void getBinMask( const Mat& comMask, Mat& binMask )
{
// if( comMask.empty() || comMask.type()!=CV_8UC1 )
// CV_Error( Error::StsBadArg, "comMask is empty or has incorrect type (not CV_8UC1)" );
if( binMask.empty() || binMask.rows!=comMask.rows || binMask.cols!=comMask.cols )
binMask.create( comMask.size(), CV_8UC1 );
binMask = comMask & 1;
}
class GCApplication
{
public:
enum{ NOT_SET = 0, IN_PROCESS = 1, SET = 2 };
static const int radius = 2;
static const int thickness = -1;
void reset();
void setImageAndWinName( const Mat& _image, const string& _winName );
void showImage() const;
void mouseClick( int event, int x, int y, int flags, void* param );
int nextIter();
int getIterCount() const { return iterCount; }
string filename;
private:
void setRectInMask();
void setLblsInMask( int flags, Point p, bool isPr );
const string* winName;
const Mat* image;
Mat mask;
Mat bgdModel, fgdModel;
uchar rectState, lblsState, prLblsState;
bool isInitialized;
Rect rect;
vector<Point> fgdPxls, bgdPxls, prFgdPxls, prBgdPxls;
int iterCount;
};
void GCApplication::reset()
{
if( !mask.empty() )
mask.setTo(Scalar::all(GC_BGD));
bgdPxls.clear(); fgdPxls.clear();
prBgdPxls.clear(); prFgdPxls.clear();
isInitialized = false;
rectState = NOT_SET;
lblsState = NOT_SET;
prLblsState = NOT_SET;
iterCount = 0;
}
void GCApplication::setImageAndWinName( const Mat& _image, const string& _winName )
{
if( _image.empty() || _winName.empty() )
return;
image = &_image;
winName = &_winName;
mask.create( image->size(), CV_8UC1);
reset();
}
void GCApplication::showImage() const
{
if( image->empty() || winName->empty() )
return;
Mat res;
Mat binMask;
if( !isInitialized )
image->copyTo( res );
else
{
getBinMask( mask, binMask );
image->copyTo( res, binMask );
imshow("BIN", binMask*255);
imwrite(filename.substr(0,filename.size()-4) + ".bin.png", binMask*255);
}
vector<Point>::const_iterator it;
for( it = bgdPxls.begin(); it != bgdPxls.end(); ++it )
circle( res, *it, radius, BLUE, thickness );
for( it = fgdPxls.begin(); it != fgdPxls.end(); ++it )
circle( res, *it, radius, RED, thickness );
for( it = prBgdPxls.begin(); it != prBgdPxls.end(); ++it )
circle( res, *it, radius, LIGHTBLUE, thickness );
for( it = prFgdPxls.begin(); it != prFgdPxls.end(); ++it )
circle( res, *it, radius, PINK, thickness );
if( rectState == IN_PROCESS || rectState == SET )
rectangle( res, Point( rect.x, rect.y ), Point(rect.x + rect.width, rect.y + rect.height ), GREEN, 2);
imshow( *winName, res );
}
void GCApplication::setRectInMask()
{
CV_Assert( !mask.empty() );
mask.setTo( GC_BGD );
rect.x = max(0, rect.x);
rect.y = max(0, rect.y);
rect.width = min(rect.width, image->cols-rect.x);
rect.height = min(rect.height, image->rows-rect.y);
(mask(rect)).setTo( Scalar(GC_PR_FGD) );
}
void GCApplication::setLblsInMask( int flags, Point p, bool isPr )
{
vector<Point> *bpxls, *fpxls;
uchar bvalue, fvalue;
if( !isPr )
{
bpxls = &bgdPxls;
fpxls = &fgdPxls;
bvalue = GC_BGD;
fvalue = GC_FGD;
}
else
{
bpxls = &prBgdPxls;
fpxls = &prFgdPxls;
bvalue = GC_PR_BGD;
fvalue = GC_PR_FGD;
}
if( flags & BGD_KEY )
{
bpxls->push_back(p);
circle( mask, p, radius, bvalue, thickness );
}
if( flags & FGD_KEY )
{
fpxls->push_back(p);
circle( mask, p, radius, fvalue, thickness );
}
}
void GCApplication::mouseClick( int event, int x, int y, int flags, void* )
{
// TODO add bad args check
switch( event )
{
case EVENT_LBUTTONDOWN: // set rect or GC_BGD(GC_FGD) labels
{
bool isb = (flags & BGD_KEY) != 0,
isf = (flags & FGD_KEY) != 0;
if( rectState == NOT_SET && !isb && !isf )
{
rectState = IN_PROCESS;
rect = Rect( x, y, 1, 1 );
}
if ( (isb || isf) && rectState == SET )
lblsState = IN_PROCESS;
}
break;
case EVENT_RBUTTONDOWN: // set GC_PR_BGD(GC_PR_FGD) labels
{
bool isb = (flags & BGD_KEY) != 0,
isf = (flags & FGD_KEY) != 0;
if ( (isb || isf) && rectState == SET )
prLblsState = IN_PROCESS;
}
break;
case EVENT_LBUTTONUP:
if( rectState == IN_PROCESS )
{
rect = Rect( Point(rect.x, rect.y), Point(x,y) );
rectState = SET;
setRectInMask();
CV_Assert( bgdPxls.empty() && fgdPxls.empty() && prBgdPxls.empty() && prFgdPxls.empty() );
showImage();
}
if( lblsState == IN_PROCESS )
{
setLblsInMask(flags, Point(x,y), false);
lblsState = SET;
showImage();
}
break;
case EVENT_RBUTTONUP:
if( prLblsState == IN_PROCESS )
{
setLblsInMask(flags, Point(x,y), true);
prLblsState = SET;
showImage();
}
break;
case EVENT_MOUSEMOVE:
if( rectState == IN_PROCESS )
{
rect = Rect( Point(rect.x, rect.y), Point(x,y) );
CV_Assert( bgdPxls.empty() && fgdPxls.empty() && prBgdPxls.empty() && prFgdPxls.empty() );
showImage();
}
else if( lblsState == IN_PROCESS )
{
setLblsInMask(flags, Point(x,y), false);
showImage();
}
else if( prLblsState == IN_PROCESS )
{
setLblsInMask(flags, Point(x,y), true);
showImage();
}
break;
}
}
int GCApplication::nextIter()
{
if( isInitialized )
grabCut( *image, mask, rect, bgdModel, fgdModel, 1 );
else
{
if( rectState != SET )
return iterCount;
if( lblsState == SET || prLblsState == SET )
grabCut( *image, mask, rect, bgdModel, fgdModel, 1, GC_INIT_WITH_MASK );
else
grabCut( *image, mask, rect, bgdModel, fgdModel, 1, GC_INIT_WITH_RECT );
isInitialized = true;
}
iterCount++;
bgdPxls.clear(); fgdPxls.clear();
prBgdPxls.clear(); prFgdPxls.clear();
return iterCount;
}
GCApplication gcapp;
static void on_mouse( int event, int x, int y, int flags, void* param )
{
gcapp.mouseClick( event, x, y, flags, param );
}
int main( int argc, char** argv )
{
if( argc!=2 )
{
help();
return 1;
}
string filename = argv[1];
if( filename.empty() )
{
cout << "\nDurn, couldn't read in " << argv[1] << endl;
return 1;
}
Mat image = imread( filename, 1 );
if( image.empty() )
{
cout << "\n Durn, couldn't read image filename " << filename << endl;
return 1;
}
help();
const string winName = "image";
namedWindow( winName, WINDOW_AUTOSIZE );
setMouseCallback( winName, on_mouse, 0 );
gcapp.setImageAndWinName( image, winName );
gcapp.showImage();
gcapp.filename = filename;
for(;;)
{
int c = waitKey(0);
switch( (char) c )
{
case '\x1b':
cout << "Exiting ..." << endl;
goto exit_main;
case 'r':
cout << endl;
gcapp.reset();
gcapp.showImage();
break;
case 'n':
int iterCount = gcapp.getIterCount();
cout << "<" << iterCount << "... ";
int newIterCount = gcapp.nextIter();
if( newIterCount > iterCount )
{
gcapp.showImage();
cout << iterCount << ">" << endl;
}
else
cout << "rect must be determined>" << endl;
break;
}
}
exit_main:
destroyWindow( winName );
return 0;
}

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <fstream>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <Skeleton/Box.hpp>
Box::Box() : m_x_min{}, m_x_max{}, m_y_min{}, m_y_max{}

View File

@ -1,5 +1,32 @@
#include "Skeleton/Branch.hpp"
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
bool Branch::operator==(Branch const& other)
{
if (size() == 2 && other.size() == 2)

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <fstream>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <valarray>
#include <GL/gl.h>

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <vector>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <memory>
#include <cmath>
#include <SFML/Window.hpp>

View File

@ -1,5 +1,32 @@
std::vector<std::pair<cv::KeyPoint,cv::KeyPoint>> keypoints1 = {
// Pairs of keypoints supposed to be matched with branche[0]
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
{cv::KeyPoint{cv::Point{100,400},0}, cv::KeyPoint{cv::Point{400,400},0}},
{cv::KeyPoint{cv::Point{200,200},0}, cv::KeyPoint{cv::Point{400,300},0}},
{cv::KeyPoint{cv::Point{400,400},0}, cv::KeyPoint{cv::Point{500,300},0}},

View File

@ -1,5 +1,32 @@
#include <iostream>
#include <fstream>
////////////////////////////////////////////////////////////////////////////////
//
// Paella
// Copyright (C) 2015 - Thomas FORGIONE, Emilie JALRAS, Marion LENFANT, Thierry MALON, Amandine PAILLOUX
// Authors :
// Thomas FORGIONE
// Emilie JALRAS
// Marion LENFANT
// Thierry MALON
// Amandine PAILLOUX
//
// This file is part of the project Paella
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
////////////////////////////////////////////////////////////////////////////////
#include <vector>
#include <memory>
#include <boost/program_options.hpp>