久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

OpenCV 中用于虹膜檢測的 HoughCircles 的正確用法/參

What are the correct usage/parameter values for HoughCircles in OpenCV for Iris detection?(OpenCV 中用于虹膜檢測的 HoughCircles 的正確用法/參數值是什么?)
本文介紹了OpenCV 中用于虹膜檢測的 HoughCircles 的正確用法/參數值是什么?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我一直在閱讀有關該主題的文章,但無法以簡單的英語"了解 HoughCircles 的用法和參數(特別是 CV_HOUGH_GRADIENT 之后的那些).

I've been reading about the subject but cannot get the idea in "plain English" about the usage and parameters for HoughCircles (specially the ones after CV_HOUGH_GRADIENT).

什么是累加器閾值?100票"是正確的值嗎?

What's an accumulator threshold? Are 100 "votes" a right value?

我可以找到并掩蓋"瞳孔,并通過 Canny 函數工作,但我正在努力超越,我的問題是 HoughCircles 函數.似乎無法找到 Iris 的圈子,我不知道為什么.

I could find and "mask" the pupil, and worked my way through the Canny function, but I'm struggling beyond that and my problem is the HoughCircles function. There seems to be failing at finding the Iris' circle and I don't know why.

這是我正在處理的功能:

And this is the function I'm working on:

def getRadius(area):
    r = 1.0
    r = math.sqrt(area/3.14)
    return (r)

def getIris(frame):
    grayImg = cv.CreateImage(cv.GetSize(frame), 8, 1)
    cv.CvtColor(frame,grayImg,cv.CV_BGR2GRAY)
    cv.Smooth(grayImg,grayImg,cv.CV_GAUSSIAN,9,9)
    cv.Canny(grayImg, grayImg, 32, 2)
    storage = cv.CreateMat(grayImg.width, 1, cv.CV_32FC3)
    minRad = int(getRadius(pupilArea))
    circles = cv.HoughCircles(grayImg, storage, cv.CV_HOUGH_GRADIENT, 2, 10,32,200,minRad, minRad*2)
    cv.ShowImage("output", grayImg)
    while circles:
        cv.DrawContours(frame, circles, (0,0,0), (0,0,0), 2)
        # this message is never shown, therefore I'm not detecting circles
        print "circle!"
        circles = circles.h_next()
    return (frame)

推薦答案

HoughCircles 可能有點棘手,我建議查看 這個線程.包括我在內的一群人;),討論如何使用它.關鍵參數是param2,即所謂的accumulator threshold.基本上,它越高,你得到的圈子就越少.而且這些圓圈有更高的正確概率.每個圖像的最佳價值都不同.我認為最好的方法是在 param2 上使用參數搜索.IE.繼續嘗試值,直到滿足您的條件(例如:有 2 個圓圈,或不重疊的最大圓圈數等).我有一些對param2"進行二進制搜索的代碼,所以它很快就滿足了條件.

HoughCircles can be kind of tricky, I suggest looking through this thread. Where a bunch of people, including me ;), discuss how to use it. The key parameter is param2, the so-called accumulator threshold. Basically, the higher it is the less circles you get. And these circles have a higher probability of being correct. The best value is different for every image. I think the best approach is to use a parameter search on param2. Ie. keep on trying values until your criteria is met (such as: there are 2 circles, or max. number of circles that are non-overlapping, etc.). I have some code that does a binary search on 'param2', so it meet the criteria quickly.

另一個關鍵因素是預處理,盡量減少噪點并簡化圖像.模糊/閾值/canny的某種組合對此有好處.

The other crucial factor is pre-processing, try to reduce noise, and simplify the image. Some combination of blurring/thresholding/canny is good for this.

無論如何,我明白了:

從您上傳的圖片中,使用以下代碼:

From your uploded image, using this code:

import cv
import numpy as np

def draw_circles(storage, output):
    circles = np.asarray(storage)
    for circle in circles:
        Radius, x, y = int(circle[0][3]), int(circle[0][0]), int(circle[0][4])
        cv.Circle(output, (x, y), 1, cv.CV_RGB(0, 255, 0), -1, 8, 0)
        cv.Circle(output, (x, y), Radius, cv.CV_RGB(255, 0, 0), 3, 8, 0)    

orig = cv.LoadImage('eyez.png')
processed = cv.LoadImage('eyez.png',cv.CV_LOAD_IMAGE_GRAYSCALE)
storage = cv.CreateMat(orig.width, 1, cv.CV_32FC3)
#use canny, as HoughCircles seems to prefer ring like circles to filled ones.
cv.Canny(processed, processed, 5, 70, 3)
#smooth to reduce noise a bit more
cv.Smooth(processed, processed, cv.CV_GAUSSIAN, 7, 7)

cv.HoughCircles(processed, storage, cv.CV_HOUGH_GRADIENT, 2, 32.0, 30, 550)
draw_circles(storage, orig)

cv.ShowImage("original with circles", orig)
cv.WaitKey(0)

更新

我意識到我有點看錯了你的問題!您實際上想要找到 iris 邊緣.他們沒有像學生那樣明確定義.所以我們需要盡可能地幫助HoughCircles.我們可以這樣做:

I realise I somewhat miss-read your question! You actually want to find the iris edges. They are not so clearly defined, as the pupils. So we need to help HoughCircles as much as possible. We can do this, by:

  1. 指定虹膜的大小范圍(我們可以根據瞳孔大小計算出一個合理的范圍).
  2. 增加圓心之間的最小距離(我們知道兩個虹膜永遠不會重疊,因此我們可以安全地將其設置為我們的最小虹膜尺寸)

然后我們需要再次對 param2 進行參數搜索.將上述代碼中的HoughCircles"行替換為:

And then we need to do a param search on param2 again. Replacing the 'HoughCircles' line in the above code with this:

cv.HoughCircles(processed, storage, cv.CV_HOUGH_GRADIENT, 2, 100.0, 30, 150,100,140)

告訴我們這個:

這還不錯.

這篇關于OpenCV 中用于虹膜檢測的 HoughCircles 的正確用法/參數值是什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區域周圍繪制一個矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個矩形邊界框中應用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: www.久| 免费国产精品久久久久久 | 欧美第一区 | 一区二区三区四区电影 | 久久精品国产一区老色匹 | 天堂一区二区三区四区 | 国产一区二区中文字幕 | 在线观看免费高清av | 成人特级毛片 | 日本一区二区不卡 | 毛片电影 | 国产在线高清 | 韩国理论电影在线 | 黄色精品 | 亚洲一级毛片 | 亚洲一区中文字幕在线观看 | 电影午夜精品一区二区三区 | 精品一区二区三区日本 | 成人免费在线观看视频 | 精品视频一二区 | 亚州av | 欧美综合在线观看 | a在线免费观看 | 国产精品成av人在线视午夜片 | 日韩成人影院 | 国产 亚洲 网红 主播 | 午夜免费观看网站 | 免费国产一区二区 | 成人在线亚洲 | 宅女噜噜66国产精品观看免费 | 91精品国产综合久久婷婷香蕉 | 黄在线免费观看 | 午夜久久久| 精品粉嫩aⅴ一区二区三区四区 | av在线播放国产 | 成人免费视频网站在线看 | 日韩毛片中文字幕 | 国产一级在线观看 | 精品国产一区探花在线观看 | 国产一二区视频 | 亚洲大片一区 |