Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise<img>(async (resolve, reject) => {
try {
const image = await cv.imreadAsync(path, cv.IMREAD_UNCHANGED);
resolve(new Image(image.cols, image.rows, image.getData(), image.channels));
} catch (e) {
reject(`Failed to load image from '${path}'`);
}
});
}