Skip to content

Commit

Permalink
Minor changes:
Browse files Browse the repository at this point in the history
- code indentation
- typo
- doxygen doc improvement
  • Loading branch information
fspindle committed Aug 29, 2023
1 parent 45415c8 commit 4c258eb
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 232 deletions.
24 changes: 12 additions & 12 deletions doc/tutorial/image/tutorial-image-filtering.dox
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The resulting floating-point images \c dIx, \c dIy are the following:
\section canny Canny edge detector

Canny edge detector function relies on OpenCV if ViSP was build with OpenCV 2.1 or higher. Otherwise,
it relies on the ViSP implementation vpCannyEdgeDetector class.
it relies on the ViSP implementation in vpCannyEdgeDetector class.

After the declaration of a new image container \c C, Canny edge detector is applied using:
\snippet tutorial-image-filter.cpp Canny
Expand All @@ -91,17 +91,17 @@ The resulting image \c C is the following:
To apply a convolution to an image, we first have to define a kernel.
For example, let us consider the 3x3 Sobel kernel defined in \c K.

\f[
{\bf K} = \begin{tabular}{|c|c|c|}
\hline
1 & 0 & -1 \\
\hline
2 & 0 & -2 \\
\hline
1 & 0 & -1 \\
\hline
\end{tabular}
\f]
\f[
{\bf K} = \left[ \begin{matrix}
\hline
1 & 0 & -1 \\
\hline
2 & 0 & -2 \\
\hline
1 & 0 & -1 \\
\hline
\end{matrix} \right]
\f]

\snippet tutorial-image-filter.cpp Convolution kernel

Expand Down
48 changes: 24 additions & 24 deletions modules/core/include/visp3/core/vpCannyEdgeDetection.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,25 @@ class vpCannyEdgeDetection

/** @name Different steps methods */
/**
* \brief Step 1: filtering + Step 2: gradient computation
* \brief Step 1: filtering + Step 2: gradient computation
* \details First, perform Gaussian blur to the input image.
* Then, compute the x-axis and y-axis gradients of the image.
* \param[in] I The image we want to compute the gradients.
* \param[in] I : The image we want to compute the gradients.
*/
void performFilteringAndGradientComputation(const vpImage<unsigned char> &I);

/**
* \brief Step 3: edge thining
* \brief Step 3: Edge thining.
* \details Perform the edge thining step.
* Perform a non-maximum suppresion to keep only local maxima as edge candidates.
* Perform a non-maximum suppression to keep only local maxima as edge candidates.
*/
void performEdgeThining();

/**
* \brief Perform hysteresis thresholding.
* \details Edge candidates that are greater than \b m_upperThreshold are saved in \b m_strongEdgePoints
* and will be kept in the final edge map.
* Edge candidates that are bewteen \b m_lowerThreshold and \b m_upperThreshold are saved in
* Edge candidates that are between \b m_lowerThreshold and \b m_upperThreshold are saved in
* \b m_weakEdgePoints and will be kept in the final edge map only if they are connected
* to a strong edge point.
* Edge candidates that are below \b m_lowerThreshold are discarded.
Expand All @@ -124,7 +124,7 @@ class vpCannyEdgeDetection
/**
* @brief Search recursively for a strong edge in the neighborhood of a weak edge.
*
* \param[in] coordinates The coordinates we are checking.
* \param[in] coordinates : The coordinates we are checking.
* \return true We found a strong edge point in its 8-connected neighborhood.
* \return false We did not found a strong edge point in its 8-connected neighborhood.
*/
Expand All @@ -151,10 +151,10 @@ class vpCannyEdgeDetection
/**
* \brief Construct a new vpCannyEdgeDetection object.
*
* \param[in] gaussianKernelSize The size of the Gaussian filter kernel. Must be odd.
* \param[in] gaussianStdev The standard deviation of the Gaussian filter.
* \param[in] lowerThreshold The lower threshold of the hysteresis thresholding step. If negative, will be computed from the upper threshold.
* \param[in] upperThreshold The upper threshold of the hysteresis thresholding step. If negative, will be computed from the median of the gray values of the image.
* \param[in] gaussianKernelSize : The size of the Gaussian filter kernel. Must be odd.
* \param[in] gaussianStdev : The standard deviation of the Gaussian filter.
* \param[in] lowerThreshold : The lower threshold of the hysteresis thresholding step. If negative, will be computed from the upper threshold.
* \param[in] upperThreshold : The upper threshold of the hysteresis thresholding step. If negative, will be computed from the median of the gray values of the image.
*/
vpCannyEdgeDetection(const int &gaussianKernelSize, const float &gaussianStdev,
const float &lowerThreshold = -1., const float &upperThreshold = -1.);
Expand All @@ -164,7 +164,7 @@ class vpCannyEdgeDetection
/**
* \brief Construct a new vpCannyEdgeDetection object.
*
* \param[in] jsonPath The path towards the JSON file to use to initialize the vpCannyEdgeDetection object.
* \param[in] jsonPath : The path towards the JSON file to use to initialize the vpCannyEdgeDetection object.
*/
vpCannyEdgeDetection(const std::string &jsonPath);

