mirror of https://github.com/2martens/uni.git
[BV] Finished assignment 8
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
parent
3fb349ff65
commit
9de692ff7d
|
@ -0,0 +1,130 @@
|
|||
1.
|
||||
------
|
||||
| 1 |
|
||||
-------------- ------
|
||||
| 1 | -2 | 1 | + | -2 |
|
||||
-------------- ------
|
||||
| 1 |
|
||||
------
|
||||
|
||||
The image has to be padded by 2 rows of zeros. The result of the correlation
|
||||
follows:
|
||||
|
||||
---------------
|
||||
| 1 | -2 | 1 |
|
||||
---------------
|
||||
|-2 | 4 | -2 |
|
||||
---------------
|
||||
| 1 | -2 | 1 |
|
||||
---------------
|
||||
|
||||
The resulting filter is the result of the outer product of both used filters
|
||||
which makes it a separable filter.
|
||||
|
||||
|
||||
2.
|
||||
|
||||
The Prewitt edge detector for vertical edges follows:
|
||||
|
||||
-------------
|
||||
|-1 | 0 | 1 |
|
||||
-------------
|
||||
|-1 | 0 | 1 |
|
||||
-------------
|
||||
|-1 | 0 | 1 |
|
||||
-------------
|
||||
|
||||
The image of the exercise follows with 1 specifying white and 0 black.
|
||||
|
||||
-------------------------
|
||||
| 0 | 0 | 0 | 1 | 1 | 1 |
|
||||
-------------------------
|
||||
| 0 | 0 | 0 | 1 | 1 | 1 |
|
||||
-------------------------
|
||||
| 0 | 0 | 0 | 1 | 1 | 1 |
|
||||
-------------------------
|
||||
| 0 | 0 | 0 | 1 | 1 | 1 |
|
||||
-------------------------
|
||||
| 0 | 0 | 0 | 1 | 1 | 1 |
|
||||
-------------------------
|
||||
| 0 | 0 | 0 | 1 | 1 | 1 |
|
||||
-------------------------
|
||||
|
||||
The image has to be padded with 1 row and column of zeros to have a same size
|
||||
result image. After that the convolution is applied. The padded image follows:
|
||||
|
||||
---------------------------------
|
||||
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
---------------------------------
|
||||
| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 |
|
||||
---------------------------------
|
||||
| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 |
|
||||
---------------------------------
|
||||
| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 |
|
||||
---------------------------------
|
||||
| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 |
|
||||
---------------------------------
|
||||
| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 |
|
||||
---------------------------------
|
||||
| 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 |
|
||||
---------------------------------
|
||||
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
---------------------------------
|
||||
|
||||
The result of the convolution follows (without scalar product):
|
||||
|
||||
|
||||
---------------------------
|
||||
| 0 | 0 | -2 | -2 | 0 | 2 |
|
||||
---------------------------
|
||||
| 0 | 0 | -3 | -3 | 0 | 3 |
|
||||
---------------------------
|
||||
| 0 | 0 | -3 | -3 | 0 | 3 |
|
||||
---------------------------
|
||||
| 0 | 0 | -3 | -3 | 0 | 3 |
|
||||
---------------------------
|
||||
| 0 | 0 | -3 | -3 | 0 | 3 |
|
||||
---------------------------
|
||||
| 0 | 0 | -2 | -2 | 0 | 2 |
|
||||
---------------------------
|
||||
|
||||
When the non zero values are replaced by ones, this is the result:
|
||||
|
||||
|
||||
-------------------------
|
||||
| 0 | 0 | 1 | 1 | 0 | 1 |
|
||||
-------------------------
|
||||
| 0 | 0 | 1 | 1 | 0 | 1 |
|
||||
-------------------------
|
||||
| 0 | 0 | 1 | 1 | 0 | 1 |
|
||||
-------------------------
|
||||
| 0 | 0 | 1 | 1 | 0 | 1 |
|
||||
-------------------------
|
||||
| 0 | 0 | 1 | 1 | 0 | 1 |
|
||||
-------------------------
|
||||
| 0 | 0 | 1 | 1 | 0 | 1 |
|
||||
-------------------------
|
||||
|
||||
3.
|
||||
|
||||
-----
|
||||
| 1 |
|
||||
----- --------------
|
||||
| 2 | * | -1 | 0 | 1 |
|
||||
----- --------------
|
||||
| 1 |
|
||||
-----
|
||||
|
||||
To accurately process this convolution the image has to be padded by 2 columns
|
||||
of zeros.
|
||||
|
||||
The result of the convolution follows:
|
||||
--------------
|
||||
| -1 | 0 | 1 |
|
||||
--------------
|
||||
| -2 | 0 | 2 |
|
||||
--------------
|
||||
| -1 | 0 | 1 |
|
||||
--------------
|
||||
|
||||
This resulting filter is called Sobel edge detector for horizontal edges.
|
Loading…
Reference in New Issue