From 453f384bd7d72506377ca60d41a738b71d71d229 Mon Sep 17 00:00:00 2001 From: theodore Date: Thu, 19 Feb 2015 17:38:44 +0100 Subject: [PATCH] adding documentation for the findnonzero() function --- modules/core/include/opencv2/core.hpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/modules/core/include/opencv2/core.hpp b/modules/core/include/opencv2/core.hpp index 76fb3fd52..cd9cb4720 100644 --- a/modules/core/include/opencv2/core.hpp +++ b/modules/core/include/opencv2/core.hpp @@ -545,8 +545,29 @@ The function returns the number of non-zero elements in src : */ CV_EXPORTS_W int countNonZero( InputArray src ); -/** @brief returns the list of locations of non-zero pixels -@todo document +/** @brief Returns the list of locations of non-zero pixels + +The function returns the coordinates of the location of non-zero pixels in src. +The result array can be both type of Mat or vector. For example: +@code{.cpp} + cv::Mat binaryImage; // input, binary image + cv::Mat locations; // output, locations of non-zero pixels + cv::findNonZero(binaryImage, locations); + + // access pixel coordinates + Point pnt = locations.at(i); +@endcode +or +@code{.cpp} + cv::Mat binaryImage; // input, binary image + vector locations; // output, locations of non-zero pixels + cv::findNonZero(binaryImage, locations); + + // access pixel coordinates + Point pnt = locations[i]; +@endcode +@param src single-channel array +@param idx output array with the non-zero pixel points */ CV_EXPORTS_W void findNonZero( InputArray src, OutputArray idx );