ARLM-Keller / aforge

Automatically exported from code.google.com/p/aforge
0 stars 0 forks source link

Convulution with Kernels that sum up to 0 do not work correctly #60

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a kernel for a convolution filter with negative values (used for 
directional edge 
detection) with values that sum up to 0
2. convolve an image with the constructed kernel
3. the intensitis are not scaled correctly

What is the expected output? What do you see instead?
A value dependedt detection of the edges

What version of the product are you using? On what operating system?
Currently available

Please provide any additional information below.
You can contact me using my email address gtroxler[at]student[dot]ethz[dot]ch

Original issue reported on code.google.com by georg.tr...@gmail.com on 27 Mar 2008 at 2:02

GoogleCodeExporter commented 8 years ago
Ok, but more information is required.

Let's take a look at Edges filter. It uses kernel with sum 0. What is wrong 
with the 
filter? Let's use this filter as a sample.

The phrase "the intensitis are not scaled correctly" does not give a lot of 
information.

Original comment by andrew.k...@gmail.com on 27 Mar 2008 at 2:14

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 13 May 2008 at 6:40

GoogleCodeExporter commented 8 years ago
The problem only occures if you define the Kernel yourself, I used a kernel 
filter like this

-1 -1 -1 
0  0  0
1  1  1

so the sum of the filter values is 0. The output is then scaled with this sum 
if it is not 0. But in this case it 
should be scaled by 6, the sum of the absolute values.

example of the input:

64  64  64 
0   0   0
255 255 255

the convolution with the above filter would return 255 (the calculated value is 
573 which is larger as 255 so it 
would get truncated). Correctly it would return 95.5 (= 573 / 6).

Original comment by georg.tr...@gmail.com on 13 May 2008 at 7:07

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 19 May 2008 at 5:58

GoogleCodeExporter commented 8 years ago
You are both right and not. For the kernel you've provided you may be right. 
But if 
we take sharpen kernel (see below), then sum of absolute values will give bad 
result.
 0 -1  0
-1  5 -1 
 0 -1  0

To resolve the issue a new property was added, which allows to specify desired 
divisor. Also new constructor is added for this. The old constructor (which 
takes 
only kernel) calculates divisor automatically.

Committed in revision 578. Will be released in version 1.7.0

Original comment by andrew.k...@gmail.com on 19 Jul 2008 at 5:06

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 21 Jul 2008 at 9:35