Question
Write a Matlab function that takes in as an argument a color or grayscale image, and returns an image that shows edge pixels with a
Write a Matlab function that takes in as an argument a color or grayscale image, and returns an image that shows edge pixels with a certain orientation. In particular, you should implement a function that is invoked as follows:
oriented_edges(img, sigma, threshold, direction, tolerance)
Pixels in the resulting image should be white (value 255) if and only if they satisfy all the following requirements:
- The pixel is white in the result of canny4(img, sigma, 1.35, threshold, 2*threshold).
- The normal to the gradient at that pixel has a direction within tolerance degrees from direction.
The normal to the gradient is simply the direction that is perpendicular to the gradient. Example outputs of oriented_edges are shown in Figure 1 above.
This is a mathematical problem. You have to carefully read the specifications for what the function should return, and make sure that your solution satisfies those specifications. Your solution should work for any image. YOUR FUNCTION SHOULD NOT DISPLAY ANY FIGURES.
Directions are measured in degrees. Here are some specifications that your solution should comply with:
- Directions are specified in degrees.
- There is no distinction between angle A and angle A+180.
- Direction 0 corresponds to 3 o'clock orientation (horizontal).
- Direction 45 corresponds to 4:30 orientation (diagonal, going down and right).
- Direction 90 corresponds to 6 o'clock orientation (vertical).
- Direction 135 corresponds to 7:30 orientation (diagonal, going down and left).
- Direction difference is not a simple subtraction: the difference between direction 177 and direction 2 is 5 degrees. The difference between direction 1807 and direction 7 is 0 degrees.
- The direction argument of oriented_edges function is NOT CONSTRAINED to the 0-180 range, it can be anything (like 1823, -532, ...).
- The tolerance argument of oriented_edges function is constrained to be a real number >= 0 and <= 90 degrees.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started