简体   繁体   English

在CameraPreview上绘制正方形(android)

[英]Drawing square over CameraPreview (android)

So I am trying to draw square over live CameraPreview. 因此,我试图在实时CameraPreview上绘制正方形。

I followed camera instructions on developer.android and I got CameraPreview class set up. 我遵循了developer.android上的相机说明,并设置了CameraPreview类。 I was wondering how could I draw a square on top of the live image. 我想知道如何在实时图像的上方绘制一个正方形。

Something what we can see in face detection on cameras. 我们可以在相机的面部检测中看到的东西。 I wont use it for face detection but same idea. 我不会将其用于人脸检测,但是相同的想法。

I have CameraPreview object that i place in my camera activity. 我在我的相机活动中放置了CameraPreview对象。 Now any suggestions on how to go about learning about this or if you know of any code sample for it. 现在,有关如何进行学习的任何建议,或者是否知道任何代码示例。

That would be great. 那很好啊。 And I am looking to do this in API 10. Not 14 which supports it through sdk. 我正在API 10中进行此操作。不是通过sdk支持它的14。

This is what my current camera app code is based on http://developer.android.com/guide/topics/media/camera.html 这是我当前的相机应用代码基于http://developer.android.com/guide/topics/media/camera.html的内容

Thanks 谢谢

Put your SurfaceView (which you need for the camera preview) inside of a FrameLayout . 将您的SurfaceView (相机预览所需的)放在FrameLayout Then, you can put that square image right on top of the camera preview. 然后,您可以将该正方形图像放在相机预览的顶部。

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

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