【问题标题】:The camera displays a stretched image相机显示拉伸的图像
【发布时间】:2022-06-14 22:51:24
【问题描述】:

我有那个代码:

final size = MediaQuery.of(context).size;
    final deviceRatio = size.width / size.height;
    return Align(
      alignment: Alignment.topCenter,
      child: AspectRatio(
        aspectRatio: deviceRatio,
        child: Stack(
          children: <Widget>[
            CustomPaint(
              foregroundPainter: MeasureFaceOutline(isPosCorrect: true),
              child: Transform(
                alignment: Alignment.center,
                transform: Platform.isIOS ? Matrix4.rotationX(math.pi) : Matrix4.identity(),
                child: Texture(textureId: textureId),
              ),
            ),
          ],
        ),
      ),
    );
  }

而且我的相机视角非常拉伸。如何设置显示相机视图的比例(或变换)不拉伸

编辑: 如果我这样使用 CameraPreview:

Transform.scale(
                scale: 1.7,
                child: Center(
                  child: CameraPreview(controller!),
                ),
              )

一切正常,但我必须使用 Texture 代替 CameraPreview

【问题讨论】:

  • 我认为问题在于底层纹理正在返回您以某种方式拉伸的固定大小。您可以尝试使用BoxFit 或在本机端进行计算以查看纹理应该有多大的尺寸。
  • 我还是不知道如何计算这个尺寸。

标签: android flutter dart android-camera textures


猜你喜欢
  • 2021-08-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-27
  • 1970-01-01
  • 2012-06-24
相关资源
最近更新 更多