I'm currently reading about segmentation, and have come across finding edges in an image. I then have this image:

Now, I understand how the mask used for the second-derivative works, and give the values for that, but I can't figure out how the mask for first-order derivative works ? The second-order 1D mask is just [1 -2 1], but how does the first-order one look like ? If there even is anyone. Of course I do know, that the first-order derivative is just the slope of the line, and from that it's easy to see what the values should be. But mask wise, I'm not sure how it works.

As you can see in the following image, the image shows the first order 1D derivative. Now you can write this equation in terms of the previous pixel rather than the following pixel.

For a 1D differentiation, you are only interested in either the x direction (Horizontal) changes of pixel intensity values or the y direction (Vertical).

Therefore the mask will be [0 -1 1] in case of next intensity value. Or [1 -1 0] for previous intensity value.

You can apply the same idea for vertical differentiation by taking the transpose.