--- milena/ChangeLog | 20 +++ .../tutorial/samples/accu-right-instanciation.tex | 1 + .../tutorial/samples/accu-wrong-instanciation.tex | 1 + milena/doc/tutorial/samples/estim-sites.tex | 1 + .../tutorial/samples/ima2d-decl-2-blobs-output.tex | 7 + milena/doc/tutorial/samples/ima2d-decl-2-blobs.tex | 2 + milena/doc/tutorial/samples/ima2d-decl-2.tex | 12 +- .../doc/tutorial/samples/labeling-compute-call.tex | 3 + .../samples/labeling-compute-result-output.tex | 3 + .../tutorial/samples/labeling-compute-result.tex | 2 + milena/doc/tutorial/tutorial.tex | 148 ++++++++++++++++---- 11 files changed, 166 insertions(+), 34 deletions(-) create mode 100644 milena/doc/tutorial/samples/accu-right-instanciation.tex create mode 100644 milena/doc/tutorial/samples/accu-wrong-instanciation.tex create mode 100644 milena/doc/tutorial/samples/estim-sites.tex create mode 100644 milena/doc/tutorial/samples/ima2d-decl-2-blobs-output.tex create mode 100644 milena/doc/tutorial/samples/ima2d-decl-2-blobs.tex create mode 100644 milena/doc/tutorial/samples/labeling-compute-call.tex create mode 100644 milena/doc/tutorial/samples/labeling-compute-result-output.tex create mode 100644 milena/doc/tutorial/samples/labeling-compute-result.tex diff --git a/milena/ChangeLog b/milena/ChangeLog index a4dd0ec..aad3140 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,23 @@ +2008-10-20 Guillaume Lazzara <z@lrde.epita.fr> + + Update tutorial. + + * doc/samples/accu-right-instanciation.tex, + * doc/samples/accu-wrong-instanciation.tex, + * doc/samples/estim-sites.tex, + * doc/samples/ima2d-decl-2-blobs-output.tex, + * doc/samples/ima2d-decl-2-blobs.tex, + * doc/samples/ima2d-decl-2.tex, + * doc/samples/labeling-compute-call.tex, + * doc/samples/labeling-compute-result-output.tex, + * doc/samples/labeling-compute-result.tex: + New sample code included in the doc. + + * doc/tutorial.tex: + Write section about: + - accumulators and *::compute. + - blobs + 2008-10-20 Nicolas Ballas <ballas@lrde.epita.fr> Update dispatch of the fill_with image and paste routines. diff --git a/milena/doc/tutorial/samples/accu-right-instanciation.tex b/milena/doc/tutorial/samples/accu-right-instanciation.tex new file mode 100644 index 0000000..446893a --- /dev/null +++ b/milena/doc/tutorial/samples/accu-right-instanciation.tex @@ -0,0 +1 @@ +level::compute(accu::meta::bbox(), ima); diff --git a/milena/doc/tutorial/samples/accu-wrong-instanciation.tex b/milena/doc/tutorial/samples/accu-wrong-instanciation.tex new file mode 100644 index 0000000..25e943d --- /dev/null +++ b/milena/doc/tutorial/samples/accu-wrong-instanciation.tex @@ -0,0 +1 @@ +level::compute(accu::meta::bbox, ima); diff --git a/milena/doc/tutorial/samples/estim-sites.tex b/milena/doc/tutorial/samples/estim-sites.tex new file mode 100644 index 0000000..b6d7914 --- /dev/null +++ b/milena/doc/tutorial/samples/estim-sites.tex @@ -0,0 +1 @@ +unsigned nsites = estim::nsites(ima); diff --git a/milena/doc/tutorial/samples/ima2d-decl-2-blobs-output.tex b/milena/doc/tutorial/samples/ima2d-decl-2-blobs-output.tex new file mode 100644 index 0000000..0e08731 --- /dev/null +++ b/milena/doc/tutorial/samples/ima2d-decl-2-blobs-output.tex @@ -0,0 +1,7 @@ +0 1 1 0 0 +0 1 1 0 0 +0 0 0 0 0 +2 2 0 3 0 +2 0 3 3 3 +2 0 0 0 0 + diff --git a/milena/doc/tutorial/samples/ima2d-decl-2-blobs.tex b/milena/doc/tutorial/samples/ima2d-decl-2-blobs.tex new file mode 100644 index 0000000..6699982 --- /dev/null +++ b/milena/doc/tutorial/samples/ima2d-decl-2-blobs.tex @@ -0,0 +1,2 @@ +int_u8 nlabels; +image2d<int_u8> lbl = labeling::blobs(ima, c4(), nlabels); diff --git a/milena/doc/tutorial/samples/ima2d-decl-2.tex b/milena/doc/tutorial/samples/ima2d-decl-2.tex index e7a0953..478a627 100644 --- a/milena/doc/tutorial/samples/ima2d-decl-2.tex +++ b/milena/doc/tutorial/samples/ima2d-decl-2.tex @@ -1,9 +1,9 @@ bool vals[6][5] = { -{0, 1, 1, 0, 0}, -{0, 1, 1, 0, 0}, -{0, 0, 0, 0, 0}, -{1, 1, 0, 1, 0}, -{1, 0, 1, 1, 1}, -{1, 0, 0, 0, 0} + {0, 1, 1, 0, 0}, + {0, 1, 1, 0, 0}, + {0, 0, 0, 0, 0}, + {1, 1, 0, 1, 0}, + {1, 0, 1, 1, 1}, + {1, 0, 0, 0, 0} }; image2d<bool> ima = make::image2d(vals); diff --git a/milena/doc/tutorial/samples/labeling-compute-call.tex b/milena/doc/tutorial/samples/labeling-compute-call.tex new file mode 100644 index 0000000..bbe6eff --- /dev/null +++ b/milena/doc/tutorial/samples/labeling-compute-call.tex @@ -0,0 +1,3 @@ +util::array<box2d> boxes = labeling::compute(accu::meta::bbox(), + lbl, + nlabels); diff --git a/milena/doc/tutorial/samples/labeling-compute-result-output.tex b/milena/doc/tutorial/samples/labeling-compute-result-output.tex new file mode 100644 index 0000000..d7fbc06 --- /dev/null +++ b/milena/doc/tutorial/samples/labeling-compute-result-output.tex @@ -0,0 +1,3 @@ +[(1,2)...(2,3)] +[(4,1)...(6,2)] +[(4,3)...(5,5)] diff --git a/milena/doc/tutorial/samples/labeling-compute-result.tex b/milena/doc/tutorial/samples/labeling-compute-result.tex new file mode 100644 index 0000000..5f92904 --- /dev/null +++ b/milena/doc/tutorial/samples/labeling-compute-result.tex @@ -0,0 +1,2 @@ +for (unsigned i = 1; i <= nlabels; ++i) + std::cout << boxes[i] << std::endl; diff --git a/milena/doc/tutorial/tutorial.tex b/milena/doc/tutorial/tutorial.tex index 2e7ddfe..d91f56f 100644 --- a/milena/doc/tutorial/tutorial.tex +++ b/milena/doc/tutorial/tutorial.tex @@ -82,7 +82,9 @@ showstringspaces=false,linewidth=14cm} - \backslash subpage iterators - \backslash subpage imamemmgmt - \backslash subpage basicops -- \backslash subpage graphes +- \backslash subpage graphandima +- \backslash subpage arithmops +- \backslash subpage mathtools \backslash htmlonly \end{htmlonly} @@ -976,7 +978,22 @@ For instance, the algorithm level::paste tests that the set of sites of imgb %==================================== \doxysection{blobs}{Blobs} -//FIXME: write it! + +Labeling::blobs() is used to label an image. It returns a new image with the +component id as value for each site. The background has 0 as id therefore the +component ids start from 1. + +Consider the following image: +\doxycode{ima2d-decl-2} + +Then label this image thanks to labeling::blobs: +\doxycode{ima2d-decl-2-blobs} +Output: +\doxycode{ima2d-decl-2-blobs-output} + +Note that this routine returns the number of components in its third parameter. +This parameter \textbf{must} be of the same type as the returned image value. + %************************** \doxysection{compute}{Compute} @@ -992,55 +1009,116 @@ image. \\ level::compute() & compute an accumulator on the values of an image. \\ \end{tabular} +\subsection{Accumulators} An accumulator is a special object accumulating data while iterating all over the image values or sites. Hereby follows a list of accumulators available in Olena. %---------------- -\subsection*{Accumulators on sites} +\subsubsection*{Accumulators on sites} \begin{tabular}{l|p{8cm}} -Name | Description \\ +Name & Description \\ \hline -bbox & \\ -count\_adjacent\_vertices & \\ -count & \\ +bbox & Bounding boxes\\ +count\_adjacent\_vertices & Count adjacent vertices\\ +count & Count the number of sites\\ height & \\ volume & \\ \end{tabular} %---------------- -\subsection*{Accumulators on values} +\subsubsection*{Accumulators on values} \begin{tabular}{l|p{8cm}} -Name | Description \\ +Name & Description \\ \hline -histo & \\ -max & \\ -max\_h & \\ -mean & \\ -median\_alt & \\ -median\_h & \\ -min & \\ -min\_h & \\ -min\_max & \\ +histo & Histogram \\ +max & Max value \\ +max\_h & Max value (Hexa)\\ +mean & Mean value\\ +median\_alt & Median\\ +median\_h & Median (Hexa)\\ +min & Min value\\ +min\_h & Min value (Hexa)\\ +min\_max & Min and Max value\\ rank\_bool & \\ rank & \\ rank\_high\_quant & \\ -sum & \\ +sum & Sum the values\\ \end{tabular} %---------------- -\subsection*{Accumulators on values} +\subsubsection*{Special accumulators} \begin{tabular}{l|p{8cm}} -Name | Description \\ +Name & Description \\ \hline -pair & \\ -p & \\ -tuple & \\ -v & \\ +pair & Pair of accumulators\\ +tuple & $n$-uplets of accumulators\\ \end{tabular} -//FIXME: write it! +Each accumulator can be used in *::compute(). +It exists two versions of each accumulator. +\begin{itemize} + \item mln::accu::*, this version require the site or value type as parameter. + For instance, for the bbox accumulator, the type would be + accu::bbox<mln\_psite(I)>, where I is the type of the image on which it will be + computed. + \item mln::accu::meta::*, this is usually the easiest version to use. The type + of site or value do not need to be specified and will be deduced at compile + time. For the bbox accumulator, the accumulator type would be + accu::meta::bbox. +\end{itemize} + +Note that when an accumulator is passed to *::compute, it must be instanciated. +You cannot write: +\doxycode{accu-wrong-instanciation} +Instead, you must write: +\doxycode{accu-right-instanciation} +\subsection{Example with labeling::compute()} + +In this example we will try to retrieve the bounding box of each component in an +image. + +Consider the following image: +\doxycode{ima2d-decl-2} + +Then label this image thanks to labeling::blobs: +\doxycode{ima2d-decl-2-blobs} +Output: +\doxycode{ima2d-decl-2-blobs-output} + +Then, use labeling::compute() with the bbox accumulator: +\doxycode{labeling-compute-call} + +Labeling::compute() hold an accumulator for each component, which means it +returns an array of accumulator results. +In this case, it returns an array of box2d. + +\textbf{Important note:} since labeling::blobs() labels the component from 1 and +set the background to 0, we will want to iterate from 1 to nlabels included. +\doxycode{labeling-compute-result} +Output: +\doxycode{labeling-compute-result-output} + +\subsection{Routines based on accumulators and *::compute()} + +In order to make the code cleaner, small routines are available for the +most used accumulators. + +Currently there are the following routines:\\ + +\begin{tabular}{l|p{8cm}} +Name & Description \\ +\hline +nsites & Return the number of sites of an image or a site set.\\ +mean & Return the mean of the values of an image.\\ +min\_max & Return the min and max values of the values of an image.\\ +sum & Return the sum of the values of an image. +\end{tabular} + +These routines can be found in mln/estim. +For example, with estim::nsites() simply write: +\doxycode{estim-sites} %==================================== \doxysection{partima}{Working with parts of an image} @@ -1140,9 +1218,9 @@ site set. %==================================== \newpage \clearpage -\doxychapter{graphes}{Graphes and images} +\doxychapter{graphandima}{Graphes and images} -//FIXME: REWRITE +FIXME: REWRITE %************************** \doxysection{graphdesc}{Description} @@ -1301,4 +1379,18 @@ for_all(E) //FIXME talk about p\_vertices and p\_edges. +%==================================== +\newpage +\clearpage +\doxychapter{arithmops}{Arithmetical operators} + +FIXME write it + +%==================================== +\newpage +\clearpage +\doxychapter{mathtools}{Mathematical tools} + +FIXME write it + \end{document} -- 1.5.6.5
participants (1)
-
Guillaume Lazzara