【发布时间】:2018-10-04 06:05:14
【问题描述】:
我正在处理一个试图识别瞳孔中间的问题。
现在我正在开发一个 Opencv 程序来检测瞳孔,我已经实现了这个目标,但我需要提高准确性。因此,我将展示用于检测瞳孔的代码和带有结果的图像。
def get_irises_location(self, frame_gray):
self.eye_cascade = cv2.CascadeClassifier(join('haar', 'haarcascade_eye.xml'))
eyes = self.eye_cascade.detectMultiScale(frame_gray, 1.3, 10) # if not empty - eyes detected
irises = []
for (ex, ey, ew, eh) in eyes:
iris_w = int(ex + float(ew / 2))
iris_h = int(ey + float(eh / 2))
irises.append([numpy.float32(iris_w), numpy.float32(iris_h)])
return numpy.array(irises)
如你所见,我已经检测到眼睛瞳孔,但我需要打到它的中间。
【问题讨论】:
-
你对那个灰度图做了预处理吗?
-
是的,我做到了。首先我将图像转换为灰度,然后进行计算。
标签: python opencv image-processing