Expand All @@ -173,16 +173,16 @@ class vpCannyEdgeDetection
* whose path is \b jsonPath. Throw a \b vpException error if the file
* does not exist.
*
* \param[in] jsonPath The path towards the JSON configuration file.
* \param[in] jsonPath : The path towards the JSON configuration file.
*/
void initFromJSON(const std::string &jsonPath);

/**
* \brief Read the detector configuration from JSON. All values are optional and if an argument is not present,
* the default value defined in the constructor is kept
*
* \param j The JSON object, resulting from the parsing of a JSON file.
* \param detector The detector, that will be initialized from the JSON data.
* \param j : The JSON object, resulting from the parsing of a JSON file.
* \param detector : The detector that will be initialized from the JSON data.
*/
inline friend void from_json(const json &j, vpCannyEdgeDetection &detector)

Check warning on line 187 in modules/core/include/visp3/core/vpCannyEdgeDetection.h

View check run for this annotation

Codecov / codecov/patch

modules/core/include/visp3/core/vpCannyEdgeDetection.h#L187

Added line #L187 was not covered by tests
{
Expand All @@ -195,8 +195,8 @@ class vpCannyEdgeDetection
/**
* \brief Parse a vpCircleHoughTransform into JSON format.
*
* \param j A JSON parser object.
* \param config The vpCircleHoughTransform that must be parsed into JSON format.
* \param j : A JSON parser object.
* \param detector : The vpCannyEdgeDetection object that must be parsed into JSON format.
*/
inline friend void to_json(json &j, const vpCannyEdgeDetection &detector)
{
Expand Down Expand Up @@ -226,15 +226,15 @@ class vpCannyEdgeDetection
* \brief Detect the edges in an image.
* Convert the color image into a gray-scale image.
*
* \param[in] I_color An RGB image, in ViSP format.
* \param[in] I_color : An RGB image, in ViSP format.
* \return vpImage<unsigned char> 255 means an edge, 0 means not an edge.
*/
vpImage<unsigned char> detect(const vpImage<vpRGBa> &I_color);

/**
* \brief Detect the edges in a gray-scale image.
*
* \param[in] I A gray-scale image, in ViSP format.
* \param[in] I : A gray-scale image, in ViSP format.
* \return vpImage<unsigned char> 255 means an edge, 0 means not an edge.
*/
vpImage<unsigned char> detect(const vpImage<unsigned char> &I);
Expand All @@ -245,8 +245,8 @@ class vpCannyEdgeDetection
/**
* \brief Set the Gradients of the image that will be processed.
*
* \param[in] dIx Gradient along the horizontal axis of the image.
* \param[in] dIy Gradient along the vertical axis of the image.
* \param[in] dIx : Gradient along the horizontal axis of the image.
* \param[in] dIy : Gradient along the vertical axis of the image.
*/
inline void setGradients(const vpImage<float> &dIx, const vpImage<float> &dIy)
{
Expand All @@ -260,8 +260,8 @@ class vpCannyEdgeDetection
* Edge point candidates whose gradient is between these two values is kept only if it
* linked somehow to a strong edge point.
*
* \param[in] lowerThresh The lower threshold: each point whose gradient is below this threshold is discarded.
* \param[in] upperThresh The upper threshold: each point whose gradient is greater than this threshold is
* \param[in] lowerThresh : The lower threshold: each point whose gradient is below this threshold is discarded.
* \param[in] upperThresh : The upper threshold: each point whose gradient is greater than this threshold is
* said to be a strong edge point and is kept.
*/
inline void setCannyThresholds(const float &lowerThresh, const float &upperThresh)
Expand All @@ -274,8 +274,8 @@ class vpCannyEdgeDetection
* @brief Set the Gaussian Filters kernel size and standard deviation
* and initialize the aforementioned filters.
*
* \param[in] kernelSize The size of the Gaussian filters kernel.
* \param[in] stdev The standard deviation of the Gaussian filters used to blur and
* \param[in] kernelSize : The size of the Gaussian filters kernel.
* \param[in] stdev : The standard deviation of the Gaussian filters used to blur and
* compute the gradient of the image.
*/
inline void setGaussianFilterParameters(const int &kernelSize, const float &stdev)
Expand Down
Loading

0 comments on commit 4c258eb

Please sign in to comment.