CEN - 372 Homework |
Старт: 16.сен.2015 в 10:00:00
Финиш: 16.мая.2016 в 14:00:00
Турнир завершён!
• Турнирная таблица
|
|
Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan.
Image Filtering
In image processing, images are filtered (convolved)
using different filters. Different filters provide
different results on images: like noise filtering,
or sharpening images. When filtering, the filter
(or the window) is moved on every pixel and
according to neighboring pixels values and the
values in the window, new values are calculated.
When filtering images, according to the size of
the window, image is either padded zeros or the
bordering pixels are replicated.
Question:
Write a program that reads an image and a filter,
then your program should print the highest
pixel of the image.
Input specification
In the first line you will be given two integers
for the image size: the number of rows (m) and
the number of columns (n) where
1 ≤ m ≤ 1,000 and 1 ≤ n ≤ 1,000.
Then in the following m lines you will be
given n integers where each integer is between
0 and 255. Then in the following line, you will
be given the size of filtering window (r and c)
where r and c are between 1 and 20 (for simplicity r and c
will be odd numbers). The following
r lines will have c integers which are between
0 and 255.
Output specification
in the first line, show the highest value.
Then show convolved image by rounding to
the nearest integer.
Note:
The image is divided by
the sum of the values in the filter.
Leave the output as it's, if the sum
of the filter is 0.
Sample Input I
3 4
5 6 3 9
10 3 6 10
4 8 7 6
3 3
1 2 1
2 4 2
1 2 1
|
Sample Output I
6
3 4 4 4
5 6 6 6
3 5 5 4
|
Для отправки решений необходимо выполнить вход.
|