Blur effect is widely used in UI design, especially on IOS platform. ‘Blur your mind’ is a simple and easy way to blur a picture in a short time.
The algorithm is defined as follows.
Take a radius ,which will always be an odd number, like 3,we can get the convolution kernel like this:
each element is ,and the width and height is both
Then we take that kernel,doing convolution on every pixel of the original grayscale image to get the result.
The convolution here is simply multiply each corresponding pixel with the kernel, add the result up, then replace the original pixel . The result may be a floating number, we will just take the integer part.
When it comes to the edge, we simply expand the border to get an image big enough for the kernel.
Take the sample for example, because the radius is 3,first we expand the image to fit the kernel,so when we are processing the edge, we can still get the pixel:
2 2 5 4 4
2 2 5 4 4
6 6 7 5 5
4 4 3 2 2
4 4 3 2 2
Note we just expand the border vertically and horizontally. And the color on diagonal direction is the same as the four corners.
Then we take put the kernel on left-top: the result of the first convolution is ,so the result is 4,after that we move the kernel to next pixel, the convolution is
,so the result is 4.
We do it 9 times (i.e. on every pixel of the original image)to get the answer.
Little Dingding has some grayscale images, but he doesn’t know how to blur them, so he asked you for help.
Problem H: 五队-大连-Blur your mind
Time Limit: 5 Sec Memory Limit: 128 MBSubmit: 15 Solved: 6
[Submit][Status][Web Board]
Description
Input
There are multiple test cases. Given the radius ,
is an odd number .Then
,
(
),representing the rows and columns of the original image, then follows the original image in row-major, it’s gray, so each element is an integer between 0 and 255. Process to end of file.
Output
For each case, print result image in the format it’s given.
Sample Input
3 3 3
2 5 4
6 7 5
4 3 2
Sample Output
4 4 4
4 4 4
4 4 3
HINT
한국어
中文
فارسی
English
ไทย
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2013 ZJUT ONLINE JUDGE TEAM
GPL2.0 2003-2013 HUSTOJ Project TEAM
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2013 ZJUT ONLINE JUDGE TEAM
GPL2.0 2003-2013 HUSTOJ Project TEAM