I want to ask, consider we want to compute the slope of x-direction of the following step

enter image description here.

The slope for it would be

$m =\frac{0}{m_2 - m_1} =\frac{0}{5 - 2}$ which is 0.

But the derivate for image in x-direction computed with (something like, some symbols aren't existed in my phone so lets just say $\frac{df}{dx}$)

$\frac{df}{dx} = f(x+1) - f(x)$

enter image description here

It's computed under the consideration of next pixel $f(x+1)$ minus current pixel $f(x)$.

Is there any interpretation that I'm missing, shouldn't it be 0, in both cases?

  • 2
    $\begingroup$ Unclear! are you telling some parallel shouldn't have slope zero? whats are you telling about image derivative. please give more info $\endgroup$ Oct 26 '16 at 18:54
  • $\begingroup$ @AlwynMathew when you improve the post and there are huge images, or small tables as images, it would be nice to also hack them. $\endgroup$
    – Evil
    Oct 26 '16 at 19:05
  • $\begingroup$ @Evil actually I have no idea what those images means thus I don't want to confuse others who are looking at this question. $\endgroup$ Oct 27 '16 at 3:59
  • $\begingroup$ @DavidRicherby, hi , it's actually y2-y1/x2-x1, I wrote it as simply 0/x2-x1.Thanks everyone i was so confused about all this derivative. $\endgroup$ Oct 27 '16 at 4:22
  • $\begingroup$ @AlwynMathew I understand, me neither. As you have pointed out 9h ago it is unclear, so the OP should explain and improve the question (also images should be more readable or illustrate better instead of being confusing) and until it is clearer we could wait to improve it at once or let OP improve it. $\endgroup$
    – Evil
    Oct 27 '16 at 4:24

From my understanding, you are asking about computing the derivative, at some pixel $(x,y)$, with respect to the $x$ direction. We can approximate a derivative of some function $f(x,y)$ along the $x$ direction using the following Finite Difference formula:

$$ \frac{\partial f}{\partial x} \approx \frac{f(x+h,y) - f(x,y)}{h} $$

for some $h \neq 0$, usually using $h \ll 1$ if possible. For an image, the best you can do with this formula is the following:

$$ \frac{\partial f}{\partial x} \approx \frac{f(x+1,y) - f(x,y)}{1} = f(x+1,y) - f(x,y) $$

This is because $f(x,y)$, the pixel color values at $(x,y)$, is a value of $1$ away from the nearest neighboring pixels in both the $x$ and $y$ direction.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.