Using difference of average for identifying features in an image

135 Views Asked by At

I'm working with this paper: Textural Features Corresponding to Visual Perception, by Tamura, Mori, and Yamawaki. There's a part where you have to calculate neighborhoods of one image (matrix of, for example $256 \times 256$) and those neighborhoods have to be $2^k$ size square.

Step 1: Take averages at every point over neighborhoods whose sizes are powers of two, e.g., $1\times1$, $2\times2$, $\cdots$, $32\times32$. The average over the neighborhood of size $2^k\times2^k$ at the point $(x,y)$ is $$A_k(x,y)=\sum_{i=x-2^{k-1}}^{x+2^{k-1}-1}\sum_{j=y-2^{k-1}}^{y+2^{k-1}-1}f(i,j)\big/2^{2k}$$ where $f(i,j)$ is the gray-level at $(x,y)$.

Ok that's great.

Then I have to calculate a difference:

Step 2: For each point, at each point, take differences between pairs of averages corresponding to pairs of non-overlapping neighborhoods just on opposite sides of the point in both horizontal and vertical orientations. For examples, the difference in the horizontal case is $$E_{k,h}(x,y)=\left|A_k\left(x+2^{k-1},y\right)-A_k\left(x-2^{k-1},y\right)\right|.$$

Let $A(0,0)$ be the point where I want to calculate the difference.

If I use $A(0,0)$, I will go out of bounds on the second member.

Do you think it's an error? There's nothing about the '$h$' parameter anywhere as well.

$k$ could be $0, 1, 2 \dots$

2

There are 2 best solutions below

6
On BEST ANSWER

As Michael suggested, $h$ is for horizontal. You'll also have vertical difference $$ E_{k,v}(x,y) = |A_k(x+2^{k-1},y) - A_k(x-2^{k-1},y)| $$ I think that they take $E_k = \max(E_{k,h},E_{k,v})$ and then maximize over $k$.

I will go out of bounds on the second member.

Yes you will, if $(x,y)$ are close to the boundary. The authors admit as much:

boundary strips of a picture within the width of the largest operator size $2L$ cannot be processed properly.

They offer no remedy to the boundary effects. One possible solution is to extend the image to a larger square by setting the color of every exterior pixel equal to the color of the image pixel nearest to it.

0
On

It looks ok to me.

enter image description here

In the diagram I have taken $(x,y)$ to be $(5,4)$, so I am comparing two squares, one yellow, one orange, either side of $(x,y)$. That is the $k$ case. Then there is a similar comparison for the $h$ case. Of course, you run into trouble if you are too close to the border, but that is inevitable.