posted 2 weeks ago
Hi,
I am working on solving a problem based on box blur filter. I am given a pixel matrix of size (n x n) along with width and height of an image. I am given xaxis coordinate and yaxis coordinate of current pixel to be processed. I am also given a radius in which I have to apply the blur function.
Here is what I understand so far. I have to iterate the width and height of the image. for each position I need to check if I am within radius range and then apply some calculation for blurring of pixel. I believe we have to average out the pixel values. Again not sure how that works.
Would someone please explain the relation between pixel matrix and blur radius. I searched quite a bit to find some article which explains this, but did not find much. Mostly they give horizontal and vertical blur functions, which I do not need.
Here is sample data for my processing :
Thanks
I am working on solving a problem based on box blur filter. I am given a pixel matrix of size (n x n) along with width and height of an image. I am given xaxis coordinate and yaxis coordinate of current pixel to be processed. I am also given a radius in which I have to apply the blur function.
Here is what I understand so far. I have to iterate the width and height of the image. for each position I need to check if I am within radius range and then apply some calculation for blurring of pixel. I believe we have to average out the pixel values. Again not sure how that works.
Would someone please explain the relation between pixel matrix and blur radius. I searched quite a bit to find some article which explains this, but did not find much. Mostly they give horizontal and vertical blur functions, which I do not need.
Here is sample data for my processing :
Thanks
Norm Radder
Rancher
Posts: 2036
26
posted 2 weeks ago
 1
How is this a java programming problem?
If you have an algorithm you are trying to code in java, please post the algorithm and the code you have written and ask some questions about the problems you are having writing code to follow the algorithm.
If you have an algorithm you are trying to code in java, please post the algorithm and the code you have written and ask some questions about the problems you are having writing code to follow the algorithm.
posted 2 weeks ago
I do not have the algorithm yet. I am still trying to figure out how to solve it.
Here is the code I have so far :
From an article I found in this link, I get that I have to average out pixel value for given (x, y) coordinate. But I do not know how to get the radius range from this matrix and get the average pixel value.
Norm Radder wrote:How is this a java programming problem?
If you have an algorithm you are trying to code in java, please post the algorithm and the code you have written and ask some questions about the problems you are having writing code to follow the algorithm.
I do not have the algorithm yet. I am still trying to figure out how to solve it.
Here is the code I have so far :
From an article I found in this link, I get that I have to average out pixel value for given (x, y) coordinate. But I do not know how to get the radius range from this matrix and get the average pixel value.
Norm Radder
Rancher
Posts: 2036
26
posted 2 weeks ago
Agreed on that point. I also was looking at that aspect.
I am unable to find a generic algorithm which doesn't discuss about specific type of filtration. Maybe I am not looking at right place, but not sure where to look for it.
Norm Radder wrote:I do not have the algorithm yet. I am still trying to figure out how to solve it.
It is important to get a design/algorithm before trying to write any code.
Agreed on that point. I also was looking at that aspect.
Would someone please explain the relation between pixel matrix and blur radius. I searched quite a bit to find some article which explains this, but did not find much. Mostly they give horizontal and vertical blur functions, which I do not need
I am unable to find a generic algorithm which doesn't discuss about specific type of filtration. Maybe I am not looking at right place, but not sure where to look for it.
posted 2 weeks ago
You have two matrices, your image or pixels (NxN), and the convolution (in your example 5x5). The size of the convolution (box) matrix can be derived from the radius where
height = width = 2 x Radius + 1
divisor = width x height
All positions in the convolution matrix are set to '1'. After all the pixels are multiplied by the convolution values the sum is then divided by the divisor.
 2
s ravi chandran wrote:Would someone please explain the relation between pixel matrix and blur radius. I searched quite a bit to find some article which explains this, but did not find much.
You have two matrices, your image or pixels (NxN), and the convolution (in your example 5x5). The size of the convolution (box) matrix can be derived from the radius where
height = width = 2 x Radius + 1
divisor = width x height
All positions in the convolution matrix are set to '1'. After all the pixels are multiplied by the convolution values the sum is then divided by the divisor.
posted 2 weeks ago
Thanks for the response. I have solved the problem.
Carey Brown wrote:s ravi chandran wrote:Would someone please explain the relation between pixel matrix and blur radius. I searched quite a bit to find some article which explains this, but did not find much.
You have two matrices, your image or pixels (NxN), and the convolution (in your example 5x5). The size of the convolution (box) matrix can be derived from the radius where
height = width = 2 x Radius + 1
divisor = width x height
All positions in the convolution matrix are set to '1'. After all the pixels are multiplied by the convolution values the sum is then divided by the divisor.
Thanks for the response. I have solved the problem.
Enjoy the full beauty of the english language. Embedded in this tiny ad:
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/DeprecationJava
