Extracting image information in certain direction

I have an image (MxN). I want to extract the spatial directional components of the image. Say for example, if the asked direction is 0 degree, it will keep the image pixels which are oriented along 0 degree (close to the x axis). Similarly, if the asked direction is 90 degree, it will keep the image pixels which are oriented along 90 degree (close to the y axis). Thus the 45 degree will only keep the image pixels which are oriented in between the two aforementioned directions. Initially I thought sobel kernels can do this job. But, they only look for edges (change in intensity in particular directions) I think. Can anyone please tell how such spatial directional components can be extracted.

 Accepted Answer

The generalization of this is the radon transform
You could also consider using improfile()

4 Comments

I didn't understand it either, so all I could think of was these same two functions you mentioned. Of course any given arbitrary pixel in the image can be thought of as being part of some line or projection across an infinite number of angles. It's not like you can say the pixel at (row, column)= (42, 113) is part of the 45 degree whatever but not included in the 29 degree whatever. It doesn't make sense.
Thanks for the helps. Now here is the actual problem I am facing now. I have an image. I want to apply a directional filter (preferably Butterworth bpf) to that image, so that the directional filter will extract band-limited image information for the particular direction (0,45,90 degrees, so on). I am actually borrowing the concept from this paper:
I have the following Butterworth bpf (cutoff freq [20,100]).
And here is the image representation of the filter response.
Now, I want my directional filter response to be like this.
0 degree directional filter:
45 degree directional filter:
90 degree directional filter:
And so on.
Any clue how to make such a filter?
Thanks
You can convert the row and column coordinates of each pixel into theta and cos relative to the center of your pixel, and then zero out any pixel that whose theta is not in the proper range.
Or you can use trigonometry to find the bounding lines and zero out everything outside the lines. This would be especially simple if you are using 45 degree wedges: your diagonal dividing line would come down to whether the row offset was greater than the column offset or not, with appropriate sign adjustment.
Thanks. I actually used trigonometry (the second method you mentioned) to generate those directional filter responses. However, my question (I think I was not clear enough) was how to develop such a filter, given the frequency response (or transfer function) of the actual filter (Butterworth bpf in this case)?
Thanks

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!