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 <= 0 togglex = !togglex end end if i % blkheight <= 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?