更新
你可以在我的 GitHub 上找到我用于测试的所有图像:
还有 2 个视频,检测也应该在其中进行
原问题
我尝试使用 OpenCV 4.xx 找到黑板的边缘(下图),但不知何故我无法成功。我目前的代码如下所示:(带有 OpenCV 和实时摄像头源的 Android),其中 imgMat 是来自摄像头源的 Mat:
Mat gray = new Mat();
Imgproc.cvtColor(imgMat, gray, Imgproc.COLOR_RGB2BGR);
Mat blurred = new Mat();
Imgproc.blur(gray, blurred, new org.opencv.core.Size(3, 3));
Mat canny = new Mat();
Imgproc.Canny(blurred, canny, 80, 230);
Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new org.opencv.core.Size(2, 2));
Mat dilated = new Mat();
Imgproc.morphologyEx(canny, dilated, Imgproc.MORPH_DILATE, kernel, new Point(0, 0), 10);
Mat rectImage = new Mat();
Imgproc.morphologyEx(dilated, rectImage, Imgproc.MORPH_CLOSE, kernel, new Point(0, 0), …
Run Code Online (Sandbox Code Playgroud) 我有一个带有命名路由的 GetMaterialApp,可在 Flutter Web 中用于仪表板项目。但是,我正在努力检查用户是否经过身份验证并根据身份验证状态重定向用户。这是我的应用程序代码:
GetMaterialApp(
initialBinding: InitialBinding(),
debugShowCheckedModeBanner: false,
theme: CustomTheme().getLightTheme,
themeMode: ThemeMode.light,
title: "----------",
initialRoute: "/login",
unknownRoute: GetPage(name: "/notfound", page: () => NotFoundPage()),
getPages: [
GetPage(name: "/login", page: () => Root()),
GetPage(name: "/dashboard", page: () => Dashboard()),
],
),
Run Code Online (Sandbox Code Playgroud)
我用来GetX
处理身份验证状态。因此,我可以访问整个 Web 应用程序的身份验证状态。Root 小部件包含一个简单的命令,Obx
用于检查身份验证状态并将用户发送到仪表板:
return Obx(() => (Get.find<AuthController>().loggedIn) ? Dashboard() : LoginScreen());
Run Code Online (Sandbox Code Playgroud)
遗憾的是,这并不能解决问题,因为 url 没有改变,只是内容改变了。URL 仍为 /login。
我可以简单地Get.toNamed("dashboard")
在用户登录时调用,但随后仪表板页面将暴露给该 url,允许用户即使未登录也可以访问 /dashboard url。
我也不想在我创建的每个小部件或页面中创建检查,因为那样效率低下。有没有办法检查用户是否登录,如果没有,则将用户重定向到输入的每个网址的登录页面?
例子:
有没有一种方法可以检查身份验证状态并相应地使用重定向用户GetX
?
旁注:我每次都能获得正确的身份验证状态,这不是问题,因为我使用 GetX。 …