Skip to content

Commit d2a1c20

Browse files
authored
Merge pull request #1888 from fspindle/feat_doxygen_doc
Improve doxygen documentation
2 parents 294d277 + 1dbd261 commit d2a1c20

2 files changed

Lines changed: 50 additions & 3 deletions

File tree

modules/core/include/visp3/core/vpImage_getters.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,51 @@ void vpImage<Type>::getMinMaxLoc(vpImagePoint *minLoc, vpImagePoint *maxLoc, Typ
766766
* considered, if set to true.
767767
* \param[out] nbValidPoints Optional parameter. When different from nullptr contains the number of points that are
768768
* valid according to the boolean mask or image size when `p_mask` is set to nullptr.
769+
*
770+
* The following sample code shows how to use \b vpImage::getMeanValue():
771+
* \code
772+
* #include <visp3/core/vpImage.h>
773+
*
774+
* #ifdef ENABLE_VISP_NAMESPACE
775+
* using namespace VISP_NAMESPACE_NAME;
776+
* #endif
777+
*
778+
* int main()
779+
* {
780+
* // gray
781+
* {
782+
* vpImage<unsigned char> I(1, 2);
783+
* I[0][0] = 1;
784+
* I[0][1] = 2;
785+
*
786+
* std::cout << "Gray image mean value: " << I.getMeanValue() << std::endl;
787+
* std::cout << "Gray image global mean value: " << I.getMeanValue() << std::endl; // nchannels = 1
788+
* }
789+
* // color
790+
* {
791+
* vpImage<vpRGBa> I(1, 2);
792+
* I[0][0].R = 1;
793+
* I[0][0].G = 2;
794+
* I[0][0].B = 3;
795+
* I[0][1].R = 4;
796+
* I[0][1].G = 5;
797+
* I[0][1].B = 6;
798+
*
799+
* int nchannels = 3;
800+
* std::cout << "RGBa color image mean value: " << I.getMeanValue() << std::endl;
801+
* std::cout << "RGBa color image global mean value: " << I.getMeanValue() / nchannels << std::endl;
802+
* }
803+
*
804+
* return EXIT_SUCCESS;
805+
* }
806+
* \endcode
807+
* It produces the following output:
808+
* \code{.sh}
809+
* Gray image mean value: 1.5
810+
* Gray image global mean value: 1.5
811+
* RGBa color image mean value: 10.5
812+
* RGBa color image global mean value: 3.5
813+
* \endcode
769814
*/
770815
template <class Type> double vpImage<Type>::getMeanValue(const vpImage<bool> *p_mask, unsigned int *nbValidPoints) const
771816
{

modules/core/src/tools/file/vpIoTools_npy.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ visp::cnpy::NpyArray load_the_npz_array(FILE *fp, uint32_t compr_bytes, uint32_t
429429

430430
// https://github.com/francescopace/cnpy/blob/4170b94634e5ff5b6925708f450480a9601627a9/cnpy.h#L187-L214
431431
void visp::cnpy::compressData(size_t nbytes_uncompressed, std::vector<uint8_t> &uncompressed,
432-
std::vector<uint8_t> &buffer_compressed, size_t &nbytes_on_disk, FILE *fp)
432+
std::vector<uint8_t> &buffer_compressed, size_t &nbytes_on_disk, FILE *fp)
433433
{
434434
// Compress using zlib deflate (raw deflate, no zlib/gzip header)
435435
uLongf max_compressed_size = compressBound(nbytes_uncompressed);
@@ -817,13 +817,14 @@ std::vector<char> utf8_to_utf32_vec_pad(const std::string &utf8, const std::size
817817
\param[in] data_vec : Vector of std::string.
818818
\param[in] shape : Shape of the array, e.g. Nz x Ny x Nx.
819819
\param[in] mode : Writing mode, i.e. overwrite (w) or append (a) to the file.
820+
\param[in] compress_data : If true, the data is compressed using the DEFLATE algorithm.
820821
\warning This function should also work on big-endian platform, without guarantee since it has not been tested extensively.
821822
\note Original library: <a href="https://github.com/rogersce/cnpy">cnpy</a> with MIT license.
822823
823824
\sa To see how to use it, you may have a look at \ref tutorial-npz
824825
*/
825826
void visp::cnpy::npz_save_str(const std::string &zipname, std::string fname, const std::vector<std::string> &data_vec,
826-
const std::vector<size_t> &shape, const std::string &mode, bool compress_data)
827+
const std::vector<size_t> &shape, const std::string &mode, bool compress_data)
827828
{
828829
if (data_vec.empty()) {
829830
vpException(vpException::badValue, "Input string data is empty.");
@@ -1006,13 +1007,14 @@ void visp::cnpy::npz_save_str(const std::string &zipname, std::string fname, con
10061007
\param[in] fname : Identifier for the corresponding array of data.
10071008
\param[in] data_str : C++ std::string data.
10081009
\param[in] mode : Writing mode, i.e. overwrite (w) or append (a) to the file.
1010+
\param[in] compress_data : If true, the data is compressed using the DEFLATE algorithm.
10091011
\warning This function should also work on big-endian platform, without guarantee since it has not been tested extensively.
10101012
\note Original library: <a href="https://github.com/rogersce/cnpy">cnpy</a> with MIT license.
10111013
10121014
\sa To see how to use it, you may have a look at \ref tutorial-npz
10131015
*/
10141016
void visp::cnpy::npz_save_str(const std::string &zipname, const std::string &fname, const std::string &data_str,
1015-
const std::string &mode, bool compress_data)
1017+
const std::string &mode, bool compress_data)
10161018
{
10171019
std::vector<std::string> data_vec;
10181020
data_vec.push_back(data_str);

0 commit comments

Comments
 (0)