-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy patharithmetic.tex
More file actions
77 lines (76 loc) · 2.07 KB
/
arithmetic.tex
File metadata and controls
77 lines (76 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
%!TEX root = cv-sheet.tex
\section{Arithmetic Operations}
\subsection{Addition}
$I(x,y) = I_1(x,y) + I_2(x,y)$\\
OR\\
$I(x,y) = I_1(x,y) + C$\\
\subsubsection{Overflow}
$I(x,y) > max\ (255)?$
\begin{enumerate}
\item Wrapping: $I'(x,y) = I(x,y) - (max+1)$
\item Saturation: $ I'(x,y) = max$
\end{enumerate}
\subsection{Subtraction}
usage: detect changes between 2 images.\\
$I(x,y) = I_1(x,y) - I_2(x,y)$\\
OR\\
$I(x,y) = I_1(x,y) - C$\\
\subsubsection{Underflow}
$I(x,y) < 0?$
\begin{enumerate}
\item Wrapping: $I'(x,y) = I(x,y) + (max+1)$
\item Saturation: $ I'(x,y) = 0$
\item Absolute: $ I'(x,y) = |I(x,y)|$
\end{enumerate}
\subsection{Multiplication}
usage: enhance contrast
$I(x,y) = I_1(x,y) * I_2(x,y)$\\
OR\\
$I(x,y) = I_1(x,y) * C$\\
\subsection{Division}
$I(x,y) = I_1(x,y) \div I_2(x,y)$\\
OR\\
$I(x,y) = I_1(x,y) \div C$\\
\subsection{Blending}
$I(x,y) = I_1(x,y) * C + I_2(x,y) * (1-C)$\\
\subsection{Logical Operations}
\textsc{NOT, AND/NAND, OR/NOR, XOR/XNOR}
\subsubsection{Conversion}
\begin{enumerate}
\item Bitwise: convert values to binary base and apply operators bitwise.
\item Thresholding: convert each pixel value to 1 bit:
$
I_{new} =
\begin{cases}
0, & I > 127,\\
1, & I \leq 127.
\end{cases}
$
\end{enumerate}
\subsubsection{Applications}
\begin{itemize}
\item \textbf{AND/NAND}: intersection bet. 2 images.
\item \textbf{OR/NOR}: union bet. 2 images.
\item \textbf{NOT}: negative of input image.
\end{itemize}
\subsubsection{Logical NOT}
Ways to apply NOT:
\begin{itemize}
\item normal boolean NOT.
\item grayscale: $I'(x,y) = 255 - I(x,y)$.
\item float pixel format: $I'(x,y) = - I(x,y)$, followed by normalization.
\end{itemize}
\subsection{Bitshift Operations}
usage: fast multiplication and division
\begin{itemize}
\item \textbf{Shift left} $i$ bits = $* 2^i$ (multiplication)
\item \textbf{Shift right} $i$ bits = $\div 2^i$ (division)
\end{itemize}
\subsubsection{Empty Places}
\begin{enumerate}
\item fill with zeros.
\item fill with ones.
\item fill with bits from other side (rotate).
\end{enumerate}
%end of section
\hrule