(
imagePath: string, width: number,
height: number)
| 21 | export const KARMA_SERVER = './base/test_data'; |
| 22 | |
| 23 | export async function loadImage( |
| 24 | imagePath: string, width: number, |
| 25 | height: number): Promise<HTMLImageElement> { |
| 26 | const img = new Image(width, height); |
| 27 | const promise = new Promise<HTMLImageElement>((resolve, reject) => { |
| 28 | img.crossOrigin = ''; |
| 29 | img.onload = () => { |
| 30 | resolve(img); |
| 31 | }; |
| 32 | }); |
| 33 | |
| 34 | img.src = `${KARMA_SERVER}/${imagePath}`; |
| 35 | |
| 36 | return promise; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Converts an RGBA image to a binary foreground mask based on an RGBA |
no outgoing calls
no test coverage detected