- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
目标是使用 Opencv 识别输入的扫描图像是护照还是 PAN 卡。
我使用 skimage 的 structural_similarity(compare_ssim) 方法将输入扫描图像与护照和 PAN 卡模板图像进行比较。
但在这两种情况下我的得分都很低。
这是我试过的代码
from skimage.measure import compare_ssim as ssim
import matplotlib.pyplot as plt
import numpy as np
import cv2enter code here
img1 = cv2.imread('PAN_Template.jpg', 0)
img2 = cv2.imread('PAN_Sample1.jpg', 0)
def prepare_img(im):
size = 300, 200
im = cv2.resize(im, size)
return im
img1 = prepare_img(img1)
img2 = prepare_img(img2)
def compare_images(imageA, imageB):
s = ssim(imageA, imageB)
return s
ssim = compare_images(img1, img2)
print(ssim)
将 PAN 卡模板与护照进行比较,我的 ssim 分数为 0.12将 PAN 卡模板与 PAN 卡进行比较,得分为 0.20
由于两者的分数非常接近,我无法通过代码区分它们。
如果有人有任何其他解决方案或方法,请提供帮助。
这是一个示例图片 PAN Scanned Image
最佳答案
您还可以通过这两张图片的均方误差 (MSE) 来比较两张图片。
def mse(imageA, imageB):
# the 'Mean Squared Error' between the two images is the
# sum of the squared difference between the two images;
# NOTE: the two images must have the same dimension
err = np.sum((imageA.astype("float") - imageB.astype("float")) ** 2)
err /= float(imageA.shape[0] * imageA.shape[1])
# return the MSE, the lower the error, the more "similar"
# the two images are
return err
关于python-3.x - 如何区分 python 中的护照和 PAN 卡扫描图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54093601/
假设有一个应用程序有 10 个动态页面(可能是表单),其中 8 个页面是受限的(需要用户登录应用程序),另外 2 个页面可供匿名用户使用。 我的前端应用程序是在 Angular 2 中开发的,后端 A
我正在将 Passport-facebook 与 ExpressJS 和 PassportJS 一起使用 我想知道如何将显示参数设置为触摸,以便当我们的 Android 设备获取登录并允许应用程序所需
我有一个nodeJS应用程序(express),它有一个facebook登录。我正在使用 Passport-facebook 身份验证,如此处所述 passport-facebook 。几周前我的登录
我正在尝试了解在使用 Passport-facebook 和 Node/express 时 Facebook 身份验证如何工作。 我对回调URL 和下面的函数感到困惑。 有人可以向我解释一下设置回调U
我有一个问题 - 我正在为我的 api 使用 Laravel Passport。我需要编写测试。每当我在测试中使用 WithoutMiddleware 特性时,它都会禁用我使用的 Implicit r
我对 Telegram Bot API 有点陌生,在机器人中我想通过 Telegram Passport 验证用户的年龄 我正在尝试重新创建他们的 Javascript SDK .按钮出现并打开 Te
如 laravel-passport 中所述登录 Controller 由 php artisan make:auth 制成在我们的路由器中 web.php会有 Auth::routes();我们 c
Laravel 上有 API,它使用 Laravel Passport 进行身份验证。一切都在默认设置下运行良好。然后我们决定将访问 token 的生命周期相应地更改为 1 天和 1 个月。它导致刷新
目前我有一个使用 Laravel Passport 的 Laravel 安装(它使用 league/oauth2-server 作为服务器实现)。我想在授予 oauth2 token 时返回用户 ID
我试图实现护照 Facebook 我在 server.js 中的代码如下所示当用户通过 facebook 点击登录时使用的路由 router.get('/auth/facebook',
我正在使用 laravel v5.8、VueJS 和 passport v7.4 进行身份验证。下面是我的登录函数: public function login(Request $request)
我尝试在 heroku 上安装我的应用程序。这个应用程序是一个 php-laravel 应用程序,带有用于身份验证的“护照”。在我的本地机器(mac os)上一切正常。 当我尝试与 postman 进
我参加 NodeJS 类(class)和观看教程有一段时间了,并决定在应用中充分利用它们。 对于这个项目,我需要用户注册和登录,以便将他们的事件存储在数据库中。这个过程我是用Passport做的,这部
我正在尝试使用 Passport-local 来限制对网站的访问。 为此,我使用login_app来运行passport-local,但这本身就是从主app.js调用的路由。当尝试在第二层(护照文件/
在我使用护照注册用户并在数据库中查看用户后。我尝试登录,但收到消息“未经授权”。这是我的登录方法: public function login(){ if(Auth::attempt(['em
我看了很多关于 Laravel passport 的文章和视频,但仍然无法理解一些东西。 我有一个适用于 Laravel 5.5 + vueJs 的应用程序。所有对后端的请求都是通过 axios 发送
所以我想对我的 API 端点进行单元测试。我正在使用 Laravel 5.8 并且 api 身份验证是使用 Passport 完成的我有以下测试: public function guest_can_
我想知道当从 API 调用中注销用户时,在 Laravel 护照的oauth_access_tokens 表中管理 token 的最佳方法是什么? 目前我只为token设置了8小时的有效期,并把所有的
CreateFreshApiToken,一旦添加到 Kernel.php 中的“web”中间件组,应该附加 laravel_token cookie 以响应通过 web 中间件发出的每个请求,不是吗?
我正在尝试安装 Laravel Passport在 Laravel 5.7.18 上使用 PHP 7.2.13。 我的应用程序使用 JavaScript(Axios 和 Vue)在自身内部使用 API
我是一名优秀的程序员,十分优秀!