Android image recognition application details

Recently, because I participated in a small creative competition, I made a small image recognition application with Android, mainly to identify the dishes in the picture and find the object location by taking photos. I haven't done Android before. I've pieced together several blogs. I also share some of the process of this project. First paste the function, in fact, click to take photos, save the photos locally, then identify the dishes in the picture, and then circle them with a red box to display the types of dishes. Using the latest Camera2 API is really easier to use than camera.

1. Interface

I used a surfaceview to display the preview screen of the camera, and rewritten a surfaceview to draw the red box and the dish name. Picture is an ImageView, which is equivalent to the function of the Photo button.

Svdraw,, inherits surfaceview and is used to draw red boxes

2. When uploading pictures to the server, instead of using JSON format, I directly convert the picture file into a byte array and send it to the server. Use an asynchronous task. After completion, draw it directly in the onpostexcute () method.

3. Initialize the interface and camera, so that the camera can preview in real time and realize the photographing function

4、AndroidManifest.xml

Today, I'll share so much code. Tomorrow, I'll share the architecture of Camera2. If you don't understand, you can comment and discuss together.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>