\hypertarget{group__Image__IO}{}\section{Image Codecs}
\label{group__Image__IO}\index{Image Codecs@{Image Codecs}}


Image file I/\+O support.  


\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
{\footnotesize template$<$class T $>$ }\\int \hyperlink{group__Image__IO_ga3bf08918a0a39158e0463c11d6dfd979}{S\+P\+L\+::encode\+Pnm} (std\+::ostream \&out\+Stream, const std\+::vector$<$ Array2$<$ T $>$ $>$ \&comps, int max\+Val, bool sgnd, bool binary\+Format=true)
\begin{DoxyCompactList}\small\item\em Output the array as an image in the P\+N\+M format. \end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\int \hyperlink{group__Image__IO_ga9bb36f5ebfaa8161a71567e87bf63dca}{S\+P\+L\+::encode\+Pbm} (std\+::ostream \&out\+Stream, const Array2$<$ T $>$ \&bits, bool binary\+Format=true)
\begin{DoxyCompactList}\small\item\em Output the array as an image in the P\+N\+M format (P\+B\+M type). \end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\int \hyperlink{group__Image__IO_gacd58b7a5b1648f19977140a972685074}{S\+P\+L\+::encode\+Pgm} (std\+::ostream \&out\+Stream, const Array2$<$ T $>$ \&gray, int max\+Val, bool sgnd, bool binary\+Format=true)
\begin{DoxyCompactList}\small\item\em Output the array as an image in the P\+N\+M format (P\+G\+M type). \end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\int \hyperlink{group__Image__IO_gac89f5640f3916029947b4051d4a618e6}{S\+P\+L\+::encode\+Ppm} (std\+::ostream \&out\+Stream, const Array2$<$ T $>$ \&red, const Array2$<$ T $>$ \&green, const Array2$<$ T $>$ \&blue, int max\+Val, bool sgnd, bool binary\+Format=true)
\begin{DoxyCompactList}\small\item\em Output the array as an image in the P\+N\+M format (P\+P\+M type). \end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\int \hyperlink{group__Image__IO_ga44a2f08f53305d4aaf39e6d040d182ff}{S\+P\+L\+::decode\+Pnm} (std\+::istream \&in\+Stream, std\+::vector$<$ Array2$<$ T $>$ $>$ \&comps, int \&max\+Val, bool \&sgnd)
\begin{DoxyCompactList}\small\item\em Input an array as an image in the P\+N\+M format. \end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\int \hyperlink{group__Image__IO_gaaddcb788ab53255340d671e063716d7b}{S\+P\+L\+::decode\+Pbm} (std\+::istream \&in\+Stream, Array2$<$ T $>$ \&bits)
\begin{DoxyCompactList}\small\item\em Input an array as an image in the P\+N\+M format. \end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\int \hyperlink{group__Image__IO_ga0311268cb7bd9bc5cb0c17433572dee5}{S\+P\+L\+::decode\+Pgm} (std\+::istream \&in\+Stream, Array2$<$ T $>$ \&gray, int \&max\+Val, bool \&sgnd)
\begin{DoxyCompactList}\small\item\em Input an array as an image in the P\+N\+M format. \end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\int \hyperlink{group__Image__IO_gafdefeacb6896106495c0efac2fdd6ef1}{S\+P\+L\+::decode\+Ppm} (std\+::istream \&in\+Stream, Array2$<$ T $>$ \&red, Array2$<$ T $>$ \&green, Array2$<$ T $>$ \&blue, int \&max\+Val, bool \&sgnd)
\begin{DoxyCompactList}\small\item\em Input an array as an image in the P\+N\+M format. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Image file I/\+O support. 



\subsection{Function Documentation}
\hypertarget{group__Image__IO_gaaddcb788ab53255340d671e063716d7b}{}\index{Image Codecs@{Image Codecs}!decode\+Pbm@{decode\+Pbm}}
\index{decode\+Pbm@{decode\+Pbm}!Image Codecs@{Image Codecs}}
\subsubsection[{decode\+Pbm}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ int S\+P\+L\+::decode\+Pbm (
\begin{DoxyParamCaption}
\item[{std\+::istream \&}]{in\+Stream, }
\item[{{\bf Array2}$<$ T $>$ \&}]{bits}
\end{DoxyParamCaption}
)}\label{group__Image__IO_gaaddcb788ab53255340d671e063716d7b}


Input an array as an image in the P\+N\+M format. 

Effects\+: A binary image in the P\+B\+M format is read from the stream in\+Stream. The parameter bits is set to the image read. The image to be read must be of the P\+B\+M type (i.\+e., binary).

Returns\+: Upon success, zero is returned; otherwise, a nonzero value is returned. \hypertarget{group__Image__IO_ga0311268cb7bd9bc5cb0c17433572dee5}{}\index{Image Codecs@{Image Codecs}!decode\+Pgm@{decode\+Pgm}}
\index{decode\+Pgm@{decode\+Pgm}!Image Codecs@{Image Codecs}}
\subsubsection[{decode\+Pgm}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ int S\+P\+L\+::decode\+Pgm (
\begin{DoxyParamCaption}
\item[{std\+::istream \&}]{in\+Stream, }
\item[{{\bf Array2}$<$ T $>$ \&}]{gray, }
\item[{int \&}]{max\+Val, }
\item[{bool \&}]{sgnd}
\end{DoxyParamCaption}
)}\label{group__Image__IO_ga0311268cb7bd9bc5cb0c17433572dee5}


Input an array as an image in the P\+N\+M format. 

Effects\+: A grayscale image in the P\+G\+M format is read from the stream in\+Stream. The parameter gray is updated to hold the image read. The parameter max\+Val is set to the maximum value for the image sample data. The parameter sgnd is set to indicate whether the image data is signed. The image to be read must be of the P\+G\+M type (i.\+e., grayscale).

Returns\+: Upon success, zero is returned; otherwise, a nonzero value is returned. \hypertarget{group__Image__IO_ga44a2f08f53305d4aaf39e6d040d182ff}{}\index{Image Codecs@{Image Codecs}!decode\+Pnm@{decode\+Pnm}}
\index{decode\+Pnm@{decode\+Pnm}!Image Codecs@{Image Codecs}}
\subsubsection[{decode\+Pnm}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ int S\+P\+L\+::decode\+Pnm (
\begin{DoxyParamCaption}
\item[{std\+::istream \&}]{in\+Stream, }
\item[{std\+::vector$<$ {\bf Array2}$<$ T $>$ $>$ \&}]{comps, }
\item[{int \&}]{max\+Val, }
\item[{bool \&}]{sgnd}
\end{DoxyParamCaption}
)}\label{group__Image__IO_ga44a2f08f53305d4aaf39e6d040d182ff}


Input an array as an image in the P\+N\+M format. 

Effects\+: An image in the P\+N\+M format is read from the stream in\+Stream. The parameter comps is updated to hold the components of the image read, where the red, green, and blue color components are placed in comps\mbox{[}0\mbox{]}, comps\mbox{[}1\mbox{]}, and comps\mbox{[}2\mbox{]}, respectively. The parameter max\+Val is set to the maximum value for the image sample data. The parameter sgnd is set to indicate whether the image data is signed.

Returns\+: Upon success, zero is returned; otherwise, a nonzero value is returned. \hypertarget{group__Image__IO_gafdefeacb6896106495c0efac2fdd6ef1}{}\index{Image Codecs@{Image Codecs}!decode\+Ppm@{decode\+Ppm}}
\index{decode\+Ppm@{decode\+Ppm}!Image Codecs@{Image Codecs}}
\subsubsection[{decode\+Ppm}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ int S\+P\+L\+::decode\+Ppm (
\begin{DoxyParamCaption}
\item[{std\+::istream \&}]{in\+Stream, }
\item[{{\bf Array2}$<$ T $>$ \&}]{red, }
\item[{{\bf Array2}$<$ T $>$ \&}]{green, }
\item[{{\bf Array2}$<$ T $>$ \&}]{blue, }
\item[{int \&}]{max\+Val, }
\item[{bool \&}]{sgnd}
\end{DoxyParamCaption}
)}\label{group__Image__IO_gafdefeacb6896106495c0efac2fdd6ef1}


Input an array as an image in the P\+N\+M format. 

Effects\+: A color image in the P\+P\+M format is read from the stream in\+Stream. The parameters red, green, and blue are set to R\+G\+B components of the image read. The parameter max\+Val is set to the maximum value for the image sample data. The parameter sgnd is set to indicate whether the image data is signed. The image to be read must be of the P\+P\+M type (i.\+e., R\+G\+B color).

Returns\+: Upon success, zero is returned; otherwise, a nonzero value is returned. \hypertarget{group__Image__IO_ga9bb36f5ebfaa8161a71567e87bf63dca}{}\index{Image Codecs@{Image Codecs}!encode\+Pbm@{encode\+Pbm}}
\index{encode\+Pbm@{encode\+Pbm}!Image Codecs@{Image Codecs}}
\subsubsection[{encode\+Pbm}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ int S\+P\+L\+::encode\+Pbm (
\begin{DoxyParamCaption}
\item[{std\+::ostream \&}]{out\+Stream, }
\item[{const {\bf Array2}$<$ T $>$ \&}]{bits, }
\item[{bool}]{binary\+Format = {\ttfamily true}}
\end{DoxyParamCaption}
)}\label{group__Image__IO_ga9bb36f5ebfaa8161a71567e87bf63dca}


