简体   繁体   English

在使用OpenCV4Android的应用程序中,如何确定相机是在拍摄8位图像还是32位图像?

[英]In an app using OpenCV4Android, how to find out if the camera is taking 8-bit image or 32-bit image?

In OpenCV HSV images, the scale of Hue depends on the type of image. 在OpenCV HSV图像中,Hue的比例取决于图像的类型。 From this answer , 这个答案

For HSV images it depends on the image type (see OpenCV doc): 对于HSV图像,它取决于图像类型(请参阅OpenCV文档):

8 bit images: H in [0, 180], S,V in [0, 255] 8位图像:[0,180]中为H,[0,255]中为S,V

32bit images: H in [0, 360] ,S,V in [0,1] 32位图像:[0,360]中为H,[0,1]中为S,V

I have two questions: 我有两个问题:

  1. How do I know which type of image or frame (whether 8-bit or 32-bit) is the camera detecting, eg how would I know in this class in the Color Blob Detection sample application? 我如何知道相机正在检测哪种类型的图像或帧(无论是8位还是32位),例如我如何在“色斑检测”示例应用程序的此类中知道?

  2. Is there a way to force the camera to take 32 bit image (because I really want the second scale, and if there is no way, I will have to find a way to convert the first scale to the second one, because Android's Color.HSVToColor method follows the second scale)? 有没有一种方法可以强迫相机拍摄32位图像(因为我真的想要第二个比例尺,如果没有办法,我将不得不找到一种方法将第一个比例尺转换为第二个比例尺,因为Android的是Color.HSVToColor方法遵循第二个标度)?

1) It uses CvType.CV_8U so that means 8 bit unsigned. 1)它使用CvType.CV_8U表示8位无符号。

2) Probably not, you have to dive in the part of code that actually controls the camera and grabs a frame to find this out. 2)可能不是,您必须深入研究实际控制摄像机的代码部分,并抓住一个框架来找出答案。 However, you can simply convert a 8 bit image to 32 bit by using convertTo functions. 但是,您可以使用convertTo函数将8位图像简单地转换为32位。

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

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