Log in

View Full Version : An image function that gives it a sense


luquinhas0021
23rd June 2016, 04:25
"What is an image?", I think, "what does those values mean?"
I take an image from R, G, B and Y components: we gotta consider a pixel and it relationship with it direct neighbors. If we do it, we will see that there are, somehow, abrupt changes between any two direct neighbors pixels.

Example:

P(1,1) = 127 P(1,2) = 96 P(2,1) = 204 P(2,2) = 13

The goal is fit it sample values in a full-sense continuous function. So, I think: "Ben, if sample values represents nothing more than, I call, abrupt gradients, nothing more good that put, between two adjacent values, smooth values.
It will be done in the line, in the column and in the diagonal. And in the new intermediate pixels.

Example:

Taking P(1,1) and it neighbors: P(1,1) and P(1,2) - the P(1,2) value is smaller than P(1,1) one. So, the P(1,1.000...1) to P(1,1.999...9) values will be going from P(1,1) to P(1,2) values, without be greater than P(1,1) value neither smaller than (1,2) value.

I think you understood the sense behind it. Then, you imagine how will be done in P(1,1) and P(2,1) relation. Too, in P(1,1) and P(2,2) one.
The interpolation will be done firstly in x axis, then in y axis and, finally, in diagonal.
I will write more details latter.
The function has to have, entirely, first and second derivatives.
The scope is a multi-directional gradient operator.

colours
23rd June 2016, 06:42
It will be done in the line, in the column and in the diagonal. And in the new intermediate pixels.
[…]
The interpolation will be done firstly in x axis, then in y axis and, finally, in diagonal.

When you interpolate along the rows, your domain goes from ℤ×ℤ to ℤ×ℝ; interpolating along the columns then goes from that to ℝ×ℝ. What is left to interpolate "diagonally"? What are the "intermediate pixels"?

So, the P(1,1.000...1) to P(1,1.999.9) values will be going from P(1,1) to P(1,2) values, without be greater than P(1,1) value neither smaller than (1,2) value.

So basically, a resampler with no ringing?

The scope is a multi-directional gradient operator.

https://en.wikipedia.org/wiki/Directional_derivative

Notice how the directional derivative is equal to the dot product of the gradient with a unit vector for the direction if the underlying function is differentiable.

luquinhas0021
23rd June 2016, 16:07
Colous says:

"What is left to interpolate "diagonally"?"

Suppose the pixels P(1,1), P(1,2), P(2,1) and P(2,2). P(1,1) is chosen. Interpolate in diagonal is set intermediate values between P(1,1) and P(2,2).

Interpolation rules:

Let P(a,b) = k an arbitrary pixel with arbitrary value, into an arbitrary m x n matrix, and all it possible direct neighbors - P(a + 1,b), P(a - 1,b), P(a,b + 1), P(a,b - 1), P(a - 1,b + 1), P(a + 1,b + 1), P(a - 1, b - 1) or P(a + 1, b - 1).
Let's define a P(a,b) direct neighbor as P(z,t). P(a,b) = k, P(z,t) = g, and S the intermediate values set - into intermediate coordinates - between P(a,b) and P(z,t).
If k < g, S must contain only values bigger than k and smaller than g, smooth transitions;
if k > g, S must contain only values smaller than k and bigger than g, smooth transitions;
if k = g, add -0.000...1 to g, and apply the rule k > g. I think about this for avoiding f(x,y) = c, c is constant, and generate the smallest error.

Colours says:

"What are the "intermediate pixels"?"

Be an arbitrary m x n matrix, with coordinates and values.
Be P(a,b) and it x axis. It will create values that will be into intermediate columns.
Be P(a,b) and it y axis. It will create values that will be into intermediate lines.
Hm... It's easy to realize that intermediate columns doesn't ask for new lines, but intermediate lines asks for new columns; the pixels in new columns in intermediate lines are, I call, the intermediate pixels.

When I talk "interpolate in x axis", I talk about interpolate in line, in one or n functions f(x,y) = equation; similarly, when I talk "interpolate in y axis", I talk about interpolate in column, in one or n functions f(x,y) = equation.

Colours says:

"So basically, a resampler with no ringing?"

No, it is not for resizing.
It is for partial derivative, gradient magnitude and edge direction calculus.

Colours says:

"Notice how the directional derivative is equal to the dot product of the gradient with a unit vector for the direction if the underlying function is differentiable."

I said "multi-directional gradient operator" because most common gradient operators computes the gradient only in x and y axis parallel unit vectors - (1,0) and (0,1), respectively; however, is not hard to see that pixel can have 3, 5 or 8 neighbors, never only 2.

Ben, after, I will tell the interpolation procedure.

colours
23rd June 2016, 17:04
>I said "multi-directional gradient operator" because most common gradient operators computes the gradient only in x and y axis parallel unit vectors - (1,0) and (0,1), respectively; however, is not hard to see that pixel can have 3, 5 or 8 neighbors, never only 2.

You seem to be missing my point.

Do you know what the definition of a derivative in the single-dimensional case is? Do you know how that generalises into a directional derivative? Do you know what a dot product is? Do you know what the gradient operator, denoted with a downward pointing hollow triangle, is? Do you know what a unit vector is?

If the answer to any of the above questions is "no", please get a calculus textbook and start studying.

The tl;dr version is that you can get the directional derivative for any angle just by multiplying ∂f/∂x by cos(θ) and ∂f/∂y by sin(θ), and then adding these two values up. This is why estimating the directional derivative in two directions is sufficient: you can get any other angle with a linear combination.

This is, of course, conditioned on that you care about the theoretical aspects more than the practical. If you actually care more about the practical aspects, may I remind you that if you just do a Google search on "edge detection", you'll get a flavour-of-the-month paper on the newest edge detection technology (https://scholar.google.com/scholar?as_ylo=2016&q=edge+detection&hl=en&as_sdt=0,5)?

luquinhas0021
25th June 2016, 03:43
Colours said:

"Do you know what the definition of a derivative in the single-dimensional case is? Do you know how that generalizes into a directional derivative? Do you know what a dot product is? Do you know what the gradient operator, denoted with a downward pointing hollow triangle, is? Do you know what a unit vector is?"

Yes.

directional derivative = (df/dx, df/dy).(cos(a), sin(a))
If I choose for "a" any angle different of (45.k)degrees - "a" being a natural number/ 0 <= a <=8, with 45.k being a real number/ 0 degrees <= 45.k <=360 degrees, will I get sub-pixel precision or somethings that get closer to it?