image-js
Version:
Image processing and manipulation in JavaScript
18 lines • 886 B
JavaScript
import { getExternalContour } from "../getExternalContour.js";
/**
* Get the pixels that surround an ROI. The pixels include the top and left borders,
* but extend the right and bottom one by one pixel.
* This allows to compute the minimum bounding rectangle with the correct surface.
* This method is only used to calculate minimalBoundRectangle and convexHull.
* @param mask - The ROI for which to get the extended border points.
* @returns - The array of points.
*/
export function getExtendedBorderPoints(mask) {
const borderPoints = getExternalContour(mask);
const result = [];
for (const point of borderPoints) {
result.push(point, { column: point.column + 1, row: point.row }, { column: point.column + 1, row: point.row + 1 }, { column: point.column, row: point.row + 1 });
}
return result;
}
//# sourceMappingURL=getExtendedBorderPoints.js.map