Skip to content

Commit

Permalink
Merge branch 'tuto_pf_like_ukf' of github.com:rolalaro/visp into tuto…
Browse files Browse the repository at this point in the history
…_pf_like_ukf
  • Loading branch information
LAGNEAU Romain committed Sep 11, 2024
2 parents d225943 + 5e98ed7 commit 3d01549
Show file tree
Hide file tree
Showing 37 changed files with 126 additions and 211 deletions.
6 changes: 6 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ ViSP 3.x.x (Version in development)
https://visp-doc.inria.fr/doxygen/visp-daily/tutorial-hsv-segmentation-pcl.html
. New tutorial: Rendering a 3D scene with Panda3D
https://visp-doc.inria.fr/doxygen/visp-daily/tutorial-panda3d.html
. New tutorial: Using Unscented Kalman Filter to filter your data
https://visp-doc.inria.fr/doxygen/visp-daily/tutorial-ukf.html
. New tutorial: Using Particle Filter to filter your data
https://visp-doc.inria.fr/doxygen/visp-daily/tutorial-pf.html
. New tutorial: Using Particle Filter to model a wire using polynomial interpolation
https://visp-doc.inria.fr/doxygen/visp-daily/tutorial-pf-curve-fitting.html
- Bug fixed
. [#1251] Bug in vpDisplay::displayFrame()
. [#1270] Build issue around std::clamp and optional header which are not found with cxx17
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorial/misc/tutorial-pf-curve-fitting.dox
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
\page tutorial-pf-curve-fitting Tutorial: Using Particle Filter to model a wire using polynomial interpolation.
\page tutorial-pf-curve-fitting Tutorial: Using Particle Filter to model a wire using polynomial interpolation
\tableofcontents

\section tuto-pf-cf-intro Introduction

We suppose that you are already familiar with the \ref tutorial-pf .
We suppose that you are already familiar with the \ref tutorial-pf.

The Particle Filters (PF) are a set of Monte Carlo algorithms that
permit to approximate solutions for filtering problems even when
Expand Down
6 changes: 3 additions & 3 deletions doc/tutorial/misc/tutorial-pf.dox
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

\section tuto-pf-intro Introduction

We suppose that you are already familiar with the \ref tutorial-ukf .
We suppose that you are already familiar with the \ref tutorial-ukf.

The Particle Filters (PF) are a set of Monte Carlo algorithms that
permit to approximate solutions for filtering problems even when
the state-space and/or measurement space are non-linear.

In this tutorial, we will use a PF on the same use-case than presented in \ref tutorial-ukf . The PF is used to
In this tutorial, we will use a PF on the same use-case than presented in \ref tutorial-ukf. The PF is used to
filter the 3D position of a simulated object, which revolves in a plane parallel
to the ground around a static point, which is the origin of the world frame \f$ {F}_W \f$. The coordinate frame
attached to the object is denoted \f$ {F}_O \f$. The object is observed by a static camera whose coordinate
Expand Down Expand Up @@ -426,5 +426,5 @@ Finally, we update the renderer that displays the projection in the image of the
The program stops once the `Return` key is pressed.

\section tuto-pf_next Next tutorial
You are now ready to see the next \ref tutorial-pf-curve-fitting .
You are now ready to see the next \ref tutorial-pf-curve-fitting.
*/
8 changes: 1 addition & 7 deletions doc/tutorial/misc/tutorial-ukf.dox
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,9 @@ Finally, we update the renderer that displays the projection in the image of the

\snippet tutorial-ukf.cpp Update_renderer

\subsubsection tuto-ukf-tutorial-explained-cleaning Details on the cleaning at the end of the program

Finally, we clean the allocated memory for the renderer:

\snippet tutorial-ukf.cpp Delete_renderer

The program stops once the `Return` key is pressed.

\section tuto-ukf_next Next tutorial
You are now ready to see the next \ref tutorial-pf .
You are now ready to see the next \ref tutorial-pf.

*/
5 changes: 3 additions & 2 deletions modules/core/include/visp3/core/vpCannyEdgeDetection.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class VISP_EXPORT vpCannyEdgeDetection
* upper threshold.
* \param[in] filteringType : The filtering and gradient operators to apply to the image before the edge detection
* operation.
* \param[in] storeEdgePoints : If true, the list of edge-points will be available using \b vpCannyEdgeDetection::getEdgePointsList .
* \param[in] storeEdgePoints : If true, the list of edge-points will be available using
* \b vpCannyEdgeDetection::getEdgePointsList().
*/
vpCannyEdgeDetection(const int &gaussianKernelSize, const float &gaussianStdev, const unsigned int &sobelAperture,
const float &lowerThreshold = -1.f, const float &upperThreshold = -1.f,
Expand Down Expand Up @@ -261,7 +262,7 @@ class VISP_EXPORT vpCannyEdgeDetection

/**
* \brief If set to true, the list of the detected edge-points will be available
* calling the method \b vpCannyEdgeDetection::getEdgePointsList .
* calling the method \b vpCannyEdgeDetection::getEdgePointsList().
*
* \param[in] storeEdgePoints The new desired status.
*/
Expand Down
13 changes: 7 additions & 6 deletions modules/core/include/visp3/core/vpUniRand.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,13 @@ class VISP_EXPORT vpUniRand
void setSeed(uint64_t initstate, uint64_t initseq);

/**
* @brief Create a new vector that is a shuffled version of the \b inputVector.
*
* @tparam T : A class that possesses a copy constructor.
* @param inputVector : The input vector that must be shuffled. It will not be modified.
* @return std::vector<T> A vector containing the same objects than \b inputVector, but that are shuffled.
*/
* @brief Create a new vector that is a shuffled version of the \b inputVector.
*
* @tparam T : A class that possesses a copy constructor.
* @param inputVector : The input vector that must be shuffled. It will not be modified.
* @param seed : The seed value.
* @return std::vector<T> A vector containing the same objects than \b inputVector, but that are shuffled.
*/
template<typename T>
inline static std::vector<T> shuffleVector(const std::vector<T> &inputVector, const int32_t &seed = -1)
{
Expand Down
14 changes: 7 additions & 7 deletions modules/core/test/math/testParticleFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ class vpParabolaModel
* \brief Compute the coefficients of the 2nd degree curve for the simulated data.
* The polynomial is written as y = a x^2 + b x + c.
*
* \param[in] x0 Horizontal coordinate of the inflexion point.
* \param[in] y0 Vertical coordinate of the inflexion point.
* \param[in] x0 Horizontal coordinate of the inflection point.
* \param[in] y0 Vertical coordinate of the inflection point.
* \param[in] x1 Horizontal coordinate of another point of the curve.
* \param[in] y1 Vertical coordinate of another point of the curve.
* \return vpColVector The coefficients such as v[0] = c ; v[1] = b ; v[2] = a
Expand All @@ -233,8 +233,8 @@ vpColVector computeABC(const double &x0, const double &y0, const double &x1, con
* \brief Compute the coefficients of the 2nd degree curve for the simulated data.
* The polynomial is written as y = a x^3 + b x^2 + c x + d.
*
* \param[in] x0 Horizontal coordinate of the inflexion point.
* \param[in] y0 Vertical coordinate of the inflexion point.
* \param[in] x0 Horizontal coordinate of the inflection point.
* \param[in] y0 Vertical coordinate of the inflection point.
* \param[in] x1 Horizontal coordinate of another point of the curve.
* \param[in] y1 Vertical coordinate of another point of the curve.
* \return vpColVector The coefficients such as v[0] = d ; v[1] = c ; v[2] = b ; v[3] = a
Expand Down Expand Up @@ -478,7 +478,7 @@ TEST_CASE("2nd-degree", "[vpParticleFilter][Polynomial interpolation]")
/// ----- PF parameters -----
// The maximum amplitude for the likelihood compute.
// A particle whose "distance" with the measurements is greater than this value has a likelihood of 0
const double ampliMaxLikelihood = 15.;
const double ampliMaxLikelihood = 16.;
const double sigmaLikelihood = ampliMaxLikelihood / 3.; //:< The corresponding standard deviation
const unsigned int nbParticles = 300; //!< Number of particles used by the particle filter
const double ratioAmpliMax(0.25); //!< Ratio of the initial guess values to use to add noise to the PF state
Expand Down Expand Up @@ -565,7 +565,7 @@ TEST_CASE("2nd-degree", "[vpParticleFilter][Polynomial interpolation]")

SECTION("Noisy", "Noise is added to the init points")
{
const double maxToleratedError = 10.;
const double maxToleratedError = 12.;
double x0 = rngCurvePoints.uniform(0., width);
double x1 = rngCurvePoints.uniform(0., width);
double y0 = rngCurvePoints.uniform(0., height);
Expand Down Expand Up @@ -752,7 +752,7 @@ TEST_CASE("3rd-degree", "[vpParticleFilter][Polynomial interpolation]")

SECTION("Noisy", "Noise is added to the init points")
{
const double maxToleratedError = 15.;
const double maxToleratedError = 16.;
double x0 = rngCurvePoints.uniform(0., width);
double x1 = rngCurvePoints.uniform(0., width);
double y0 = rngCurvePoints.uniform(0., height);
Expand Down
6 changes: 3 additions & 3 deletions modules/gui/include/visp3/gui/vpDisplayFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ struct GridSettings
};

inline void makeDisplayGridHelper(std::vector<std::shared_ptr<vpDisplay>> &res, const GridSettings &settings,
unsigned int currRow, unsigned int currCol,
unsigned int currentPixelX, unsigned int currentPixelY,
unsigned int maxRowHeightPixel)
unsigned int currRow, unsigned int currCol,
unsigned int currentPixelX, unsigned int currentPixelY,
unsigned int maxRowHeightPixel)
{
if (currRow != (settings.rows - 1) && (currCol != settings.cols - 1)) {
throw vpException(vpException::dimensionError, "Too few images for the grid size");
Expand Down
6 changes: 2 additions & 4 deletions tutorial/image/tutorial-canny.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/****************************************************************************
*
/*
* ViSP, open source Visual Servoing Platform software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
*
Expand Down Expand Up @@ -27,8 +26,7 @@
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*****************************************************************************/
*/

//! \example tutorial-canny.cpp

Expand Down
15 changes: 6 additions & 9 deletions tutorial/ios/AprilTagLiveCamera/VispHelper/ImageConversion.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/****************************************************************************
*
/*
* This file is part of the ViSP software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
*
Expand Down Expand Up @@ -27,8 +26,7 @@
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*****************************************************************************/
*/

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
Expand All @@ -41,12 +39,11 @@

@interface ImageConversion : NSObject

+ (vpImage<vpRGBa>)vpImageColorFromUIImage:(UIImage *)image;
+ (vpImage<unsigned char>)vpImageGrayFromUIImage:(UIImage *)image;
+ (UIImage *)UIImageFromVpImageColor:(const vpImage<vpRGBa> &)I;
+ (UIImage *)UIImageFromVpImageGray:(const vpImage<unsigned char> &)I;
+ (vpImage<vpRGBa>)vpImageColorFromUIImage : (UIImage *)image;
+(vpImage<unsigned char>)vpImageGrayFromUIImage:(UIImage *)image;
+(UIImage *)UIImageFromVpImageColor:(const vpImage<vpRGBa> &)I;
+(UIImage *)UIImageFromVpImageGray:(const vpImage<unsigned char> &)I;

@end

#endif

6 changes: 2 additions & 4 deletions tutorial/ios/AprilTagLiveCamera/VispHelper/ImageConversion.mm
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/****************************************************************************
*
/*
* This file is part of the ViSP software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
*
Expand Down Expand Up @@ -27,8 +26,7 @@
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*****************************************************************************/
*/

#ifndef DOXYGEN_SHOULD_SKIP_THIS

Expand Down
13 changes: 5 additions & 8 deletions tutorial/ios/AprilTagLiveCamera/VispHelper/ImageDisplay.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/****************************************************************************
*
/*
* This file is part of the ViSP software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
*
Expand Down Expand Up @@ -27,8 +26,7 @@
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*****************************************************************************/
*/

#import <UIKit/UIKit.h>
#ifdef __cplusplus
Expand All @@ -41,11 +39,10 @@

@interface ImageDisplay : NSObject

+ (UIImage *)displayLine:(UIImage *)image :(vpImagePoint &)ip1 :(vpImagePoint &)ip2 :(UIColor*)color :(int)tickness;
+ (UIImage *)displayFrame:(UIImage *)image :(const vpHomogeneousMatrix &)cMo :(const vpCameraParameters &)cam
:(double) size :(int)tickness;
+ (UIImage *)displayLine : (UIImage *)image : (vpImagePoint &)ip1 : (vpImagePoint &)ip2 : (UIColor *)color : (int)tickness;
+(UIImage *)displayFrame:(UIImage *)image : (const vpHomogeneousMatrix &)cMo : (const vpCameraParameters &)cam
: (double)size : (int)tickness;

@end

#endif

7 changes: 2 additions & 5 deletions tutorial/ios/AprilTagLiveCamera/VispHelper/ImageDisplay.mm
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/****************************************************************************
*
/*
* ViSP, open source Visual Servoing Platform software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
*
Expand Down Expand Up @@ -27,8 +26,7 @@
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*****************************************************************************/
*/

#ifndef DOXYGEN_SHOULD_SKIP_THIS

Expand Down Expand Up @@ -137,4 +135,3 @@ + (UIImage *)displayFrame:(UIImage *)image :(const vpHomogeneousMatrix &)cMo :(c
@end

#endif

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/****************************************************************************
*
/*
* This file is part of the ViSP software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
*
Expand Down Expand Up @@ -27,8 +26,7 @@
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*****************************************************************************/
*/

#import <UIKit/UIKit.h>
#ifdef __cplusplus
Expand All @@ -39,13 +37,13 @@

NS_ASSUME_NONnullptr_BEGIN

@interface ImageDisplay (withContext)
@interface ImageDisplay(withContext)

+ (void)displayLineWithContext:(CGContextRef)context :(std::vector<vpImagePoint>)polygon :(UIColor*)color :(int)tickness;
+ (void)displayLineWithContext :(CGContextRef)context : (std::vector<vpImagePoint>)polygon : (UIColor *)color : (int)tickness;

+ (void)displayFrameWithContext:(CGContextRef)context :(const vpHomogeneousMatrix &)cMo :(const vpCameraParameters &)cam :(double) size :(int)tickness;
+(void)displayFrameWithContext:(CGContextRef)context : (const vpHomogeneousMatrix &)cMo : (const vpCameraParameters &)cam : (double)size : (int)tickness;

+ (void)displayText:(NSString*)text :(double)x :(double)y :(int)width :(int)height :(UIColor*)color :(UIColor*)bgColor;
+(void)displayText:(NSString *)text : (double)x : (double)y : (int)width : (int)height : (UIColor *)color : (UIColor *)bgColor;

@end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/****************************************************************************
*
/*
* This file is part of the ViSP software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
*
Expand Down Expand Up @@ -27,8 +26,7 @@
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*****************************************************************************/
*/

#import "ImageDisplayWithContext.h"

Expand Down
7 changes: 2 additions & 5 deletions tutorial/ios/GettingStarted/GettingStarted/ViewController.mm
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/****************************************************************************
*
/*
* ViSP, open source Visual Servoing Platform software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
*
Expand Down Expand Up @@ -27,8 +26,7 @@
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*****************************************************************************/
*/

#ifndef DOXYGEN_SHOULD_SKIP_THIS

Expand Down Expand Up @@ -113,4 +111,3 @@ - (void)didReceiveMemoryWarning {
@end

#endif

15 changes: 6 additions & 9 deletions tutorial/ios/StartedAprilTag/StartedAprilTag/ImageConversion.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/****************************************************************************
*
/*
* ViSP, open source Visual Servoing Platform software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
*
Expand Down Expand Up @@ -27,8 +26,7 @@
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*****************************************************************************/
*/

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
Expand All @@ -41,12 +39,11 @@

@interface ImageConversion : NSObject

+ (vpImage<vpRGBa>)vpImageColorFromUIImage:(UIImage *)image;
+ (vpImage<unsigned char>)vpImageGrayFromUIImage:(UIImage *)image;
+ (UIImage *)UIImageFromVpImageColor:(const vpImage<vpRGBa> &)I;
+ (UIImage *)UIImageFromVpImageGray:(const vpImage<unsigned char> &)I;
+ (vpImage<vpRGBa>)vpImageColorFromUIImage : (UIImage *)image;
+(vpImage<unsigned char>)vpImageGrayFromUIImage:(UIImage *)image;
+(UIImage *)UIImageFromVpImageColor:(const vpImage<vpRGBa> &)I;
+(UIImage *)UIImageFromVpImageGray:(const vpImage<unsigned char> &)I;

@end

#endif

Loading

0 comments on commit 3d01549

Please sign in to comment.