jenly1314 / MLKit

🌝 MLKit是一个强大易用的工具包。通过ML Kit您可以很轻松的实现文字识别、条码识别、图像标记、人脸检测、对象检测等功能。
https://jenly1314.github.io/MLKit/
Apache License 2.0
892 stars 160 forks source link

打开摄像头扫二维码 然后再次打开扫码 可以扫出结果,但是如果快速打开 偶尔出现黑屏问题 这个是什么原因呢? #35

Closed will12190 closed 11 months ago

will12190 commented 1 year ago

我是开始用zxinglite 但是发现没有多二维码支持 然后用的这个库 这2个库使用非常相似 这个黑屏问题如何解决呢?

jenly1314 commented 1 year ago

我是开始用zxinglite 但是发现没有多二维码支持 然后用的这个库 这2个库使用非常相似 这个黑屏问题如何解决呢?

麻烦提供相关日志

will12190 commented 1 year ago

我先跟踪下是不是我使用问题 我们现在扫码框外的区域要配置黑色 我在想是不是这个颜色导致的

获取Outlook for Androidhttps://aka.ms/AAb9ysg


From: Jenly @.> Sent: Monday, July 10, 2023 9:44:40 AM To: jenly1314/MLKit @.> Cc: will12190 @.>; Author @.> Subject: Re: [jenly1314/MLKit] 打开摄像头扫二维码 然后再次打开扫码 可以扫出结果,但是如果快速打开 偶尔出现黑屏问题 这个是什么原因呢? (Issue #35)

我是开始用zxinglite 但是发现没有多二维码支持 然后用的这个库 这2个库使用非常相似 这个黑屏问题如何解决呢?

麻烦提供相关日志

― Reply to this email directly, view it on GitHubhttps://github.com/jenly1314/MLKit/issues/35#issuecomment-1627946538, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALTYQK2TSKESVF3YO6BCNM3XPNNARANCNFSM6AAAAAA2B4QHXQ. You are receiving this because you authored the thread.Message ID: @.***>

will12190 commented 1 year ago

请问多个二维码的时候 result的centeX centerY的坐标是基于谁的呢?

获取Outlook for Androidhttps://aka.ms/AAb9ysg


From: wang will @.> Sent: Monday, July 10, 2023 9:53:11 AM To: jenly1314/MLKit @.>; jenly1314/MLKit @.> Cc: Author @.> Subject: Re: [jenly1314/MLKit] 打开摄像头扫二维码 然后再次打开扫码 可以扫出结果,但是如果快速打开 偶尔出现黑屏问题 这个是什么原因呢? (Issue #35)

我先跟踪下是不是我使用问题 我们现在扫码框外的区域要配置黑色 我在想是不是这个颜色导致的

获取Outlook for Androidhttps://aka.ms/AAb9ysg


From: Jenly @.> Sent: Monday, July 10, 2023 9:44:40 AM To: jenly1314/MLKit @.> Cc: will12190 @.>; Author @.> Subject: Re: [jenly1314/MLKit] 打开摄像头扫二维码 然后再次打开扫码 可以扫出结果,但是如果快速打开 偶尔出现黑屏问题 这个是什么原因呢? (Issue #35)

我是开始用zxinglite 但是发现没有多二维码支持 然后用的这个库 这2个库使用非常相似 这个黑屏问题如何解决呢?

麻烦提供相关日志

― Reply to this email directly, view it on GitHubhttps://github.com/jenly1314/MLKit/issues/35#issuecomment-1627946538, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALTYQK2TSKESVF3YO6BCNM3XPNNARANCNFSM6AAAAAA2B4QHXQ. You are receiving this because you authored the thread.Message ID: @.***>

jenly1314 commented 1 year ago

请问多个二维码的时候 result的centeX centerY的坐标是基于谁的呢? 获取Outlook for Androidhttps://aka.ms/AAb9ysg ____ From: wang will @.> Sent: Monday, July 10, 2023 9:53:11 AM To: jenly1314/MLKit @.>; jenly1314/MLKit @.> Cc: Author @.> Subject: Re: [jenly1314/MLKit] 打开摄像头扫二维码 然后再次打开扫码 可以扫出结果,但是如果快速打开 偶尔出现黑屏问题 这个是什么原因呢? (Issue #35) 我先跟踪下是不是我使用问题 我们现在扫码框外的区域要配置黑色 我在想是不是这个颜色导致的 获取Outlook for Androidhttps://aka.ms/AAb9ysg ____ From: Jenly @.> Sent: Monday, July 10, 2023 9:44:40 AM To: jenly1314/MLKit @.> Cc: will12190 @.>; Author @.> Subject: Re: [jenly1314/MLKit] 打开摄像头扫二维码 然后再次打开扫码 可以扫出结果,但是如果快速打开 偶尔出现黑屏问题 这个是什么原因呢? (Issue #35) 我是开始用zxinglite 但是发现没有多二维码支持 然后用的这个库 这2个库使用非常相似 这个黑屏问题如何解决呢? 麻烦提供相关日志 ― Reply to this email directly, view it on GitHub<#35 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALTYQK2TSKESVF3YO6BCNM3XPNNARANCNFSM6AAAAAA2B4QHXQ. You are receiving this because you authored the thread.Message ID: @.***>

基于分析的图像,显示到屏幕时需要做一次转换,可以参考demo中的示例:QRCodeScanningActivity

will12190 commented 1 year ago

如果中间的圆圈是自己传入的图片,也要做缩放动画怎么处理呢? 每次裁剪新的bitmap吗?

获取Outlook for Androidhttps://aka.ms/AAb9ysg


From: Jenly @.> Sent: Monday, July 10, 2023 4:08:16 PM To: jenly1314/MLKit @.> Cc: will12190 @.>; Author @.> Subject: Re: [jenly1314/MLKit] 打开摄像头扫二维码 然后再次打开扫码 可以扫出结果,但是如果快速打开 偶尔出现黑屏问题 这个是什么原因呢? (Issue #35)

请问多个二维码的时候 result的centeX centerY的坐标是基于谁的呢? 获取Outlook for Androidhttps://aka.ms/AAb9ysg … ____ From: wang will @.> Sent: Monday, July 10, 2023 9:53:11 AM To: jenly1314/MLKit @.>; jenly1314/MLKit @.> Cc: Author @.> Subject: Re: [jenly1314/MLKit] 打开摄像头扫二维码 然后再次打开扫码 可以扫出结果,但是如果快速打开 偶尔出现黑屏问题 这个是什么原因呢? (Issue #35https://github.com/jenly1314/MLKit/issues/35) 我先跟踪下是不是我使用问题 我们现在扫码框外的区域要配置黑色 我在想是不是这个颜色导致的 获取Outlook for Androidhttps://aka.ms/AAb9ysg ____ From: Jenly @.> Sent: Monday, July 10, 2023 9:44:40 AM To: jenly1314/MLKit @.> Cc: will12190 @.>; Author @.> Subject: Re: [jenly1314/MLKit] 打开摄像头扫二维码 然后再次打开扫码 可以扫出结果,但是如果快速打开 偶尔出现黑屏问题 这个是什么原因呢? (Issue #35https://github.com/jenly1314/MLKit/issues/35) 我是开始用zxinglite 但是发现没有多二维码支持 然后用的这个库 这2个库使用非常相似 这个黑屏问题如何解决呢? 麻烦提供相关日志 D Reply to this email directly, view it on GitHub<#35 (comment)https://github.com/jenly1314/MLKit/issues/35#issuecomment-1627946538>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALTYQK2TSKESVF3YO6BCNM3XPNNARANCNFSM6AAAAAA2B4QHXQ. You are receiving this because you authored the thread.Message ID: @.***>

基于分析的图像,显示到屏幕时需要做一次转换,可以参考demo中的示例:QRCodeScanningActivityhttps://github.com/jenly1314/MLKit/blob/master/app/src/main/java/com/king/mlkit/vision/app/barcode/QRCodeScanningActivity.kt

― Reply to this email directly, view it on GitHubhttps://github.com/jenly1314/MLKit/issues/35#issuecomment-1628447451, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALTYQK2P5CHWTU2C4T7BCFTXPOZ7BANCNFSM6AAAAAA2B4QHXQ. You are receiving this because you authored the thread.Message ID: @.***>

will12190 commented 1 year ago

已经解决动画问题
/**

jenly1314 commented 1 year ago

已经解决动画问题 /* 绘制结果点 @param canvas @param point / private void drawResultPoint(Canvas canvas, Point point, float currentZoomRatio) { if (pointBitmap != null) { float left = point.x - pointBitmap.getWidth()currentZoomRatio / 2.0f; float top = point.y - pointBitmap.getHeight()currentZoomRatio / 2.0f; //canvas.drawBitmap(pointBitmap, left, top, paint);

        Matrix matrix=new Matrix();
        matrix.postScale(currentZoomRatio,currentZoomRatio);
        matrix.postTranslate(left,top);
        canvas.drawBitmap(pointBitmap,matrix,paint);
    } else {
        paint.setColor(pointStrokeColor);
        canvas.drawCircle(point.x, point.y, pointStrokeRadius * currentZoomRatio, paint);

        paint.setColor(pointColor);
        canvas.drawCircle(point.x, point.y, pointRadius * currentZoomRatio, paint);
    }

}

可以用这个ViewfinderView 配置更全面,后续计划会移除MLKit内部的ViewfinderView

will12190 commented 1 year ago

但是你这个配置的图片没动画 我不得不去改的源码

获取Outlook for Androidhttps://aka.ms/AAb9ysg


From: Jenly @.> Sent: Monday, July 10, 2023 6:57:35 PM To: jenly1314/MLKit @.> Cc: will12190 @.>; Author @.> Subject: Re: [jenly1314/MLKit] 打开摄像头扫二维码 然后再次打开扫码 可以扫出结果,但是如果快速打开 偶尔出现黑屏问题 这个是什么原因呢? (Issue #35)

已经解决动画问题 /* 绘制结果点 @paramhttps://github.com/param canvas @paramhttps://github.com/param point / private void drawResultPoint(Canvas canvas, Point point, float currentZoomRatio) { if (pointBitmap != null) { float left = point.x - pointBitmap.getWidth()currentZoomRatio / 2.0f; float top = point.y - pointBitmap.getHeight()currentZoomRatio / 2.0f; //canvas.drawBitmap(pointBitmap, left, top, paint);

    Matrix matrix=new Matrix();
    matrix.postScale(currentZoomRatio,currentZoomRatio);
    matrix.postTranslate(left,top);
    canvas.drawBitmap(pointBitmap,matrix,paint);
} else {
    paint.setColor(pointStrokeColor);
    canvas.drawCircle(point.x, point.y, pointStrokeRadius * currentZoomRatio, paint);

    paint.setColor(pointColor);
    canvas.drawCircle(point.x, point.y, pointRadius * currentZoomRatio, paint);
}

}

可以用这个ViewfinderViewhttps://github.com/jenly1314/ViewfinderView 配置更全面,后续计划会移除MLKit内部的ViewfinderView

― Reply to this email directly, view it on GitHubhttps://github.com/jenly1314/MLKit/issues/35#issuecomment-1628712749, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALTYQKYT7AOCCBMYEEP5Y73XPPNZ7ANCNFSM6AAAAAA2B4QHXQ. You are receiving this because you authored the thread.Message ID: @.***>

jenly1314 commented 1 year ago

但是你这个配置的图片没动画 我不得不去改的源码 获取Outlook for Androidhttps://aka.ms/AAb9ysg ____ From: Jenly @.> Sent: Monday, July 10, 2023 6:57:35 PM To: jenly1314/MLKit @.> Cc: will12190 @.>; Author @.> Subject: Re: [jenly1314/MLKit] 打开摄像头扫二维码 然后再次打开扫码 可以扫出结果,但是如果快速打开 偶尔出现黑屏问题 这个是什么原因呢? (Issue #35) 已经解决动画问题 / 绘制结果点 @paramhttps://github.com/param canvas @paramhttps://github.com/param point / private void drawResultPoint(Canvas canvas, Point point, float currentZoomRatio) { if (pointBitmap != null) { float left = point.x - pointBitmap.getWidth()currentZoomRatio / 2.0f; float top = point.y - pointBitmap.getHeight()currentZoomRatio / 2.0f; //canvas.drawBitmap(pointBitmap, left, top, paint); Matrix matrix=new Matrix(); matrix.postScale(currentZoomRatio,currentZoomRatio); matrix.postTranslate(left,top); canvas.drawBitmap(pointBitmap,matrix,paint); } else { paint.setColor(pointStrokeColor); canvas.drawCircle(point.x, point.y, pointStrokeRadius currentZoomRatio, paint); paint.setColor(pointColor); canvas.drawCircle(point.x, point.y, pointRadius currentZoomRatio, paint); } } 可以用这个ViewfinderViewhttps://github.com/jenly1314/ViewfinderView 配置更全面,后续计划会移除MLKit内部的ViewfinderView ― Reply to this email directly, view it on GitHub<#35 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALTYQKYT7AOCCBMYEEP5Y73XPPNZ7ANCNFSM6AAAAAA2B4QHXQ. You are receiving this because you authored the thread.Message ID: @.>

有的,仔细看下前面回复的链接。