MCPcopy Create free account
hub / github.com/expo/examples / CustomTensorCamera

Function CustomTensorCamera

with-tfjs-camera/src/CustomTensorCamera.js:18–42  ·  view source on GitHub ↗
({ style, width, ...props })

Source from the content-addressed store, hash-verified

16const TensorCamera = cameraWithTensors(Camera);
17
18export function CustomTensorCamera({ style, width, ...props }) {
19 const sizeStyle = React.useMemo(() => {
20 const ratio = width / TEXTURE_SIZE.width;
21 const cameraWidth = TEXTURE_SIZE.width * ratio;
22 const cameraHeight = TEXTURE_SIZE.height * ratio;
23 return {
24 maxWidth: cameraWidth,
25 minWidth: cameraWidth,
26 maxHeight: cameraHeight,
27 minHeight: cameraHeight,
28 };
29 }, [width]);
30
31 return (
32 <TensorCamera
33 {...props}
34 style={[style, sizeStyle]}
35 cameraTextureWidth={TEXTURE_SIZE.width}
36 cameraTextureHeight={TEXTURE_SIZE.height}
37 resizeWidth={TENSOR_SIZE.width}
38 resizeHeight={TENSOR_SIZE.height}
39 resizeDepth={3}
40 />
41 );
42}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected