Skip to content

Commit

Permalink
feat wip add a check in median
Browse files Browse the repository at this point in the history
  • Loading branch information
EscapedGibbon committed Jun 12, 2024
1 parent ee2a932 commit e3ead66
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/compute/median.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export interface MedianOptions {
export function median(image: Image, options?: MedianOptions): number[] {
const pixel = new Array<number>(image.channels).fill(0);
if (options) {
if (options.points.length === 0) {
throw new RangeError('Invalid number of points.');
}
for (let i = 0; i < image.channels; i++) {
const channel: number[] = [];
for (const point of options.points) {
Expand Down

0 comments on commit e3ead66

Please sign in to comment.