File Exchange

image thumbnail

Convert Position Vectors to Vertices, and Vice Versa!

version (2.86 KB) by Brett Shoelson
A utility function to convert between rectangular position [x y w h] and vertices [x; y]

1 Download

Updated 01 Sep 2016

View License

Many MATLAB and Toolbox functions require the specification of rectangular regions. Several use "position vectors," specified as [Xmin Ymin Width Height], many others require specification by vertex, [x; y]. For rectangular ROIs, either one defines the other. This submission facilitates easy conversion from position to vertex:
verts = posToVert(posn);
or from vertices to position:

posn = vertToPos(vert);

Simple, but useful.

Cite As

Brett Shoelson (2019). Convert Position Vectors to Vertices, and Vice Versa! (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)


Updated license

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux