detecting edge direction using Julia-language Let say we have following image:



made with following Julia-code:

using Images
using PyPlot
using ImageFiltering

function chessboardimg(m::Int, n::Int, blkwidth::Int, blkheight::Int, )
  img = zeros(m, n)

  togglex = true
  toggley = !togglex
  for i=1:m
    togglex = true
    for j=1:n
      img[i, j] = abs(togglex - toggley)
      if j % blkwidth &lt;= 0
        togglex = !togglex
      end
    end
    if i % blkheight &lt;= 0
      toggley = !toggley
    end
  end
  return img
end

### creating image ####
img1 = transpose(triu(ones(20, 20)))
img2 = chessboardimg(20, 20, 10, 10)
img = [img1 img2]


Now i want to get the edge directions in this image as below:

gx, gy = imgradients(img)
mag, grad_angle = magnitude_phase(gx, gy)
grad_angle *= 180 / pi
imshow(grad_angle, "gray", interpolation="none")


These are the images of each calculated step:



as you can see in the "Gradient Direction"-image twoh vertical lines are missing.
which should actually indicate the transition from black to white region in the y-direction.

1) what am i doing wrong?
The edges "missing" from the picture are actually those that have angle=0; which is the same as the phase you get for "there's no edge here".

So, nothing wrong.