Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function debugImage(image: cv.Mat, filename: string, suffix?: string) {
const parsedPath = path.parse(filename);
let fullFilename = parsedPath.name;
if (suffix) {
fullFilename = fullFilename + "_" + suffix;
}
fullFilename += parsedPath.ext;
const fullPath = path.join(parsedPath.dir, fullFilename);
cv.imwriteAsync(fullPath, image);
}
public async store(data: Image, path: string): Promise {
let outputMat: cv.Mat;
if (data.hasAlphaChannel) {
outputMat = await ImageProcessor.fromImageWithAlphaChannel(data);
} else {
outputMat = await ImageProcessor.fromImageWithoutAlphaChannel(data);
}
return cv.imwriteAsync(path, outputMat);
}
}