Set of parallel lines in a matrix along different directions(not x and y direction)
2 views (last 30 days)
Show older comments
Dear all,
I don't have an idea about how to proceed with this problem! Imagine, I have a 480x748 matrix; I need set of parallel lines along different directions. Set of parallel lines along x and y are clear : rows and columns, respectively. But I need to extract lines in different directions, e.g. 10,20,30,.. from the horizontal. Any MATLAB command or some hints to follow?
0 Comments
Answers (2)
Walter Roberson
on 23 Jun 2013
Remember the old formula: y = m*x+b and m = tan(theta)
However, if you apply that naively then as you step x by integers, you will get non-integer y coordinates that you will need to make integral. You can floor() or ceil() or round() or fix() to make integral, but as you do so you may end up skipping some integral values (e.g., you might end up selecting y = [1 2 4 5 7 8...]) or you might end up re-using some integral y values. This is likely to throw off your computations.
I suggest you start with something simple like 30 degrees and placing the origin at the logical center of the bottom-left pixel, and computing the exact coordinates you want to be in a single line of length (say) 24. Then switch to 120 degrees and compute again. Now do the logical transpose to compute the lines running perpendicular to those two: is the result one-to-one or do you need to change how you want to define which pixels should be in the lines?
2 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!