The image is quite clearly gaussian blurred: the edges are not as sharp since surrounding pixels are averaged across it.
D_x D_y convolved gaussian:
The edge detection is the same as before, only slightly blurred.
1.3
For gradient computation, I simply went through a set of rotations of the image (in my case, -8 degrees to +7 degrees), and performed the
following calculations for each.
1. Crop the rotated image to ignore rotation-generated edges
2. Create a gradient image by convolving the rotated image with dx and dy (finite diff filters) and calculating arctan of d(image)/dy over
d(image)/dx
3. In this gradient matrix, convert to degrees and count the number of angles that fall at 0, 90, 180, -90 degrees within a certain error (in my
case, 3 degrees)
4. Find the ratio of this number of degrees that satisfy the conditions over the total number of elements in the matrix
5. Find the max of said ratio out of all rotations - this is the angle we choose
Original image: