简体   繁体   English

如何在 Android Studio 中的图像上显示矩形

[英]How to display a rectangle over an Image in Android Studio

I am working on a parking space detection Android application written in Java.我正在开发一个用 Java 编写的停车位检测 Android 应用程序。 How would I go upon displaying a marker or bounding box in each of the empty parking spots of the parking lot image?我将如何在停车场图像的每个空停车位中显示标记或边界框?

The data for the coordinates of each vacant parking space will come from a JSON file and I would display that onto the parking lot image.每个空闲停车位的坐标数据将来自一个 JSON 文件,我会将其显示在停车场图像上。

The JSON would be something like this where x,y corresponds to the pixels of the image. JSON 将是这样的,其中 x,y 对应于图像的像素。

[ 
 {
  "Space": "001", 
  "Row": "1",
  "x": "1000",
  "y": "500"
 }, 
 {
  "Space": "001", 
  "Row": "1",
  "x": "800",
  "y": "600"
 }
]

Here is a sample image of how the bounding box could be displayed:这是如何显示边界框的示例图像:

在此处输入图片说明

Sorry this should have been a comment but I will suggest you use opencv for android and implement the Mat and MatOfRect class to get a rectangle around the points/pixels抱歉,这应该是一个评论,但我建议您使用 opencv for android 并实现 Mat 和 MatOfRect 类以获取点/像素周围的矩形

Here is a guide link https://opencv.org/android/这是一个指南链接https://opencv.org/android/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM