How can I calculate directional vector of a line connecting two points?

27 次查看(过去 30 天)
The two points are pixel position of an image

回答(1 个)

goerk
goerk 2016-5-19
Startpoint = [1 2];
Endpoint = [3 3];
direction = Endpoint - Startpoint;
direction_scaled = direction/norm(direction); % vector with length 1

类别

Help CenterFile Exchange 中查找有关 Image Filtering and Enhancement 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by