\hypertarget{a02706}{
\section{mln::registration Namespace Reference}
\label{d1/dc1/a02706}\index{mln::registration@{mln::registration}}
}


Namespace of \char`\"{}point-\/wise\char`\"{} expression tools.  


\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class \hyperlink{a00338}{closest\_\-point\_\-basic}
\begin{DoxyCompactList}\small\item\em Closest point functor based on map distance. \item\end{DoxyCompactList}\item 
class \hyperlink{a00339}{closest\_\-point\_\-with\_\-map}
\begin{DoxyCompactList}\small\item\em Closest point functor based on map distance. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
{\footnotesize template$<$typename P , typename F $>$ }\\algebra::quat \hyperlink{a02706_af608abe70bebad40e6c5e326a886d1b6}{get\_\-rot} (const \hyperlink{a00300}{p\_\-array}$<$ P $>$ \&P\_\-, const \hyperlink{a01799_a6a62b262ae4754e9d6963e1431328d8d}{vec3d\_\-f} \&mu\_\-P, const \hyperlink{a01799_a6a62b262ae4754e9d6963e1431328d8d}{vec3d\_\-f} \&mu\_\-Yk, const F \&closest\_\-point, const algebra::quat \&qR, const \hyperlink{a01799_a6a62b262ae4754e9d6963e1431328d8d}{vec3d\_\-f} \&qT)
\begin{DoxyCompactList}\small\item\em FIXME: work only for 3d images. \item\end{DoxyCompactList}\item 
{\footnotesize template$<$typename P , typename F $>$ }\\std::pair$<$ algebra::quat, mln\_\-vec(P)$>$ \hyperlink{a02706_ac9054e0fb163d9c7a14a5a9c75278788}{icp} (const \hyperlink{a00300}{p\_\-array}$<$ P $>$ \&P\_\-, const \hyperlink{a00300}{p\_\-array}$<$ P $>$ \&X, const F \&closest\_\-point, const algebra::quat \&initial\_\-rot, const mln\_\-vec(P)\&initial\_\-translation)
\begin{DoxyCompactList}\small\item\em Base version of the ICP algorithm. It is called in other variants. \item\end{DoxyCompactList}\item 
{\footnotesize template$<$typename P , typename F $>$ }\\\hyperlink{a00225}{composed}$<$ \hyperlink{a00228}{translation}$<$ P::dim, float $>$, \hyperlink{a00227}{rotation}$<$ P::dim, float $>$ $>$ \hyperlink{a02706_a8a6b671a70f1bceb4a642e803fc21405}{icp} (const \hyperlink{a00300}{p\_\-array}$<$ P $>$ \&P\_\-, const \hyperlink{a00300}{p\_\-array}$<$ P $>$ \&X, const F \&closest\_\-point)
\item 
{\footnotesize template$<$typename P $>$ }\\\hyperlink{a00225}{composed}$<$ \hyperlink{a00228}{translation}$<$ P::dim, float $>$, \hyperlink{a00227}{rotation}$<$ P::dim, float $>$ $>$ \hyperlink{a02706_a6411ad3757c11a6c7ac428f5a0b7d6d8}{registration1} (const \hyperlink{a00135}{box}$<$ P $>$ \&domain, const \hyperlink{a00300}{p\_\-array}$<$ P $>$ \&P\_\-, const \hyperlink{a00300}{p\_\-array}$<$ P $>$ \&X)
\begin{DoxyCompactList}\small\item\em Call ICP once and return the resulting transformation. \item\end{DoxyCompactList}\item 
{\footnotesize template$<$typename P $>$ }\\\hyperlink{a00225}{composed}$<$ \hyperlink{a00228}{translation}$<$ P::dim, float $>$, \hyperlink{a00227}{rotation}$<$ P::dim, float $>$ $>$ \hyperlink{a02706_a2e4cfc973899050e8e2841e702bc76c4}{registration2} (const \hyperlink{a00135}{box}$<$ P $>$ \&domain, const \hyperlink{a00300}{p\_\-array}$<$ P $>$ \&P\_\-, const \hyperlink{a00300}{p\_\-array}$<$ P $>$ \&X)
\begin{DoxyCompactList}\small\item\em Call ICP 10 times. \item\end{DoxyCompactList}\item 
{\footnotesize template$<$typename P $>$ }\\\hyperlink{a00225}{composed}$<$ \hyperlink{a00228}{translation}$<$ P::dim, float $>$, \hyperlink{a00227}{rotation}$<$ P::dim, float $>$ $>$ \hyperlink{a02706_a25fbd37a25355599baf9c1c1e6979a23}{registration3} (const \hyperlink{a00135}{box}$<$ P $>$ \&domain, const \hyperlink{a00300}{p\_\-array}$<$ P $>$ \&P\_\-, const \hyperlink{a00300}{p\_\-array}$<$ P $>$ \&X)
\begin{DoxyCompactList}\small\item\em Call ICP 10 times. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Namespace of \char`\"{}point-\/wise\char`\"{} expression tools. 

