MCPcopy Create free account
hub / github.com/a7medev/react-native-ml-kit / scaleFrame

Function scaleFrame

example/src/core/scaling.ts:88–113  ·  view source on GitHub ↗
(
  imageWidth: number,
  imageHeight: number,
  screenWidth: number,
)

Source from the content-addressed store, hash-verified

86}
87
88export function scaleFrame(
89 imageWidth: number,
90 imageHeight: number,
91 screenWidth: number,
92) {
93 return function scaledFrame(frame?: Frame): Frame | undefined {
94 if (!frame) {
95 return;
96 }
97
98 const portrait = imageHeight > imageWidth;
99
100 if (portrait) {
101 return scaleFramePortrait(screenWidth, imageWidth, imageHeight, frame);
102 }
103
104 return rotateFrame(
105 scaleFramePortrait(
106 screenWidth,
107 imageHeight,
108 imageWidth,
109 rotateFrame(frame),
110 ),
111 );
112 };
113}

Callers 2

TextMapFunction · 0.90
FaceMapFunction · 0.90

Calls 2

scaleFramePortraitFunction · 0.85
rotateFrameFunction · 0.85

Tested by

no test coverage detected