1
\documentclass{article}
\usepackage{amsmath}   
\usepackage{algorithm}   
\usepackage[noend]{algpseudocode}


\makeatletter
\def\BState{\State\hskip-\ALG@thistlm}
\makeatother

\begin{document}
\begin{algorithm}
\caption{ROI}\label{euclid}
\begin{algorithmic}[1]
\Procedure{MyProcedure Region of interest (ROI_1)}{}
\State $\textit{Image_1} \gets \text{camera }\textit{image}$
\State $i  \textit{ROI_1} \gets \text{trimmed}\textit{scale image}$
\BState \emph{image_1}
\State $i  \textit{ROi_2} \gets \text{trimmed image}\textit{from ROI_1}$
\State $i  \textit{image_2} \gets \text{ROI_2}$
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}

I wrote this referring to this Write pseudo code in latex. I included the below listed packages:

Could anyone help me correct this.

I need to print like this

  • please merge showed code fragments to one complete but small document, which we can compile as it is. to lines which you not know, for what they serves, indicate with some comments. – Zarko May 8 at 15:29
1

do you like obtain the following result?

enter image description here

the mwe (minimal working example) for above result is:

\documentclass{article}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}

\begin{document}
    \begin{algorithm}
\caption{ROI}\label{euclid}
\begin{algorithmic}
\Procedure{MyProcedure Region of interest (ROI$_1$)}{}
\State Image$_1$ $\gets$ Camera Image
\State ROI$_1$   $\gets$ Trimmed Scale Image
\If {ROI$_1$ is Found}
    \State {Draw Rectangle around Image$_1$}
\EndIf
\State ROI$_2$ $\gets$ Trimmed Image from ROI$_1$
\State Image$_2$ $\gets$ ROI$_2$
\EndProcedure
\end{algorithmic}
    \end{algorithm}
\end{document}

basic information about algorithm and algorithmic you can find in WIKIBOOKS

  • Thanks for your help!! it worked – sreeramp96 May 8 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.