\subsection{Function Documentation}
\hypertarget{a02706_af608abe70bebad40e6c5e326a886d1b6}{
\index{mln::registration@{mln::registration}!get\_\-rot@{get\_\-rot}}
\index{get\_\-rot@{get\_\-rot}!mln::registration@{mln::registration}}
\subsubsection[{get\_\-rot}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename P , typename F $>$ algebra::quat mln::registration::get\_\-rot (
\begin{DoxyParamCaption}
\item[{const p\_\-array$<$ P $>$ \&}]{ P\_\-, }
\item[{const vec3d\_\-f \&}]{ mu\_\-P, }
\item[{const vec3d\_\-f \&}]{ mu\_\-Yk, }
\item[{const F \&}]{ closest\_\-point, }
\item[{const algebra::quat \&}]{ qR, }
\item[{const vec3d\_\-f \&}]{ qT}
\end{DoxyParamCaption}
)}}
\label{d1/dc1/a02706_af608abe70bebad40e6c5e326a886d1b6}


FIXME: work only for 3d images. 



Definition at line 527 of file icp.hh.



References mln::p\_\-array$<$ P $>$::nsites().

\hypertarget{a02706_ac9054e0fb163d9c7a14a5a9c75278788}{
\index{mln::registration@{mln::registration}!icp@{icp}}
\index{icp@{icp}!mln::registration@{mln::registration}}
\subsubsection[{icp}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename P , typename F $>$ std::pair$<$ algebra::quat, mln\_\-vec(P)$>$ mln::registration::icp (
\begin{DoxyParamCaption}
\item[{const p\_\-array$<$ P $>$ \&}]{ P\_\-, }
\item[{const p\_\-array$<$ P $>$ \&}]{ X, }
\item[{const F \&}]{ closest\_\-point, }
\item[{const algebra::quat \&}]{ initial\_\-rot, }
\item[{const mln\_\-vec(P)\&}]{ initial\_\-translation}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d1/dc1/a02706_ac9054e0fb163d9c7a14a5a9c75278788}


Base version of the ICP algorithm. It is called in other variants. 

Register point in {\ttfamily c} using a function of closest points {\ttfamily closest\_\-point}. This overload allows to specify initial transformations.


\begin{DoxyParams}{Parameters}
\item[\mbox{\tt[in]} {\em P\_\-}]The cloud of points. \item[\mbox{\tt[in]} {\em X}]the reference surface. \item[\mbox{\tt[in]} {\em closest\_\-point}]The function of closest points. \item[\mbox{\tt[in]} {\em initial\_\-rot}]An initial rotation. \item[\mbox{\tt[in]} {\em initial\_\-translation}]An initial translation.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the rigid transformation which may be use later to create a registered image.
\end{DoxyReturn}
WARNING: the function {\ttfamily closest\_\-point} $\ast$MUST$\ast$ take float/double vector as arguments. Otherwise the resulting transformation may be wrong due to the truncation of the vector coordinate values.

\begin{DoxyPrecond}{Precondition}
{\ttfamily P\_\-} and {\ttfamily X} must not be empty.
\end{DoxyPrecond}
Reference article: \char`\"{}A Method for Registration of 3-\/D Shapes\char`\"{}, Paul J. Besl and Neil D. McKay, IEEE, 2, February 1992. 

Definition at line 612 of file icp.hh.



References mln::geom::bbox(), mln::literal::black, mln::set::compute(), mln::duplicate(), mln::box$<$ P $>$::enlarge(), mln::data::fill(), mln::literal::green, mln::io::ppm::save(), and mln::literal::white.

\hypertarget{a02706_a8a6b671a70f1bceb4a642e803fc21405}{
\index{mln::registration@{mln::registration}!icp@{icp}}
\index{icp@{icp}!mln::registration@{mln::registration}}
\subsubsection[{icp}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename P , typename F $>$ {\bf composed}$<$ {\bf translation}$<$P::dim,float$>$,{\bf rotation}$<$P::dim,float$>$ $>$ mln::registration::icp (
\begin{DoxyParamCaption}
\item[{const p\_\-array$<$ P $>$ \&}]{ P\_\-, }
\item[{const p\_\-array$<$ P $>$ \&}]{ X, }
\item[{const F \&}]{ closest\_\-point}
\end{DoxyParamCaption}
)}}
\label{d1/dc1/a02706_a8a6b671a70f1bceb4a642e803fc21405}
Register point in {\ttfamily c} using a function of closest points {\ttfamily closest\_\-point}.


\begin{DoxyParams}{Parameters}
\item[\mbox{\tt[in]} {\em P\_\-}]The cloud of points. \item[\mbox{\tt[in]} {\em X}]the reference surface. \item[\mbox{\tt[in]} {\em closest\_\-point}]The function of closest points.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the rigid transformation which may be use later to create a registered image. 
\end{DoxyReturn}
\hypertarget{a02706_a6411ad3757c11a6c7ac428f5a0b7d6d8}{
\index{mln::registration@{mln::registration}!registration1@{registration1}}
\index{registration1@{registration1}!mln::registration@{mln::registration}}
\subsubsection[{registration1}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename P $>$ {\bf composed}$<$ {\bf translation}$<$ P::dim, float $>$, {\bf rotation}$<$ P::dim, float $>$ $>$ mln::registration::registration1 (
\begin{DoxyParamCaption}
\item[{const box$<$ P $>$ \&}]{ domain, }
\item[{const p\_\-array$<$ P $>$ \&}]{ P\_\-, }
\item[{const p\_\-array$<$ P $>$ \&}]{ X}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d1/dc1/a02706_a6411ad3757c11a6c7ac428f5a0b7d6d8}


Call ICP once and return the resulting transformation. 



Definition at line 325 of file registration.hh.

\hypertarget{a02706_a2e4cfc973899050e8e2841e702bc76c4}{
\index{mln::registration@{mln::registration}!registration2@{registration2}}
\index{registration2@{registration2}!mln::registration@{mln::registration}}
\subsubsection[{registration2}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename P $>$ {\bf composed}$<$ {\bf translation}$<$ P::dim, float $>$, {\bf rotation}$<$ P::dim, float $>$ $>$ mln::registration::registration2 (
\begin{DoxyParamCaption}
\item[{const box$<$ P $>$ \&}]{ domain, }
\item[{const p\_\-array$<$ P $>$ \&}]{ P\_\-, }
\item[{const p\_\-array$<$ P $>$ \&}]{ X}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d1/dc1/a02706_a2e4cfc973899050e8e2841e702bc76c4}


Call ICP 10 times. 

Do the first call to ICP with all sites then work on a subset of which size is decreasing. For each call, a distance criterion is computed on a subset. Sites part of the subset which are too far or too close are removed. Removed sites are $\ast$NOT$\ast$ reused later in the subset. 

Definition at line 345 of file registration.hh.

\hypertarget{a02706_a25fbd37a25355599baf9c1c1e6979a23}{
\index{mln::registration@{mln::registration}!registration3@{registration3}}
\index{registration3@{registration3}!mln::registration@{mln::registration}}
\subsubsection[{registration3}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename P $>$ {\bf composed}$<$ {\bf translation}$<$ P::dim, float $>$, {\bf rotation}$<$ P::dim, float $>$ $>$ mln::registration::registration3 (
\begin{DoxyParamCaption}
\item[{const box$<$ P $>$ \&}]{ domain, }
\item[{const p\_\-array$<$ P $>$ \&}]{ P\_\-, }
\item[{const p\_\-array$<$ P $>$ \&}]{ X}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d1/dc1/a02706_a25fbd37a25355599baf9c1c1e6979a23}


Call ICP 10 times. 

Do the first call to ICP with all sites then work on a subset. For each call, a distance criterion is computed on a subset. A new subset is computed from the whole set of points according to this distance. It will be used in the next call. Removed Sites $\ast$MAY$\ast$ be reintegrated. 

Definition at line 365 of file registration.hh.

