MCPcopy
hub / github.com/tensorflow/tfjs-models / loadImage

Function loadImage

shared/test_util.ts:23–37  ·  view source on GitHub ↗
(
    imagePath: string, width: number,
    height: number)

Source from the content-addressed store, hash-verified

21export const KARMA_SERVER = './base/test_data';
22
23export 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

Callers 15

testBackendFunction · 0.90
expectImageFunction · 0.90
body_pix_test.tsFile · 0.90
mediapipe_test.tsFile · 0.90
tfjs_test.tsFile · 0.90
tfjs_test.tsFile · 0.90
mediapipe_test.tsFile · 0.90
runTestFunction · 0.90
getBinarySegmentationFunction · 0.90
getColoredSegmentationFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected