init
BIN
resource/Sources/PointProcessing/IPCV_PointProcessing.pdf
Normal file
794
resource/Sources/PointProcessing/IPCV_PointProcessing.tex
Normal file
@ -0,0 +1,794 @@
|
||||
\documentclass[english,11pt,table,handout]{beamer}
|
||||
|
||||
\input{ipcv-style.tex}
|
||||
\usepackage{pgf}
|
||||
|
||||
\newcommand{\Rule}[2]{\genfrac{}{}{0.7pt}{}{{\setlength{\fboxrule}{0pt}\setlength{\fboxsep}{3mm}\fbox{$#1$}}}{{\setlength{\fboxrule}{0pt}\setlength{\fboxsep}{3mm}\fbox{$#2$}}}}
|
||||
|
||||
\newcommand{\Rulee}[3]{\genfrac{}{}{0.7pt}{}{{\setlength{\fboxrule}{0pt}\setlength{\fboxsep}{3mm}\fbox{$#1$}}}{{\setlength{\fboxrule}{0pt}\setlength{\fboxsep}{3mm}\fbox{$#2$}}}[#3]}
|
||||
|
||||
\usepackage{url}
|
||||
|
||||
\usepackage{qtree}
|
||||
|
||||
\usepackage{datetime}
|
||||
|
||||
\usepackage{amsfonts}
|
||||
\usepackage{mathtools}
|
||||
\usepackage{fancybox}
|
||||
\usepackage[linesnumbered]{algorithm2e}
|
||||
\usepackage{ragged2e}
|
||||
\usepackage{verbatim}
|
||||
|
||||
|
||||
|
||||
\usepackage{pgfplots}
|
||||
|
||||
|
||||
\lecture[2]{Point Processing and Histogram}{lecture-text}
|
||||
|
||||
% \subtitle{Sequence Control}
|
||||
|
||||
\date{August 15, 2018}
|
||||
\newcounter{saveenumi}
|
||||
|
||||
\usepackage{wrapfig}
|
||||
\usetikzlibrary{automata,arrows,positioning, chains, shapes.callouts, calc}
|
||||
|
||||
\tikzstyle{mnode}=[circle, draw, fill=black, inner sep=0pt, minimum width=4pt]
|
||||
\tikzstyle{thinking} = [draw=blue, very thick]
|
||||
\edef\sizetape{1cm}
|
||||
\tikzstyle{tmtape}=[draw,minimum size=\sizetape]
|
||||
\tikzstyle{tmhead}=[arrow box,draw,minimum size=.5cm,arrow box
|
||||
arrows={east:.25cm, west:0.25cm}]
|
||||
\tikzset{
|
||||
level/.style = { ultra thick, blue },
|
||||
connect/.style = { dashed, red },
|
||||
notice/.style = { draw, rectangle callout, callout relative pointer={#1} },
|
||||
label/.style = { text width=4cm }
|
||||
}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\begin{frame}
|
||||
\selectlanguage{english}
|
||||
\maketitle
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}\frametitle<presentation>{Overview}
|
||||
\tableofcontents
|
||||
\end{frame}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
%\frame
|
||||
%{
|
||||
% \Huge
|
||||
% \begin{center}
|
||||
% \textcolor{blue}{\textbf{What is local processing?}}
|
||||
% \end{center}
|
||||
%}
|
||||
|
||||
\section{Point processing}
|
||||
\frame
|
||||
{
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Concepts}
|
||||
\begin{itemize}
|
||||
\item Image: $f(x,y)$
|
||||
\begin{enumerate}
|
||||
\item $x$: discrete variable, in $[0,1, .., N]$
|
||||
\item $y$: discrete variable, in $[0,1, .., M]$
|
||||
\item $f(x,y)$: discrete value, in $[0,1, .., 255]$
|
||||
\end{enumerate}
|
||||
\item point $\equiv$ pixel
|
||||
\item $f(x,y)$: has $M \times N$ points (or pixels)
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
|
||||
|
||||
}
|
||||
\frame
|
||||
{
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Definition and Notation}
|
||||
\begin{itemize}
|
||||
\item \textbf{Point processing}: Process each point by a function that depends ONLY the pixel's value and that does not depend on the point's neighbors.
|
||||
\item Pixel processing function:
|
||||
\begin{itemize}
|
||||
\item referred to as \textbf{transfer function}
|
||||
\item denoted as $T[.]$
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
|
||||
\begin{figure}[!h]
|
||||
\begin{tabular}{cc}
|
||||
\includegraphics[scale=0.4]{point_process_model.png} &
|
||||
\end{tabular}
|
||||
|
||||
\end{figure}
|
||||
\begin{itemize}
|
||||
\item $f(x,y)$: input image
|
||||
\item $g(x,y) = T[f(x,y)]$: output image
|
||||
\end{itemize}
|
||||
|
||||
}
|
||||
|
||||
\subsection{Linear transformation}
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Linear transformation: Math}
|
||||
\begin{itemize}
|
||||
\item $g(x,y) = a \times f(x,y) + b$
|
||||
\item Where, $a$ and $b$: pre-defined parameters
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
|
||||
\begin{block}{Linear transformation: Applications}
|
||||
\begin{itemize}
|
||||
\item General: Change the image's intensity, cause the input bighter or darker
|
||||
\begin{itemize}
|
||||
\item Users have to choose appropriate $a$ and $b$ (manually)
|
||||
\end{itemize}
|
||||
\item Specific:
|
||||
\begin{itemize}
|
||||
\item Create negative images
|
||||
\item Convert to back-white image
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Linear transformation: with Matlab}
|
||||
\lstset{language=Matlab, basicstyle=\small, escapeinside={\%*}{*)}}
|
||||
\begin{lstlisting}
|
||||
%read input image
|
||||
im = imread('cameraman.tif');
|
||||
%set parameters
|
||||
a1 = 1.5; b1 = 20;
|
||||
a2 = 1.5; b2 = 50;
|
||||
a3 = 0.5; b3 = 0;
|
||||
%transform the input
|
||||
im1 = a1 * im + b1; %clipped to [0,255] auto
|
||||
im2 = a2 * im + b2; %clipped to [0,255] auto
|
||||
im3 = a3 * im + b3; %clipped to [0,255] auto
|
||||
|
||||
|
||||
\end{lstlisting}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Linear transformation: with Matlab(continued)}
|
||||
\lstset{language=Matlab, basicstyle=\tiny, escapeinside={\%*}{*)}}
|
||||
\begin{lstlisting}
|
||||
%show output image
|
||||
figure;
|
||||
subplot(2,2,1); imshow(im); title('input image')
|
||||
subplot(2,2,2); imshow(im1);
|
||||
t1 = sprintf('output image [a =%5.2f, b = %5.2f]',
|
||||
a1, b1);
|
||||
title(t1)
|
||||
subplot(2,2,3); imshow(im2);
|
||||
t2 = sprintf('output image [a =%5.2f, b = %5.2f]',
|
||||
a2, b2);
|
||||
title(t2)
|
||||
subplot(2,2,4); imshow(im3);
|
||||
t3 = sprintf('output image [a =%5.2f, b = %5.2f]',
|
||||
a3, b3);
|
||||
title(t3)
|
||||
suptitle('Linear Transformation: output = a*input + b');
|
||||
\end{lstlisting}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Linear transformation: Illustration}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{cc}
|
||||
\includegraphics[width=2.3cm]{./images/cameraman.png} & \includegraphics[width=2.3cm]{./images/cameraman1.png} \\
|
||||
Input image & Output Image \\
|
||||
& $[a=1.5, b=20]$ \\
|
||||
\includegraphics[width=2.3cm]{./images/cameraman2.png} &
|
||||
\includegraphics[width=2.3cm]{./images/cameraman3.png} \\
|
||||
Output Image & Output Image \\
|
||||
$[a=1.5, b=50]$ & $[a=0.5, b=0]$
|
||||
|
||||
\end{tabular}
|
||||
\caption{Linear Transformation: \textbf{output} = a * \textbf{input} + b}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Linear transformation: Illustration}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{c}
|
||||
\includegraphics[width=7cm]{./images/linear_negative.png}
|
||||
|
||||
\end{tabular}
|
||||
\caption{Creating negative image: \textbf{output} = a * \textbf{input} + b; where, $\mathbf{a=-1, b = 255}$}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Linear transformation: Illustration}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{c}
|
||||
\includegraphics[height=6.5cm]{./images/negative_demo.png}
|
||||
|
||||
\end{tabular}
|
||||
\caption{Creating negative image: \textbf{output} = a * \textbf{input} + b; where, $\mathbf{a=-1, b = 255}$}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\subsection{Logarithmic transformation}
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Logarithmic transformation: Math}
|
||||
\begin{itemize}
|
||||
\item $g(x,y) = a \times \log[{1 + f(x,y)] + b}$
|
||||
\item Where, $a$: a pre-defined parameter
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
|
||||
\begin{block}{Logarithm function}
|
||||
\begin{tikzpicture}[scale=0.4,domain=1:16]
|
||||
\draw[very thin,color=gray] (0,0) grid (15,6);
|
||||
% Draw axes
|
||||
\draw [<->] (0,7) node (yaxis) [above] {$\log_2(x)$}
|
||||
|- (17,0) node (xaxis) [right] {$x$};
|
||||
|
||||
\draw[color=blue, thick] plot (\x,{log2(\x)})
|
||||
node[above] {$f(x) = \log_2(x)$};
|
||||
|
||||
%\draw[color=blue, dashed] (0,0) -- (15,15) node[above] {$f(n)=n$};
|
||||
%\draw[color=blue, dashed] (0,0) -- (16, 8) node[above] {$f(n)=n/2$};
|
||||
\end{tikzpicture}
|
||||
|
||||
\begin{itemize}
|
||||
\item a large value $(x)$ $\rightarrow$ mapped to a smaller value $(\log_2 x)$
|
||||
\item a large distance between two intensities in the input image $\rightarrow$ mapped to a smaller distance in the output image
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
|
||||
\begin{block}{Logarithmic transformation: Applications}
|
||||
\begin{itemize}
|
||||
\item Input image:
|
||||
\begin{itemize}
|
||||
\item have some regions with too dark intensities (\textbf{near 0})
|
||||
\item have some regions with too bright intensities (\textbf{near 255})
|
||||
\end{itemize}
|
||||
|
||||
\item Requirement:
|
||||
\begin{itemize}
|
||||
\item Make dark regions brighter while keeping the intensity in bright regions lower than 255.
|
||||
\item Or, make bright regions darker while keeping the intensity in dark regions lower than 0.
|
||||
\end{itemize}
|
||||
\item Solution: use logarithmic transformation
|
||||
\item Often case:
|
||||
\begin{itemize}
|
||||
\item Should use logarithmic transformation to enhance the result of FFT before displaying
|
||||
\end{itemize}
|
||||
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Logarithmic transformation: Illustration}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{c}
|
||||
\includegraphics[height=6.5cm]{./images/log_trans.png}
|
||||
|
||||
\end{tabular}
|
||||
\caption{Samples}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
|
||||
|
||||
\subsection{Exponential transformation}
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{(Inverse-log) Exponential transformation: Math}
|
||||
\begin{itemize}
|
||||
\item $g(x,y) = a \times e^{f(x,y)} + b$
|
||||
\item Where, $a$ and $b$: pre-defined parameters
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
|
||||
\begin{block}{Exponential function}
|
||||
\begin{tikzpicture}[scale=0.5]
|
||||
\begin{axis}[grid=both,
|
||||
xmax=4,ymax=10,
|
||||
axis lines=middle,
|
||||
restrict y to domain=-1:10,
|
||||
enlargelimits]
|
||||
\addplot[blue] {pow(e,x)} node[above]{$y=e^x$};
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
|
||||
\begin{itemize}
|
||||
\item a small value $(x)$ $\rightarrow$ mapped to a larger value $e^x$
|
||||
\item a small distance between two intensities in the input $\rightarrow$ mapped to a larger distance in the output image
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
|
||||
\begin{block}{Exponential transformation: Applications}
|
||||
\begin{itemize}
|
||||
\item map small differences between two intensities in the input to a larger differences in the output image (\textbf{contrast input images })
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
|
||||
\begin{block}{Exponential transformation: with Matlab}
|
||||
\lstset{language=Matlab, basicstyle=\small, escapeinside={\%*}{*)}}
|
||||
\begin{lstlisting}
|
||||
%read input image
|
||||
path = 'coffebean.png'
|
||||
im = imread(path); %range [0->255]
|
||||
%convert double image: [0->1]
|
||||
im = im2double(im);
|
||||
%set parameters
|
||||
a = 1; b = -1;
|
||||
%transform input image
|
||||
im1 = a * exp(im) + b;
|
||||
%normalize the output, to [0->1]
|
||||
im1 = im1./max(im1(:));
|
||||
\end{lstlisting}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
|
||||
\begin{block}{Exponential transformation: with Matlab (continued)}
|
||||
\lstset{language=Matlab, basicstyle=\small, escapeinside={\%*}{*)}}
|
||||
\begin{lstlisting}
|
||||
%show image
|
||||
figure; imshow(im); title('input image');
|
||||
figure; imshow(im1); title('output image');
|
||||
\end{lstlisting}
|
||||
\end{block}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{cc}
|
||||
\includegraphics[height=4cm]{./images/coffeebean.png} &
|
||||
\includegraphics[height=4cm]{./images/coffeebean1.png} \\
|
||||
Input image & output image
|
||||
|
||||
\end{tabular}
|
||||
\caption{$g(x,y) = a \times e^{f(x,y)} + b$; where, $a = 1, b = -1$}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
|
||||
\end{frame}
|
||||
|
||||
|
||||
\subsection{Power-law transformation}
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Power-law transformation: Math}
|
||||
\begin{itemize}
|
||||
\item $g(x,y) = a \times f(x,y)^{\gamma} + b$
|
||||
\item Where, $a$ and $b$: pre-defined parameters
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
|
||||
\begin{block}{Power function}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{c}
|
||||
\includegraphics[height=5cm]{./images/gamma_func.png}
|
||||
\end{tabular}
|
||||
%\caption{$f(x)= x^{\gamma}$}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Power-law function: characteristics}
|
||||
\begin{itemize}
|
||||
\item Depend on $\gamma$, power-law transformation can be either
|
||||
\begin{enumerate}
|
||||
\item \textbf{linear transformation}: for $\gamma = 1$
|
||||
\item \textbf{log transformation}: for $\gamma < 1$
|
||||
\item \textbf{inverse-log transformation}: for $\gamma > 1$
|
||||
\end{enumerate}
|
||||
|
||||
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Point processing}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Power-law transformation: Illustration}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{c}
|
||||
\includegraphics[width=9.5cm]{./images/power_law_trans.png}
|
||||
\end{tabular}
|
||||
%\caption{$f(x)= x^{\gamma}$}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\section{Histogram}
|
||||
\subsection{Definition}
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Definition}
|
||||
\textbf{Histogram} computed for image I is a \textbf{statistical quantity}, contains the following information
|
||||
\begin{itemize}
|
||||
\item number of pixels in I for each intensity (for each value in [0,255]). This kind of histogram is referred to as \textbf{unnormalized histogram}.
|
||||
\begin{itemize}
|
||||
\item Sum of all values in this kind of histogram = total number of pixels in I
|
||||
\end{itemize}
|
||||
\item \textcolor{red}{probability distribution of intensities in image I}. This kind of histogram is referred to as \textbf{normalized histogram}.
|
||||
\begin{itemize}
|
||||
\item Sum of all values in this kind of histogram = 1
|
||||
\end{itemize}
|
||||
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram}
|
||||
\selectlanguage{english}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{cc}
|
||||
\includegraphics[height=4cm]{./images/bean1.jpg} &
|
||||
\includegraphics[height=4cm]{./images/histogram1.png} \\
|
||||
(a) An image & (b) Its Histogram
|
||||
\end{tabular}
|
||||
%\caption{Image and Its histogram}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\begin{itemize}
|
||||
\item From histogram (b): almost of pixels in the image have the intensity near $0$. Therefore, the image is too dark, confirmed by image (a).
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram}
|
||||
\selectlanguage{english}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{cc}
|
||||
\includegraphics[height=4cm]{./images/bean2.jpg} &
|
||||
\includegraphics[height=4cm]{./images/histogram2.png} \\
|
||||
(a) An image & (b) Its Histogram
|
||||
\end{tabular}
|
||||
%\caption{Image and Its histogram}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\begin{itemize}
|
||||
\item From histogram (b): almost of pixels in the image have the intensity near $255$. Therefore, the image is too bright, confirmed by image (a).
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram}
|
||||
\selectlanguage{english}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{cc}
|
||||
\includegraphics[height=4cm]{./images/bean3.jpg} &
|
||||
\includegraphics[height=4cm]{./images/histogram3.png} \\
|
||||
(a) An image & (b) Its Histogram
|
||||
\end{tabular}
|
||||
%\caption{Image and Its histogram}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\begin{itemize}
|
||||
\item From histogram (b): almost of pixels in the image have the intensity compacted in short range $[100, 130]$. Therefore, the image has very low contrast, confirmed by image (a).
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram}
|
||||
\selectlanguage{english}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{cc}
|
||||
\includegraphics[height=4cm]{./images/bean4.jpg} &
|
||||
\includegraphics[height=4cm]{./images/histogram4.png} \\
|
||||
(a) An image & (b) Its Histogram
|
||||
\end{tabular}
|
||||
%\caption{Image and Its histogram}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\begin{itemize}
|
||||
\item From histogram (b): the pixels in the image are distributed in a full range $[0,255]$. Therefore, the image is balanced (not to dark, not to bright) and has a high contrast (\textbf{preferred}).
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\subsection{Computation}
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Histogram: with C/C++/Java}
|
||||
Excercise:
|
||||
\begin{itemize}
|
||||
\item Write a function for computing the histogram (unnormalized and normalized) of the input image passed to the function.
|
||||
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Histogram: with Matlab}
|
||||
\begin{itemize}
|
||||
\item use functions: \textbf{imhist}
|
||||
\end{itemize}
|
||||
\lstset{language=Matlab, basicstyle=\small, escapeinside={\%*}{*)}}
|
||||
\begin{lstlisting}
|
||||
%read input images
|
||||
path1 = 'Fig3.15(a)1.jpg';
|
||||
path2 = 'Fig3.15(a)2.jpg';
|
||||
path3 = 'Fig3.15(a)3.jpg';
|
||||
path4 = 'Fig3.15(a)4.jpg';
|
||||
im1 = imread(path1);
|
||||
im2 = imread(path2);
|
||||
im3 = imread(path3);
|
||||
im4 = imread(path4);
|
||||
|
||||
%Compute histogram
|
||||
[count1, x1] = imhist(im1);
|
||||
[count2, x2] = imhist(im2);
|
||||
[count3, x3] = imhist(im3);
|
||||
[count4, x4] = imhist(im4);
|
||||
\end{lstlisting}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Histogram: with Matlab (continued)}
|
||||
\lstset{language=Matlab, basicstyle=\small, escapeinside={\%*}{*)}}
|
||||
\begin{lstlisting}
|
||||
%show input images
|
||||
figure; imshow(im1); title('input image 1');
|
||||
figure; imshow(im2); title('input image 2');
|
||||
figure; imshow(im3); title('input image 3');
|
||||
figure; imshow(im4); title('input image 4');
|
||||
|
||||
%draw histograms
|
||||
figure; stem(x1, count1, '.');
|
||||
xlim([0,255]); title('histogram 1');
|
||||
figure; stem(x2, count2, '.');
|
||||
xlim([0,255]); title('histogram 2');
|
||||
figure; stem(x3, count3, '.');
|
||||
xlim([0,255]); title('histogram 3');
|
||||
figure; stem(x4, count4, '.');
|
||||
xlim([0,255]); title('histogram 4');
|
||||
\end{lstlisting}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\subsection{Equalization}
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram: Equalization}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Histogram Equalization: What?}
|
||||
\textbf{Histogram Equalization} is an operation to create an image (from a given image) whose pixels's value distributed uniformly in $[0,255]$
|
||||
\begin{itemize}
|
||||
\item Purpose of histogram equalization: to create image not too dark, not too bright, and high contrast
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{cc}
|
||||
\includegraphics[height=4cm]{./images/bean1.jpg} &
|
||||
\includegraphics[height=3.5cm]{./images/histogram1_norm.png} \\
|
||||
(a) An image & (b) Its normalized histogram \\
|
||||
(\textcolor{red}{not preferred}) & (\textcolor{red}{not preferred})
|
||||
\end{tabular}
|
||||
%\caption{Image and Its histogram}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram: Equalization}
|
||||
\selectlanguage{english}
|
||||
\begin{block}{Histogram Equalization: What?}
|
||||
\textbf{Histogram Equalization} is an operation to create an image (from a given image) whose pixels's value distributed uniformly in $[0,255]$
|
||||
\begin{itemize}
|
||||
\item Purpose of histogram equalization: to create image not too dark, not too bright, and high contrast
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\begin{figure}[!h]
|
||||
\begin{table}
|
||||
\begin{tabular}{cc}
|
||||
\includegraphics[height=4cm]{./images/bean1_eq.png} &
|
||||
\includegraphics[height=3.5cm]{./images/histogram1_eq_norm.png} \\
|
||||
(a) Image, \textcolor{red}{ preferred} & (b) Histogram, \textcolor{red}{ preferred} \\
|
||||
(after equalization) & (after equalization)
|
||||
|
||||
\end{tabular}
|
||||
%\caption{Image and Its histogram}
|
||||
\end{table}
|
||||
\end{figure}
|
||||
\end{frame}
|
||||
|
||||
|
||||
\subsection{Specification}
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram: Equalization}
|
||||
\selectlanguage{english}
|
||||
|
||||
\begin{block}{Histogram Equalization: How?}
|
||||
Input:
|
||||
\begin{enumerate}
|
||||
\item Input image I
|
||||
\begin{itemize}
|
||||
\item So, compute the \textbf{normalized-histogram} of image I, to obtain: $p_x(x)$:
|
||||
\end{itemize}
|
||||
\item Expected \textbf{normalized-histogram} of the output image: $p_z(z)$
|
||||
\begin{itemize}
|
||||
\item with histogram equalization: $p_z(z)$ is a uniform distribution over $[0,255]$
|
||||
\item with histogram specification: $p_z(z)$ is specified by users (interactively)
|
||||
\end{itemize}
|
||||
\end{enumerate}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram: Equalization}
|
||||
\selectlanguage{english}
|
||||
|
||||
\begin{block}{Histogram Equalization: How?}
|
||||
We can determine $z$ (e.g., pixel value of the output image), if we know:
|
||||
\begin{enumerate}
|
||||
\item $x$: pixel value of the input image
|
||||
\item $p_x(x)$: pdf of $x$
|
||||
\item $p_z(z)$: pdf of $z$
|
||||
\end{enumerate}
|
||||
|
||||
Assume that $z = f(x)$ has been determined, the output image $g(u,v)$ can be produced from the input $f(u,v)$ as follows:
|
||||
\begin{itemize}
|
||||
\item \textbf{foreach} point $(u,v)$ in $f(u,v)$:
|
||||
\begin{itemize}
|
||||
\item $x = f(u,v)$ (get the value of the input pixel)
|
||||
\item $z = f(x)$ (map to the output value)
|
||||
\item $g(u,v) = z$ (assign to the output pixel)
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram: Equalization}
|
||||
\selectlanguage{english}
|
||||
|
||||
\begin{block}{Determination of $z = f(x)$ }
|
||||
Let $c_x(x)$ and $c_z(z)$ be cumulative density functions of $x$ and $z$.
|
||||
|
||||
\begin{align}
|
||||
\nonumber
|
||||
c_x(x) &= \sum_{i=0}^{x}{p_x(i)}\\
|
||||
\nonumber
|
||||
c_z(z) &= \sum_{i=0}^{z}{p_z(i)}
|
||||
\end{align}
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram: Equalization}
|
||||
\selectlanguage{english}
|
||||
|
||||
$z = f(x)$ be a function that map one-to-one between $x$ and $z$.
|
||||
\begin{block}{Determination of $z = f(x)$ }
|
||||
\begin{itemize}
|
||||
\item Assume that we have $z_1 = f(x_1)$
|
||||
\item Then, $c_z(z_1) = c_x(x_1)$. This is because of one-one mapping
|
||||
\begin{itemize}
|
||||
\item A value $x < x_1$ will be mapped into $z < z_1$
|
||||
\end{itemize}
|
||||
\item Define $w \equiv c_x(x_1)$, i.e., $w \equiv c_z(z_1) \equiv c_x(x_1)$
|
||||
\end{itemize}
|
||||
|
||||
Therefore,
|
||||
\begin{itemize}
|
||||
\item $z_1 = c_z^{-1}(w) \equiv c_z^{-1}(c_x(x_1))$
|
||||
\end{itemize}
|
||||
\end{block}
|
||||
\begin{alertblock}{Mapping function $f(x)$}
|
||||
\centering
|
||||
$z = f(x) = c_z^{-1}(c_x(x))$
|
||||
|
||||
\end{alertblock}
|
||||
|
||||
\end{frame}
|
||||
|
||||
|
||||
\begin{frame}[fragile]
|
||||
\frametitle{Histogram: Equalization}
|
||||
\selectlanguage{english}
|
||||
|
||||
\begin{block}{Implemtation of $z = f(x) = c_z^{-1}(c_x(x))$}
|
||||
\begin{enumerate}
|
||||
\item If we have closed-form of $z = c_z^{-1}(w)$ then can use this function to determine $z$.
|
||||
\item If we do not have closed-form of $c_z^{-1}(z)$
|
||||
\begin{itemize}
|
||||
\item Create a lookup table at the beginning for mapping $z \rightarrow c_z^{-1}(p)$, for discrete values $p$. We can do this because we know $c_z(z)$ in advance. This task is equal to rasterize $p = c_z(z)$ and store pairs into lookup table
|
||||
\item Determine $z$ according to the lookup table.
|
||||
\end{itemize}
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
\end{block}
|
||||
\end{frame}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\end{document}
|
BIN
resource/Sources/PointProcessing/Linear_trans.png
Normal file
After Width: | Height: | Size: 336 KiB |
BIN
resource/Sources/PointProcessing/_DS_Store
Normal file
BIN
resource/Sources/PointProcessing/hcmut.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
resource/Sources/PointProcessing/images/bean1.jpg
Normal file
After Width: | Height: | Size: 97 KiB |
BIN
resource/Sources/PointProcessing/images/bean1_eq.png
Normal file
After Width: | Height: | Size: 123 KiB |
BIN
resource/Sources/PointProcessing/images/bean2.jpg
Normal file
After Width: | Height: | Size: 132 KiB |
BIN
resource/Sources/PointProcessing/images/bean3.jpg
Normal file
After Width: | Height: | Size: 85 KiB |
BIN
resource/Sources/PointProcessing/images/bean4.jpg
Normal file
After Width: | Height: | Size: 146 KiB |
BIN
resource/Sources/PointProcessing/images/cameraman.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
resource/Sources/PointProcessing/images/cameraman1.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
resource/Sources/PointProcessing/images/cameraman2.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
resource/Sources/PointProcessing/images/cameraman3.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
resource/Sources/PointProcessing/images/coffeebean.png
Normal file
After Width: | Height: | Size: 90 KiB |
BIN
resource/Sources/PointProcessing/images/coffeebean1.png
Normal file
After Width: | Height: | Size: 103 KiB |
BIN
resource/Sources/PointProcessing/images/gamma_func.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
resource/Sources/PointProcessing/images/histogram1.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
resource/Sources/PointProcessing/images/histogram1_eq_norm.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
resource/Sources/PointProcessing/images/histogram1_norm.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
resource/Sources/PointProcessing/images/histogram2.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
resource/Sources/PointProcessing/images/histogram3.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
resource/Sources/PointProcessing/images/histogram4.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
resource/Sources/PointProcessing/images/linear_negative.png
Normal file
After Width: | Height: | Size: 102 KiB |
BIN
resource/Sources/PointProcessing/images/log_trans.png
Normal file
After Width: | Height: | Size: 481 KiB |
BIN
resource/Sources/PointProcessing/images/negative_demo.png
Normal file
After Width: | Height: | Size: 405 KiB |
BIN
resource/Sources/PointProcessing/images/power_law_trans.png
Normal file
After Width: | Height: | Size: 432 KiB |
236
resource/Sources/PointProcessing/ipcv-style.tex
Normal file
@ -0,0 +1,236 @@
|
||||
% Copyright 2007 by Till Tantau
|
||||
%
|
||||
% This file may be distributed and/or modified
|
||||
%
|
||||
% 1. under the LaTeX Project Public License and/or
|
||||
% 2. under the GNU Public License.
|
||||
%
|
||||
% See the file doc/licenses/LICENSE for more details.
|
||||
|
||||
|
||||
% Common packages
|
||||
\usepackage[utf8x]{inputenc}
|
||||
\usepackage[vietnam,english]{babel}
|
||||
\usepackage[utf8]{vietnam}
|
||||
%\usepackage{times}
|
||||
\usefonttheme[onlymath]{serif}
|
||||
\usecolortheme{default}
|
||||
\usepackage{booktabs}
|
||||
\usepackage{mathpartir}
|
||||
\usepackage{listings}
|
||||
\usepackage{listingsutf8}
|
||||
|
||||
\usepackage{pbox}
|
||||
\mprset{flushleft}
|
||||
\mode<article>
|
||||
{
|
||||
\usepackage{times}
|
||||
\usepackage{mathptmx}
|
||||
\usepackage[left=1.5cm,right=6cm,top=1.5cm,bottom=3cm]{geometry}
|
||||
}
|
||||
|
||||
\usepackage{hyperref}
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{arrows,backgrounds}
|
||||
%\tikzstyle{mnode}=[circle, draw, fill=black, inner sep=0pt, minimum width=4pt]
|
||||
\usepackage{colortbl}
|
||||
%\usepackage{yfonts}
|
||||
\usepackage{translator} % comment this, if not available
|
||||
|
||||
|
||||
% Common settings for all lectures in this course
|
||||
|
||||
\def\lecturename{Image Processing and Computer Vision}
|
||||
|
||||
\title{\insertlecture}
|
||||
|
||||
\author{\textbf{LE Thanh Sach}}
|
||||
|
||||
\institute
|
||||
{
|
||||
\textit{Faculty of Computer Science and Engineering}\\
|
||||
\textit{Ho Chi Minh University of Technology, VNU-HCM}
|
||||
}
|
||||
|
||||
\subject{Lecturer \lecturename}
|
||||
|
||||
% Beamer version theme settings
|
||||
|
||||
\useoutertheme[height=0pt,width=2cm,right]{sidebar}
|
||||
\usecolortheme{rose,sidebartab}
|
||||
\useinnertheme{circles}
|
||||
\usefonttheme[only large]{structurebold}
|
||||
|
||||
\setbeamercolor{sidebar right}{bg=black!15}
|
||||
\setbeamercolor{structure}{fg=blue}
|
||||
\setbeamercolor{author}{parent=structure}
|
||||
|
||||
\setbeamerfont{title}{series=\normalfont,size=\LARGE}
|
||||
\setbeamerfont{title in sidebar}{series=\bfseries}
|
||||
\setbeamerfont{author in sidebar}{series=\bfseries}
|
||||
\setbeamerfont*{item}{series=}
|
||||
\setbeamerfont{frametitle}{size=}
|
||||
\setbeamerfont{block title}{size=\small}
|
||||
\setbeamerfont{subtitle}{size=\normalsize,series=\normalfont}
|
||||
|
||||
\setbeamertemplate{navigation symbols}{}
|
||||
\setbeamertemplate{bibliography item}[book]
|
||||
\setbeamertemplate{sidebar right}
|
||||
{
|
||||
{\usebeamerfont{title in sidebar}%
|
||||
\vskip1.5em%
|
||||
\hskip3pt%
|
||||
\usebeamercolor[fg]{title in sidebar}%
|
||||
\insertshorttitle[width=2cm,center,respectlinebreaks]\par%
|
||||
\vskip1.25em%
|
||||
}%
|
||||
{%
|
||||
\hskip3pt%
|
||||
\usebeamercolor[fg]{author in sidebar}%
|
||||
\usebeamerfont{author in sidebar}%
|
||||
\insertshortauthor[width=2cm,center,respectlinebreaks]\par%
|
||||
\vskip1.25em%
|
||||
}%
|
||||
\hbox to2cm{\hss\insertlogo\hss}
|
||||
\vskip1.25em%
|
||||
\insertverticalnavigation{2cm}%
|
||||
\vfill
|
||||
\hbox to 2cm{\hfill\usebeamerfont{subsection in
|
||||
sidebar}\strut\usebeamercolor[fg]{subsection in
|
||||
sidebar}\insertshortlecture.\insertframenumber\hskip5pt}%
|
||||
\vskip3pt%
|
||||
}%
|
||||
|
||||
\setbeamertemplate{title page}
|
||||
{
|
||||
\vbox{}
|
||||
\vskip1em
|
||||
{\huge Chapter \insertshortlecture\par}
|
||||
{\usebeamercolor[fg]{title}\usebeamerfont{title}\inserttitle\par}%
|
||||
\ifx\insertsubtitle\@empty%
|
||||
\else%
|
||||
\vskip0.25em%
|
||||
{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
|
||||
\fi%
|
||||
\vskip1em\par
|
||||
\emph{\lecturename}\
|
||||
%on \insertdate\par
|
||||
\vskip3em\par
|
||||
|
||||
\leftskip=0pt plus1fill\insertauthor\par
|
||||
\insertinstitute\vskip1em
|
||||
}
|
||||
|
||||
\logo{\includegraphics[width=1.5cm]{hcmut.png}}
|
||||
|
||||
|
||||
|
||||
% Article version layout settings
|
||||
|
||||
\mode<article>
|
||||
|
||||
\makeatletter
|
||||
\def\@listI{\leftmargin\leftmargini
|
||||
\parsep 0pt
|
||||
\topsep 5\p@ \@plus3\p@ \@minus5\p@
|
||||
\itemsep0pt}
|
||||
\let\@listi=\@listI
|
||||
|
||||
|
||||
\setbeamertemplate{frametitle}{\paragraph*{\insertframetitle\
|
||||
\ \small\insertframesubtitle}\ \par
|
||||
}
|
||||
\setbeamertemplate{frame end}{%
|
||||
\marginpar{\scriptsize\hbox to 1cm{\sffamily%
|
||||
\hfill\strut\insertshortlecture.\insertframenumber}\hrule height .2pt}}
|
||||
\setlength{\marginparwidth}{1cm}
|
||||
\setlength{\marginparsep}{4.5cm}
|
||||
|
||||
\def\@maketitle{\makechapter}
|
||||
|
||||
\def\makechapter{
|
||||
\newpage
|
||||
\null
|
||||
\vskip 2em%
|
||||
{%
|
||||
\parindent=0pt
|
||||
\raggedright
|
||||
\sffamily
|
||||
\vskip8pt
|
||||
{\fontsize{36pt}{36pt}\selectfont Chapter \insertshortlecture \par\vskip2pt}
|
||||
{\fontsize{24pt}{28pt}\selectfont \color{blue!50!black} \insertlecture\par\vskip4pt}
|
||||
{\Large\selectfont \color{blue!50!black} \insertsubtitle\par}
|
||||
\vskip10pt
|
||||
|
||||
\normalsize\selectfont Print version of
|
||||
Lecturer \emph{\lecturename} of \@date\par\vskip1.5em
|
||||
%\hfill Le Thanh Sach and Luong The Nhan, Faculty of CSE, HCMC University of Technology
|
||||
}
|
||||
\par
|
||||
\vskip 1.5em%
|
||||
}
|
||||
|
||||
\let\origstartsection=\@startsection
|
||||
\def\@startsection#1#2#3#4#5#6{%
|
||||
\origstartsection{#1}{#2}{#3}{#4}{#5}{#6\normalfont\sffamily\color{blue!50!black}\selectfont}}
|
||||
|
||||
\makeatother
|
||||
|
||||
\mode
|
||||
<all>
|
||||
|
||||
|
||||
|
||||
|
||||
% Typesetting Listings
|
||||
|
||||
\usepackage{listings}
|
||||
\lstset{language=Java}
|
||||
|
||||
\alt<presentation>
|
||||
{\lstset{%
|
||||
basicstyle=\footnotesize\ttfamily,
|
||||
commentstyle=\slshape\color{green!50!black},
|
||||
keywordstyle=\bfseries\color{blue!50!black},
|
||||
identifierstyle=\color{blue},
|
||||
stringstyle=\color{orange},
|
||||
escapechar=\#,
|
||||
emphstyle=\color{red}}
|
||||
}
|
||||
{
|
||||
\lstset{%
|
||||
basicstyle=\ttfamily,
|
||||
keywordstyle=\bfseries,
|
||||
commentstyle=\itshape,
|
||||
escapechar=\#,
|
||||
emphstyle=\bfseries\color{red}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
% Common theorem-like environments
|
||||
|
||||
\theoremstyle{example}
|
||||
\newtheorem{exercise}[theorem]{\translate{Exercise}}
|
||||
|
||||
|
||||
% New useful definitions:
|
||||
|
||||
\newbox\mytempbox
|
||||
\newdimen\mytempdimen
|
||||
|
||||
\newcommand\includegraphicscopyright[3][]{%
|
||||
\leavevmode\vbox{\vskip3pt\raggedright\setbox\mytempbox=\hbox{\includegraphics[#1]{#2}}%
|
||||
\mytempdimen=\wd\mytempbox\box\mytempbox\par\vskip1pt%
|
||||
\fontsize{3}{3.5}\selectfont{\color{black!25}{\vbox{\hsize=\mytempdimen#3}}}\vskip3pt%
|
||||
}}
|
||||
|
||||
\newenvironment{colortabular}[1]{\medskip\rowcolors[]{1}{blue!20}{blue!10}\tabular{#1}\rowcolor{blue!40}}{\endtabular\medskip}
|
||||
|
||||
\def\equad{\leavevmode\hbox{}\quad}
|
||||
|
||||
\newenvironment{greencolortabular}[1]
|
||||
{\medskip\rowcolors[]{1}{green!50!black!20}{green!50!black!10}%
|
||||
\tabular{#1}\rowcolor{green!50!black!40}}%
|
||||
{\endtabular\medskip}
|
446
resource/Sources/PointProcessing/mathpartir.sty
Normal file
@ -0,0 +1,446 @@
|
||||
% Mathpartir --- Math Paragraph for Typesetting Inference Rules
|
||||
%
|
||||
% Copyright (C) 2001, 2002, 2003, 2004, 2005 Didier R<>my
|
||||
%
|
||||
% Author : Didier Remy
|
||||
% Version : 1.2.0
|
||||
% Bug Reports : to author
|
||||
% Web Site : http://pauillac.inria.fr/~remy/latex/
|
||||
%
|
||||
% Mathpartir is free software; you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation; either version 2, or (at your option)
|
||||
% any later version.
|
||||
%
|
||||
% Mathpartir is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details
|
||||
% (http://pauillac.inria.fr/~remy/license/GPL).
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% File mathpartir.sty (LaTeX macros)
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{mathpartir}
|
||||
[2005/12/20 version 1.2.0 Math Paragraph for Typesetting Inference Rules]
|
||||
|
||||
%%
|
||||
|
||||
%% Identification
|
||||
%% Preliminary declarations
|
||||
|
||||
\RequirePackage {keyval}
|
||||
|
||||
%% Options
|
||||
%% More declarations
|
||||
|
||||
%% PART I: Typesetting maths in paragraphe mode
|
||||
|
||||
%% \newdimen \mpr@tmpdim
|
||||
%% Dimens are a precious ressource. Uses seems to be local.
|
||||
\let \mpr@tmpdim \@tempdima
|
||||
|
||||
% To ensure hevea \hva compatibility, \hva should expands to nothing
|
||||
% in mathpar or in inferrule
|
||||
\let \mpr@hva \empty
|
||||
|
||||
%% normal paragraph parametters, should rather be taken dynamically
|
||||
\def \mpr@savepar {%
|
||||
\edef \MathparNormalpar
|
||||
{\noexpand \lineskiplimit \the\lineskiplimit
|
||||
\noexpand \lineskip \the\lineskip}%
|
||||
}
|
||||
|
||||
\def \mpr@rulelineskip {\lineskiplimit=0.3em\lineskip=0.2em plus 0.1em}
|
||||
\def \mpr@lesslineskip {\lineskiplimit=0.6em\lineskip=0.5em plus 0.2em}
|
||||
\def \mpr@lineskip {\lineskiplimit=1.2em\lineskip=1.2em plus 0.2em}
|
||||
\let \MathparLineskip \mpr@lineskip
|
||||
\def \mpr@paroptions {\MathparLineskip}
|
||||
\let \mpr@prebindings \relax
|
||||
|
||||
\newskip \mpr@andskip \mpr@andskip 2em plus 0.5fil minus 0.5em
|
||||
|
||||
\def \mpr@goodbreakand
|
||||
{\hskip -\mpr@andskip \penalty -1000\hskip \mpr@andskip}
|
||||
\def \mpr@and {\hskip \mpr@andskip}
|
||||
\def \mpr@andcr {\penalty 50\mpr@and}
|
||||
\def \mpr@cr {\penalty -10000\mpr@and}
|
||||
\def \mpr@eqno #1{\mpr@andcr #1\hskip 0em plus -1fil \penalty 10}
|
||||
|
||||
\def \mpr@bindings {%
|
||||
\let \and \mpr@andcr
|
||||
\let \par \mpr@andcr
|
||||
\let \\\mpr@cr
|
||||
\let \eqno \mpr@eqno
|
||||
\let \hva \mpr@hva
|
||||
}
|
||||
\let \MathparBindings \mpr@bindings
|
||||
|
||||
% \@ifundefined {ignorespacesafterend}
|
||||
% {\def \ignorespacesafterend {\aftergroup \ignorespaces}
|
||||
|
||||
\newenvironment{mathpar}[1][]
|
||||
{$$\mpr@savepar \parskip 0em \hsize \linewidth \centering
|
||||
\vbox \bgroup \mpr@prebindings \mpr@paroptions #1\ifmmode $\else
|
||||
\noindent $\displaystyle\fi
|
||||
\MathparBindings}
|
||||
{\unskip \ifmmode $\fi\egroup $$\ignorespacesafterend}
|
||||
|
||||
\newenvironment{mathparpagebreakable}[1][]
|
||||
{\begingroup
|
||||
\par
|
||||
\mpr@savepar \parskip 0em \hsize \linewidth \centering
|
||||
\mpr@prebindings \mpr@paroptions #1%
|
||||
\vskip \abovedisplayskip \vskip -\lineskip%
|
||||
\ifmmode \else $\displaystyle\fi
|
||||
\MathparBindings
|
||||
}
|
||||
{\unskip
|
||||
\ifmmode $\fi \par\endgroup
|
||||
\vskip \belowdisplayskip
|
||||
\noindent
|
||||
\ignorespacesafterend}
|
||||
|
||||
% \def \math@mathpar #1{\setbox0 \hbox {$\displaystyle #1$}\ifnum
|
||||
% \wd0 < \hsize $$\box0$$\else \bmathpar #1\emathpar \fi}
|
||||
|
||||
%%% HOV BOXES
|
||||
|
||||
\def \mathvbox@ #1{\hbox \bgroup \mpr@normallineskip
|
||||
\vbox \bgroup \tabskip 0em \let \\ \cr
|
||||
\halign \bgroup \hfil $##$\hfil\cr #1\crcr \egroup \egroup
|
||||
\egroup}
|
||||
|
||||
\def \mathhvbox@ #1{\setbox0 \hbox {\let \\\qquad $#1$}\ifnum \wd0 < \hsize
|
||||
\box0\else \mathvbox {#1}\fi}
|
||||
|
||||
|
||||
%% Part II -- operations on lists
|
||||
|
||||
\newtoks \mpr@lista
|
||||
\newtoks \mpr@listb
|
||||
|
||||
\long \def\mpr@cons #1\mpr@to#2{\mpr@lista {\\{#1}}\mpr@listb \expandafter
|
||||
{#2}\edef #2{\the \mpr@lista \the \mpr@listb}}
|
||||
|
||||
\long \def\mpr@snoc #1\mpr@to#2{\mpr@lista {\\{#1}}\mpr@listb \expandafter
|
||||
{#2}\edef #2{\the \mpr@listb\the\mpr@lista}}
|
||||
|
||||
\long \def \mpr@concat#1=#2\mpr@to#3{\mpr@lista \expandafter {#2}\mpr@listb
|
||||
\expandafter {#3}\edef #1{\the \mpr@listb\the\mpr@lista}}
|
||||
|
||||
\def \mpr@head #1\mpr@to #2{\expandafter \mpr@head@ #1\mpr@head@ #1#2}
|
||||
\long \def \mpr@head@ #1#2\mpr@head@ #3#4{\def #4{#1}\def#3{#2}}
|
||||
|
||||
\def \mpr@flatten #1\mpr@to #2{\expandafter \mpr@flatten@ #1\mpr@flatten@ #1#2}
|
||||
\long \def \mpr@flatten@ \\#1\\#2\mpr@flatten@ #3#4{\def #4{#1}\def #3{\\#2}}
|
||||
|
||||
\def \mpr@makelist #1\mpr@to #2{\def \mpr@all {#1}%
|
||||
\mpr@lista {\\}\mpr@listb \expandafter {\mpr@all}\edef \mpr@all {\the
|
||||
\mpr@lista \the \mpr@listb \the \mpr@lista}\let #2\empty
|
||||
\def \mpr@stripof ##1##2\mpr@stripend{\def \mpr@stripped{##2}}\loop
|
||||
\mpr@flatten \mpr@all \mpr@to \mpr@one
|
||||
\expandafter \mpr@snoc \mpr@one \mpr@to #2\expandafter \mpr@stripof
|
||||
\mpr@all \mpr@stripend
|
||||
\ifx \mpr@stripped \empty \let \mpr@isempty 0\else \let \mpr@isempty 1\fi
|
||||
\ifx 1\mpr@isempty
|
||||
\repeat
|
||||
}
|
||||
|
||||
\def \mpr@rev #1\mpr@to #2{\let \mpr@tmp \empty
|
||||
\def \\##1{\mpr@cons ##1\mpr@to \mpr@tmp}#1\let #2\mpr@tmp}
|
||||
|
||||
%% Part III -- Type inference rules
|
||||
|
||||
\newif \if@premisse
|
||||
\newbox \mpr@hlist
|
||||
\newbox \mpr@vlist
|
||||
\newif \ifmpr@center \mpr@centertrue
|
||||
\def \mpr@htovlist {%
|
||||
\setbox \mpr@hlist
|
||||
\hbox {\strut
|
||||
\ifmpr@center \hskip -0.5\wd\mpr@hlist\fi
|
||||
\unhbox \mpr@hlist}%
|
||||
\setbox \mpr@vlist
|
||||
\vbox {\if@premisse \box \mpr@hlist \unvbox \mpr@vlist
|
||||
\else \unvbox \mpr@vlist \box \mpr@hlist
|
||||
\fi}%
|
||||
}
|
||||
% OLD version
|
||||
% \def \mpr@htovlist {%
|
||||
% \setbox \mpr@hlist
|
||||
% \hbox {\strut \hskip -0.5\wd\mpr@hlist \unhbox \mpr@hlist}%
|
||||
% \setbox \mpr@vlist
|
||||
% \vbox {\if@premisse \box \mpr@hlist \unvbox \mpr@vlist
|
||||
% \else \unvbox \mpr@vlist \box \mpr@hlist
|
||||
% \fi}%
|
||||
% }
|
||||
|
||||
\def \mpr@item #1{$\displaystyle #1$}
|
||||
\def \mpr@sep{2em}
|
||||
\def \mpr@blank { }
|
||||
\def \mpr@hovbox #1#2{\hbox
|
||||
\bgroup
|
||||
\ifx #1T\@premissetrue
|
||||
\else \ifx #1B\@premissefalse
|
||||
\else
|
||||
\PackageError{mathpartir}
|
||||
{Premisse orientation should either be T or B}
|
||||
{Fatal error in Package}%
|
||||
\fi \fi
|
||||
\def \@test {#2}\ifx \@test \mpr@blank\else
|
||||
\setbox \mpr@hlist \hbox {}%
|
||||
\setbox \mpr@vlist \vbox {}%
|
||||
\if@premisse \let \snoc \mpr@cons \else \let \snoc \mpr@snoc \fi
|
||||
\let \@hvlist \empty \let \@rev \empty
|
||||
\mpr@tmpdim 0em
|
||||
\expandafter \mpr@makelist #2\mpr@to \mpr@flat
|
||||
\if@premisse \mpr@rev \mpr@flat \mpr@to \@rev \else \let \@rev \mpr@flat \fi
|
||||
\def \\##1{%
|
||||
\def \@test {##1}\ifx \@test \empty
|
||||
\mpr@htovlist
|
||||
\mpr@tmpdim 0em %%% last bug fix not extensively checked
|
||||
\else
|
||||
\setbox0 \hbox{\mpr@item {##1}}\relax
|
||||
\advance \mpr@tmpdim by \wd0
|
||||
%\mpr@tmpdim 1.02\mpr@tmpdim
|
||||
\ifnum \mpr@tmpdim < \hsize
|
||||
\ifnum \wd\mpr@hlist > 0
|
||||
\if@premisse
|
||||
\setbox \mpr@hlist
|
||||
\hbox {\unhbox0 \hskip \mpr@sep \unhbox \mpr@hlist}%
|
||||
\else
|
||||
\setbox \mpr@hlist
|
||||
\hbox {\unhbox \mpr@hlist \hskip \mpr@sep \unhbox0}%
|
||||
\fi
|
||||
\else
|
||||
\setbox \mpr@hlist \hbox {\unhbox0}%
|
||||
\fi
|
||||
\else
|
||||
\ifnum \wd \mpr@hlist > 0
|
||||
\mpr@htovlist
|
||||
\mpr@tmpdim \wd0
|
||||
\fi
|
||||
\setbox \mpr@hlist \hbox {\unhbox0}%
|
||||
\fi
|
||||
\advance \mpr@tmpdim by \mpr@sep
|
||||
\fi
|
||||
}%
|
||||
\@rev
|
||||
\mpr@htovlist
|
||||
\ifmpr@center \hskip \wd\mpr@vlist\fi \box \mpr@vlist
|
||||
\fi
|
||||
\egroup
|
||||
}
|
||||
|
||||
%%% INFERENCE RULES
|
||||
|
||||
\@ifundefined{@@over}{%
|
||||
\let\@@over\over % fallback if amsmath is not loaded
|
||||
\let\@@overwithdelims\overwithdelims
|
||||
\let\@@atop\atop \let\@@atopwithdelims\atopwithdelims
|
||||
\let\@@above\above \let\@@abovewithdelims\abovewithdelims
|
||||
}{}
|
||||
|
||||
%% The default
|
||||
|
||||
\def \mpr@@fraction #1#2{\hbox {\advance \hsize by -0.5em
|
||||
$\displaystyle {#1\mpr@over #2}$}}
|
||||
\def \mpr@@nofraction #1#2{\hbox {\advance \hsize by -0.5em
|
||||
$\displaystyle {#1\@@atop #2}$}}
|
||||
|
||||
\let \mpr@fraction \mpr@@fraction
|
||||
|
||||
%% A generic solution to arrow
|
||||
|
||||
\def \mpr@make@fraction #1#2#3#4#5{\hbox {%
|
||||
\def \mpr@tail{#1}%
|
||||
\def \mpr@body{#2}%
|
||||
\def \mpr@head{#3}%
|
||||
\setbox1=\hbox{$#4$}\setbox2=\hbox{$#5$}%
|
||||
\setbox3=\hbox{$\mkern -3mu\mpr@body\mkern -3mu$}%
|
||||
\setbox3=\hbox{$\mkern -3mu \mpr@body\mkern -3mu$}%
|
||||
\dimen0=\dp1\advance\dimen0 by \ht3\relax\dp1\dimen0\relax
|
||||
\dimen0=\ht2\advance\dimen0 by \dp3\relax\ht2\dimen0\relax
|
||||
\setbox0=\hbox {$\box1 \@@atop \box2$}%
|
||||
\dimen0=\wd0\box0
|
||||
\box0 \hskip -\dimen0\relax
|
||||
\hbox to \dimen0 {$%
|
||||
\mathrel{\mpr@tail}\joinrel
|
||||
\xleaders\hbox{\copy3}\hfil\joinrel\mathrel{\mpr@head}%
|
||||
$}}}
|
||||
|
||||
%% Old stuff should be removed in next version
|
||||
\def \mpr@@nothing #1#2
|
||||
{$\lower 0.01pt \mpr@@nofraction {#1}{#2}$}
|
||||
\def \mpr@@reduce #1#2{\hbox
|
||||
{$\lower 0.01pt \mpr@@fraction {#1}{#2}\mkern -15mu\rightarrow$}}
|
||||
\def \mpr@@rewrite #1#2#3{\hbox
|
||||
{$\lower 0.01pt \mpr@@fraction {#2}{#3}\mkern -8mu#1$}}
|
||||
\def \mpr@infercenter #1{\vcenter {\mpr@hovbox{T}{#1}}}
|
||||
|
||||
\def \mpr@empty {}
|
||||
\def \mpr@inferrule
|
||||
{\bgroup
|
||||
\ifnum \linewidth<\hsize \hsize \linewidth\fi
|
||||
\mpr@rulelineskip
|
||||
\let \and \qquad
|
||||
\let \hva \mpr@hva
|
||||
\let \@rulename \mpr@empty
|
||||
\let \@rule@options \mpr@empty
|
||||
\let \mpr@over \@@over
|
||||
\mpr@inferrule@}
|
||||
\newcommand {\mpr@inferrule@}[3][]
|
||||
{\everymath={\displaystyle}%
|
||||
\def \@test {#2}\ifx \empty \@test
|
||||
\setbox0 \hbox {$\vcenter {\mpr@hovbox{B}{#3}}$}%
|
||||
\else
|
||||
\def \@test {#3}\ifx \empty \@test
|
||||
\setbox0 \hbox {$\vcenter {\mpr@hovbox{T}{#2}}$}%
|
||||
\else
|
||||
\setbox0 \mpr@fraction {\mpr@hovbox{T}{#2}}{\mpr@hovbox{B}{#3}}%
|
||||
\fi \fi
|
||||
\def \@test {#1}\ifx \@test\empty \box0
|
||||
\else \vbox
|
||||
%%% Suggestion de Francois pour les etiquettes longues
|
||||
%%% {\hbox to \wd0 {\RefTirName {#1}\hfil}\box0}\fi
|
||||
{\hbox {\RefTirName {#1}}\box0}\fi
|
||||
\egroup}
|
||||
|
||||
\def \mpr@vdotfil #1{\vbox to #1{\leaders \hbox{$\cdot$} \vfil}}
|
||||
|
||||
% They are two forms
|
||||
% \inferrule [label]{[premisses}{conclusions}
|
||||
% or
|
||||
% \inferrule* [options]{[premisses}{conclusions}
|
||||
%
|
||||
% Premisses and conclusions are lists of elements separated by \\
|
||||
% Each \\ produces a break, attempting horizontal breaks if possible,
|
||||
% and vertical breaks if needed.
|
||||
%
|
||||
% An empty element obtained by \\\\ produces a vertical break in all cases.
|
||||
%
|
||||
% The former rule is aligned on the fraction bar.
|
||||
% The optional label appears on top of the rule
|
||||
% The second form to be used in a derivation tree is aligned on the last
|
||||
% line of its conclusion
|
||||
%
|
||||
% The second form can be parameterized, using the key=val interface. The
|
||||
% folloiwng keys are recognized:
|
||||
%
|
||||
% width set the width of the rule to val
|
||||
% narrower set the width of the rule to val\hsize
|
||||
% before execute val at the beginning/left
|
||||
% lab put a label [Val] on top of the rule
|
||||
% lskip add negative skip on the right
|
||||
% left put a left label [Val]
|
||||
% Left put a left label [Val], ignoring its width
|
||||
% right put a right label [Val]
|
||||
% Right put a right label [Val], ignoring its width
|
||||
% leftskip skip negative space on the left-hand side
|
||||
% rightskip skip negative space on the right-hand side
|
||||
% vdots lift the rule by val and fill vertical space with dots
|
||||
% after execute val at the end/right
|
||||
%
|
||||
% Note that most options must come in this order to avoid strange
|
||||
% typesetting (in particular leftskip must preceed left and Left and
|
||||
% rightskip must follow Right or right; vdots must come last
|
||||
% or be only followed by rightskip.
|
||||
%
|
||||
|
||||
%% Keys that make sence in all kinds of rules
|
||||
\def \mprset #1{\setkeys{mprset}{#1}}
|
||||
\define@key {mprset}{andskip}[]{\mpr@andskip=#1}
|
||||
\define@key {mprset}{lineskip}[]{\lineskip=#1}
|
||||
\define@key {mprset}{flushleft}[]{\mpr@centerfalse}
|
||||
\define@key {mprset}{center}[]{\mpr@centertrue}
|
||||
\define@key {mprset}{rewrite}[]{\let \mpr@fraction \mpr@@rewrite}
|
||||
\define@key {mprset}{atop}[]{\let \mpr@fraction \mpr@@nofraction}
|
||||
\define@key {mprset}{myfraction}[]{\let \mpr@fraction #1}
|
||||
\define@key {mprset}{fraction}[]{\def \mpr@fraction {\mpr@make@fraction #1}}
|
||||
\define@key {mprset}{sep}{\def\mpr@sep{#1}}
|
||||
|
||||
\newbox \mpr@right
|
||||
\define@key {mpr}{flushleft}[]{\mpr@centerfalse}
|
||||
\define@key {mpr}{center}[]{\mpr@centertrue}
|
||||
\define@key {mpr}{rewrite}[]{\let \mpr@fraction \mpr@@rewrite}
|
||||
\define@key {mpr}{myfraction}[]{\let \mpr@fraction #1}
|
||||
\define@key {mpr}{fraction}[]{\def \mpr@fraction {\mpr@make@fraction #1}}
|
||||
\define@key {mpr}{left}{\setbox0 \hbox {$\TirName {#1}\;$}\relax
|
||||
\advance \hsize by -\wd0\box0}
|
||||
\define@key {mpr}{width}{\hsize #1}
|
||||
\define@key {mpr}{sep}{\def\mpr@sep{#1}}
|
||||
\define@key {mpr}{before}{#1}
|
||||
\define@key {mpr}{lab}{\let \RefTirName \TirName \def \mpr@rulename {#1}}
|
||||
\define@key {mpr}{Lab}{\let \RefTirName \TirName \def \mpr@rulename {#1}}
|
||||
\define@key {mpr}{narrower}{\hsize #1\hsize}
|
||||
\define@key {mpr}{leftskip}{\hskip -#1}
|
||||
\define@key {mpr}{reduce}[]{\let \mpr@fraction \mpr@@reduce}
|
||||
\define@key {mpr}{rightskip}
|
||||
{\setbox \mpr@right \hbox {\unhbox \mpr@right \hskip -#1}}
|
||||
\define@key {mpr}{LEFT}{\setbox0 \hbox {$#1$}\relax
|
||||
\advance \hsize by -\wd0\box0}
|
||||
\define@key {mpr}{left}{\setbox0 \hbox {$\TirName {#1}\;$}\relax
|
||||
\advance \hsize by -\wd0\box0}
|
||||
\define@key {mpr}{Left}{\llap{$\TirName {#1}\;$}}
|
||||
\define@key {mpr}{right}
|
||||
{\setbox0 \hbox {$\;\TirName {#1}$}\relax \advance \hsize by -\wd0
|
||||
\setbox \mpr@right \hbox {\unhbox \mpr@right \unhbox0}}
|
||||
\define@key {mpr}{RIGHT}
|
||||
{\setbox0 \hbox {$#1$}\relax \advance \hsize by -\wd0
|
||||
\setbox \mpr@right \hbox {\unhbox \mpr@right \unhbox0}}
|
||||
\define@key {mpr}{Right}
|
||||
{\setbox \mpr@right \hbox {\unhbox \mpr@right \rlap {$\;\TirName {#1}$}}}
|
||||
\define@key {mpr}{vdots}{\def \mpr@vdots {\@@atop \mpr@vdotfil{#1}}}
|
||||
\define@key {mpr}{after}{\edef \mpr@after {\mpr@after #1}}
|
||||
|
||||
\newcommand \mpr@inferstar@ [3][]{\setbox0
|
||||
\hbox {\let \mpr@rulename \mpr@empty \let \mpr@vdots \relax
|
||||
\setbox \mpr@right \hbox{}%
|
||||
$\setkeys{mpr}{#1}%
|
||||
\ifx \mpr@rulename \mpr@empty \mpr@inferrule {#2}{#3}\else
|
||||
\mpr@inferrule [{\mpr@rulename}]{#2}{#3}\fi
|
||||
\box \mpr@right \mpr@vdots$}
|
||||
\setbox1 \hbox {\strut}
|
||||
\@tempdima \dp0 \advance \@tempdima by -\dp1
|
||||
\raise \@tempdima \box0}
|
||||
|
||||
\def \mpr@infer {\@ifnextchar *{\mpr@inferstar}{\mpr@inferrule}}
|
||||
\newcommand \mpr@err@skipargs[3][]{}
|
||||
\def \mpr@inferstar*{\ifmmode
|
||||
\let \@do \mpr@inferstar@
|
||||
\else
|
||||
\let \@do \mpr@err@skipargs
|
||||
\PackageError {mathpartir}
|
||||
{\string\inferrule* can only be used in math mode}{}%
|
||||
\fi \@do}
|
||||
|
||||
|
||||
%%% Exports
|
||||
|
||||
% Envirnonment mathpar
|
||||
|
||||
\let \inferrule \mpr@infer
|
||||
|
||||
% make a short name \infer is not already defined
|
||||
\@ifundefined {infer}{\let \infer \mpr@infer}{}
|
||||
|
||||
\def \TirNameStyle #1{\small \textsc{#1}}
|
||||
\def \tir@name #1{\hbox {\small \TirNameStyle{#1}}}
|
||||
\let \TirName \tir@name
|
||||
\let \DefTirName \TirName
|
||||
\let \RefTirName \TirName
|
||||
|
||||
%%% Other Exports
|
||||
|
||||
% \let \listcons \mpr@cons
|
||||
% \let \listsnoc \mpr@snoc
|
||||
% \let \listhead \mpr@head
|
||||
% \let \listmake \mpr@makelist
|
||||
|
||||
|
||||
|
||||
|
||||
\endinput
|
1108
resource/Sources/PointProcessing/mathtools.sty
Normal file
166
resource/Sources/PointProcessing/mhsetup.sty
Normal file
@ -0,0 +1,166 @@
|
||||
%%
|
||||
%% This is file `mhsetup.sty',
|
||||
%% generated with the docstrip utility.
|
||||
%%
|
||||
%% The original source files were:
|
||||
%%
|
||||
%% mhsetup.dtx (with options: `package')
|
||||
%%
|
||||
%% It may be distributed and/or modified under the
|
||||
%% conditions of the LaTeX Project Public License, either version 1.3
|
||||
%% of this license or (at your option) any later version.
|
||||
%% The latest version of this license is in
|
||||
%% http://www.latex-project.org/lppl.txt
|
||||
%% and version 1.3 or later is part of all distributions of LaTeX
|
||||
%% version 2003/12/01 or later.
|
||||
%%
|
||||
%% This work has the LPPL maintenance status "maintained".
|
||||
%%
|
||||
%% The Current Maintainer of this work is Morten H\o gholm.
|
||||
%%
|
||||
%% This work consists of the files mhsetup.dtx and mhsetup.ins and
|
||||
%% the derived file mhsetup.sty.
|
||||
%%
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{mhsetup}
|
||||
[2004/10/10 v1.0b programming setup (MH)]
|
||||
\def\MHInternalSyntaxOn{
|
||||
\edef\MHInternalSyntaxOff{%
|
||||
\catcode`\noexpand\~=\the\catcode`\~\relax
|
||||
\catcode`\noexpand\ =\the\catcode`\ \relax
|
||||
\catcode`\noexpand\^^I=\the\catcode`\^^I\relax
|
||||
\catcode`\noexpand\@=\the\catcode`\@\relax
|
||||
\catcode`\noexpand\:=\the\catcode`\:\relax
|
||||
\catcode`\noexpand\_=\the\catcode`\_\relax
|
||||
\endlinechar=\the\endlinechar\relax
|
||||
}%
|
||||
\catcode`\~=10\relax
|
||||
\catcode`\ =9\relax
|
||||
\catcode`\^^I=9\relax
|
||||
\makeatletter
|
||||
\catcode`\_=11\relax
|
||||
\catcode`\:=11\relax
|
||||
\endlinechar=` %
|
||||
\relax
|
||||
}
|
||||
\MHInternalSyntaxOn
|
||||
\AtEndOfPackage{\MHInternalSyntaxOff}
|
||||
\let\MH_let:NwN \let
|
||||
\def\MH_let:cN #1#2{
|
||||
\expandafter\MH_let:NwN \csname#1\endcsname#2}
|
||||
\def\MH_let:cc #1#2{
|
||||
\expandafter\MH_let:NwN\csname#1\expandafter\endcsname
|
||||
\csname#2\endcsname}
|
||||
\def\MH_new_boolean:n #1{
|
||||
\expandafter\@ifdefinable\csname if_boolean_#1:\endcsname{
|
||||
\@namedef{boolean_#1_true:}
|
||||
{\MH_let:cN{if_boolean_#1:}\iftrue}
|
||||
\@namedef{boolean_#1_false:}
|
||||
{\MH_let:cN{if_boolean_#1:}\iffalse}
|
||||
\@nameuse{boolean_#1_false:}%
|
||||
}
|
||||
}
|
||||
\def\MH_set_boolean_F:n #1{ \@nameuse{boolean_#1_false:} }
|
||||
\def\MH_set_boolean_T:n #1{ \@nameuse{boolean_#1_true:} }
|
||||
\def\MH_if_boolean:nTF #1{
|
||||
\@nameuse{if_boolean_#1:}
|
||||
\expandafter\@firstoftwo
|
||||
\else:
|
||||
\expandafter\@secondoftwo
|
||||
\fi:
|
||||
}
|
||||
\def\MH_if_boolean:nT #1{
|
||||
\@nameuse{if_boolean_#1:}
|
||||
\expandafter\@firstofone
|
||||
\else:
|
||||
\expandafter\@gobble
|
||||
\fi:
|
||||
}
|
||||
\def\MH_if_boolean:nF #1{
|
||||
\@nameuse{if_boolean_#1:}
|
||||
\expandafter\@gobble
|
||||
\else:
|
||||
\expandafter\@firstofone
|
||||
\fi:
|
||||
}
|
||||
\@ifundefined{if:w}{\MH_let:NwN \if:w =\if}{}
|
||||
\@ifundefined{if_meaning:NN}{\MH_let:NwN \if_meaning:NN =\ifx}{}
|
||||
\@ifundefined{else:}{\MH_let:NwN \else:=\else}{}
|
||||
\@ifundefined{fi:}{\MH_let:NwN \fi:=\fi}{}
|
||||
\@ifundefined{if_num:w}{\MH_let:NwN \if_num:w =\ifnum}{}
|
||||
\@ifundefined{if_dim:w}{\MH_let:NwN \if_dim:w =\ifdim}{}
|
||||
\@ifundefined{if_case:w}{\MH_let:NwN \if_case:w =\ifcase}{}
|
||||
\@ifundefined{or:}{\MH_let:NwN \or:=\or}{}
|
||||
\def\MH_cs_to_str:N {\expandafter\@gobble\string}
|
||||
\@ifundefined{eTeXversion}
|
||||
{
|
||||
\MH_let:NwN \MH_protected:\relax
|
||||
\def\MH_setlength:dn{\setlength}
|
||||
\def\MH_addtolength:dn{\addtolength}
|
||||
}
|
||||
{
|
||||
\MH_let:NwN \MH_protected:\protected
|
||||
\def\MH_setlength:dn #1#2{#1=\dimexpr#2\relax\relax}
|
||||
\def\MH_addtolength:dn #1#2{\advance#1 \dimexpr#2\relax\relax}
|
||||
}
|
||||
|
||||
\def\MH_keyval_alias_with_addon:nnnn #1#2#3#4{
|
||||
\@namedef{KV@#1@#2}{\@nameuse{KV@#1@#3}#4}
|
||||
\@namedef{KV@#1@#2@default}{\@nameuse{KV@#1@#3@default}#4}}
|
||||
\def\MH_keyval_alias:nnn #1#2#3{
|
||||
\MH_keyval_alias_with_addon:nnnn {#1}{#2}{#3}{}}
|
||||
\def\MH_use_choice_i:nnnn #1#2#3#4{#1}
|
||||
\def\MH_use_choice_ii:nnnn #1#2#3#4{#2}
|
||||
\def\MH_use_choice_iii:nnnn #1#2#3#4{#3}
|
||||
\def\MH_use_choice_iv:nnnn #1#2#3#4{#4}
|
||||
\long\def\MH_nospace_ifnextchar:Nnn #1#2#3{
|
||||
\MH_let:NwN\reserved@d=~#1
|
||||
\def\reserved@a{#2}
|
||||
\def\reserved@b{#3}
|
||||
\futurelet\@let@token\MH_nospace_nextchar:
|
||||
}
|
||||
\def\MH_nospace_nextchar:{
|
||||
\if_meaning:NN \@let@token\reserved@d
|
||||
\MH_let:NwN \reserved@b\reserved@a
|
||||
\fi:
|
||||
\reserved@b
|
||||
}
|
||||
\long\def\MH_nospace_testopt:nn #1#2{
|
||||
\MH_nospace_ifnextchar:Nnn[
|
||||
{#1}
|
||||
{#1[{#2}]}
|
||||
}
|
||||
\def\MH_nospace_protected_testopt:n #1{
|
||||
\if_meaning:NN \protect\@typeset@protect
|
||||
\expandafter\MH_nospace_testopt:nn
|
||||
\else:
|
||||
\@x@protect#1
|
||||
\fi:
|
||||
}
|
||||
\@ifundefined{kernel@ifnextchar}
|
||||
{\MH_let:NwN \kernel@ifnextchar \@ifnextchar}
|
||||
{}
|
||||
\MH_let:NwN \MH_kernel_xargdef:nwwn \@xargdef
|
||||
\long\def\MH_nospace_xargdef:nwwn #1[#2][#3]#4{
|
||||
\@ifdefinable#1{
|
||||
\expandafter\def\expandafter#1\expandafter{
|
||||
\expandafter
|
||||
\MH_nospace_protected_testopt:n
|
||||
\expandafter
|
||||
#1
|
||||
\csname\string#1\endcsname
|
||||
{#3}}
|
||||
\expandafter\@yargdef
|
||||
\csname\string#1\endcsname
|
||||
\tw@
|
||||
{#2}
|
||||
{#4}}}
|
||||
\providecommand*\MHPrecedingSpacesOff{
|
||||
\MH_let:NwN \@xargdef \MH_nospace_xargdef:nwwn
|
||||
}
|
||||
\providecommand*\MHPrecedingSpacesOn{
|
||||
\MH_let:NwN \@xargdef \MH_kernel_xargdef:nwwn
|
||||
}
|
||||
\endinput
|
||||
%%
|
||||
%% End of file `mhsetup.sty'.
|
BIN
resource/Sources/PointProcessing/point_process_model.png
Normal file
After Width: | Height: | Size: 33 KiB |