Output the array as an image in the P\+N\+M format (P\+B\+M type). 

Effects\+: The binary image in the array bits is written to the stream out\+Stream. If the parameter binary\+Format is true, the binary variant of the P\+B\+M format is used; otherwise, the text variant is employed.

Returns\+: Upon success, zero is returned; otherwise, a nonzero value is returned. \hypertarget{group__Image__IO_gacd58b7a5b1648f19977140a972685074}{}\index{Image Codecs@{Image Codecs}!encode\+Pgm@{encode\+Pgm}}
\index{encode\+Pgm@{encode\+Pgm}!Image Codecs@{Image Codecs}}
\subsubsection[{encode\+Pgm}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ int S\+P\+L\+::encode\+Pgm (
\begin{DoxyParamCaption}
\item[{std\+::ostream \&}]{out\+Stream, }
\item[{const {\bf Array2}$<$ T $>$ \&}]{gray, }
\item[{int}]{max\+Val, }
\item[{bool}]{sgnd, }
\item[{bool}]{binary\+Format = {\ttfamily true}}
\end{DoxyParamCaption}
)}\label{group__Image__IO_gacd58b7a5b1648f19977140a972685074}


Output the array as an image in the P\+N\+M format (P\+G\+M type). 

Effects\+: The grayscale image in the array gray is written to the stream out\+Stream. If the parameter binary\+Format is true, the binary variant of the P\+B\+M format is used; otherwise, the text variant is employed. The parameter max\+Val specifies the maximum value for sample data. The parameter sgnd specified if the sample data is signed.

Returns\+: Upon success, zero is returned; otherwise, a nonzero value is returned. \hypertarget{group__Image__IO_ga3bf08918a0a39158e0463c11d6dfd979}{}\index{Image Codecs@{Image Codecs}!encode\+Pnm@{encode\+Pnm}}
\index{encode\+Pnm@{encode\+Pnm}!Image Codecs@{Image Codecs}}
\subsubsection[{encode\+Pnm}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ int S\+P\+L\+::encode\+Pnm (
\begin{DoxyParamCaption}
\item[{std\+::ostream \&}]{out\+Stream, }
\item[{const std\+::vector$<$ {\bf Array2}$<$ T $>$ $>$ \&}]{comps, }
\item[{int}]{max\+Val, }
\item[{bool}]{sgnd, }
\item[{bool}]{binary\+Format = {\ttfamily true}}
\end{DoxyParamCaption}
)}\label{group__Image__IO_ga3bf08918a0a39158e0463c11d6dfd979}


Output the array as an image in the P\+N\+M format. 

Effects\+: The image components comps are written to the stream out\+Stream in the P\+N\+M format, where the red, green, and blue color componenets are given by comps\mbox{[}0\mbox{]}, comps\mbox{[}1\mbox{]}, and comps\mbox{[}2\mbox{]}, respectively. If the parameter binary\+Format is true, the binary variant of the P\+N\+M format is used; otherwise, the text variant is used. The parameter max\+Val specifies the maximum value for sample data. The parameter sgnd specified if the sample data is signed.

Returns\+: Upon success, zero is returned; otherwise, a nonzero value is returned. \hypertarget{group__Image__IO_gac89f5640f3916029947b4051d4a618e6}{}\index{Image Codecs@{Image Codecs}!encode\+Ppm@{encode\+Ppm}}
\index{encode\+Ppm@{encode\+Ppm}!Image Codecs@{Image Codecs}}
\subsubsection[{encode\+Ppm}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ int S\+P\+L\+::encode\+Ppm (
\begin{DoxyParamCaption}
\item[{std\+::ostream \&}]{out\+Stream, }
\item[{const {\bf Array2}$<$ T $>$ \&}]{red, }
\item[{const {\bf Array2}$<$ T $>$ \&}]{green, }
\item[{const {\bf Array2}$<$ T $>$ \&}]{blue, }
\item[{int}]{max\+Val, }
\item[{bool}]{sgnd, }
\item[{bool}]{binary\+Format = {\ttfamily true}}
\end{DoxyParamCaption}
)}\label{group__Image__IO_gac89f5640f3916029947b4051d4a618e6}


Output the array as an image in the P\+N\+M format (P\+P\+M type). 

Effects\+: The color image with R\+G\+B color planes in the arrays red, green, and blue, respectively, is written to the stream out\+Stream. If the parameter binary\+Format is true, the binary variant of the P\+B\+M format is used; otherwise, the text variant is employed. The parameter max\+Val specifies the maximum value for sample data. The parameter sgnd specified if the sample data is signed.

Returns\+: Upon success, zero is returned; otherwise, a nonzero value is returned. 