简体   繁体   English

OpenCV-Python:如何检测热图像中的热点?

[英]OpenCV-Python: How to detect a hotspot in thermal image?

I am using openCV and Python to make a computer vision application that detects hotspots in an image from thermal cameras.我正在使用 openCV 和 Python 制作一个计算机视觉应用程序,该应用程序可检测热像仪图像中的热点。

The image is basically of a big machinery and I want to get the hottest (in terms of temperature) part of the image.图像基本上是一个大型机械,我想获得图像中最热(就温度而言)的部分。
What I thought of till now:到现在为止我的想法是:

  1. Use color quantization (and K-means) to reduce the number of colors to 8.使用颜色量化(和 K 均值)将颜色数量减少到 8。
  2. Use some sort of thresholding and get the cluster with most amount of red (since usually red=more heat).使用某种阈值并获得最多红色的簇(因为通常红色=更多热量)。

Now I've successfully done the first part.现在我已经成功完成了第一部分。 I have a quantized image which contains 8 colors only.我有一个仅包含 8 种颜色的量化图像。
All the thresholding I've done till now needs me to put the color range myself (ie using cv2.inRange function to create a mast and then using cv2.bitwiseAND to apply the mask to the image).到目前为止,我所做的所有阈值处理都需要我自己放置颜色范围(即使用cv2.inRange函数创建一个桅杆,然后使用cv2.bitwiseAND将蒙版应用于图像)。 But here I want it to be dynamic, so that it just gets the hottest part.但在这里我希望它是动态的,这样它就可以得到最热门的部分。 ie even if there is very little red, it should just get me the region with most red.即,即使红色很少,它也应该让我找到红色最多的区域。

So what is a way to do that?那么有什么方法可以做到这一点呢?

(Also, by "Hotspots", here I mean actual HOT spots. Ie spots which have the highest temparature.) (另外,这里的“热点”是指实际的热点。即温度最高的点。)

Edit: As the comment from Photon mentioned, currently I'm calculating the histogram of red and using that to set the threshold.编辑:正如Photon的评论所提到的,目前我正在计算红色的直方图并使用它来设置阈值。
I'm looking to optimize this further, so let me know if any more efficient method exists.我希望进一步优化它,所以如果存在更有效的方法,请告诉我。 (The process should be fast. I can compromise on the accuracy to an extent) (这个过程应该很快。我可以在一定程度上妥协准确性)

In order to estimate a threshold dynamically, you need to look at the distribution of the data.为了动态估计阈值,您需要查看数据的分布。 For this purpose, you need to calculate the histogram of the red.为此,您需要计算红色的直方图。 Then, find a threshold such that a certain percentage of the pixels are below it.然后,找到一个阈值,使一定百分比的像素低于它。 For example 90%.例如 90%。

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

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