Divide 3d line into segments
Ältere Kommentare anzeigen
Hello,
I've got an object in an image which is positioned at an angle. I can draw a line across each side of the object, forming a sheared bounding box for the object.
I need to split the top and bottom lines (the horizontal lines) into a number of parts. For straight lines this would be fairly easy, something like this:
point1 = [664, 10];
point2 = [1556, 10];
length = point2(2) - point1(2);
numberOfSegments = 30;
segmentSize = length / numberOfSegments;
(664 and 1556 are X-axis positions, 10 is the Y-axis position)
This creates 30 segments of 30 pixels wide each. My line represents a 3D-plane in the image though, so the segments should not be the same width as the line planes towards the camera.
Imagine the following points that I've found in my image:
point1 = [644 220];
point2 = [1556 5];
(664 and 1556 are X-axis positions, 220 and 5 are Y-axis positions)
The segments closer to point 1 should be small in width and the width should increase for segments closer to point 2.
How can I calculate the width of each segment on the angled line?
Thanks!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


