国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

圖像處理之hough圓形檢測

這篇具有很好參考價值的文章主要介紹了圖像處理之hough圓形檢測。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

hough檢測原理

點擊圖像處理之Hough變換檢測直線查看
下面直接描述檢測圓形的方法

基于Hough變換的圓形檢測方法

對于一個半徑為 r r r,圓心為 ( a , b ) (a,b) a,b的圓,我們將其表示為:
( x ? a ) 2 + ( y ? b ) 2 = r 2 (x-a)^2+(y-b)^2=r^2 (x?a)2+(y?b)2=r2
此時 x = [ x , y ] T , a = [ a , b , r ] T x=[x,y]^T,a=[a,b,r]^T x=[x,y]T,a=[a,b,r]T,其參數(shù)空間為三維。顯然,圖像空間上的一點 ( x , y ) (x,y) x,y,在參數(shù)空間中對應(yīng)著一個圓錐,如下圖所示。
圖像處理之hough圓形檢測,圖像處理,圖像處理,人工智能
而圖像空間的一個圓就對應(yīng)著這一簇圓錐相交的一個點,這個特定點在參數(shù)空間的三維參數(shù)一定,就表示一定半徑一定圓心坐標(biāo)的圖像空間的那個圓。
上述方法是經(jīng)典的Hough圓檢測方法的原理,它具有精度高,抗干擾能力強(qiáng)等優(yōu)點,但由于該方法的參數(shù)空間為三維,要在三維空間上進(jìn)行證據(jù)累計的話,需要的時間和空間都是龐大的,在實際應(yīng)用中不適用。為加快Hough變換檢測圓的速度,學(xué)者們進(jìn)行了大量研究,也出現(xiàn)了很多改進(jìn)的Hough變換檢測圓的方法。如利用圖像梯度信息的Hough變換,對圓的標(biāo)準(zhǔn)方程對x求導(dǎo)得到下式:
2 ( x ? a ) + 2 ( y ? b ) d y d x = 0 2(x-a)+2(y-b)\frac{dy}{dx}=0 2(x?a)+2(y?b)dxdy?=0
從上式看出,此時的參數(shù)空間從半徑 r r r,圓心 ( a , b ) (a,b) a,b三維,變成了只有圓心 ( a , b ) (a,b) a,b的二維空間,利用這種方法檢測圓其計算量明顯減少了。
但這種改進(jìn)的Hough變換檢測圓的方法其檢測精度并不高,原因在于,此種方法利用了邊界斜率。
從本質(zhì)上講,邊界斜率其實是用曲線在某一點的弦的斜率來代替的,這種情況下,要保證不存在誤差,只有在弦長為零的情況。但在數(shù)字圖像中,曲線的表現(xiàn)形式是離散的,其在某一點處的斜率指的是此點右向n步斜率或是左向n步斜率。如果弦長過小了,斜率的量化誤差就會增大。這種方法比較適用于干擾較少的完整圓形目標(biāo)。
圖像處理之hough圓形檢測,圖像處理,圖像處理,人工智能

主要代碼:

def AHTforCircles(edge,center_threhold_factor = None,score_threhold = None,min_center_dist = None,minRad = None,maxRad = None,center_axis_scale = None,radius_scale = None,halfWindow = None,max_circle_num = None):
    if center_threhold_factor == None:
        center_threhold_factor = 10.0
    if score_threhold == None:
        score_threhold = 15.0
    if min_center_dist == None:
        min_center_dist = 80.0
    if minRad == None:
        minRad = 0.0
    if maxRad == None:
        maxRad = 1e7*1.0
    if center_axis_scale == None:
        center_axis_scale = 1.0
    if radius_scale == None:
        radius_scale = 1.0
    if halfWindow == None:
        halfWindow = 2
    if max_circle_num == None:
        max_circle_num = 6
    min_center_dist_square = min_center_dist**2


    sobel_kernel_y = np.array([[-1.0, -2.0, -1.0], [0.0, 0.0, 0.0], [1.0, 2.0, 1.0]])
    sobel_kernel_x = np.array([[-1.0, 0.0, 1.0], [-2.0, 0.0, 2.0], [-1.0, 0.0, 1.0]])
    edge_x = convolve(sobel_kernel_x,edge,[1,1,1,1],[1,1])
    edge_y = convolve(sobel_kernel_y,edge,[1,1,1,1],[1,1])

    center_accumulator = np.zeros((int(np.ceil(center_axis_scale*edge.shape[0])),int(np.ceil(center_axis_scale*edge.shape[1]))))
    k = np.array([[r for c in range(center_accumulator.shape[1])] for r in range(center_accumulator.shape[0])])
    l = np.array([[c for c in range(center_accumulator.shape[1])] for r in range(center_accumulator.shape[0])])
    minRad_square = minRad**2
    maxRad_square = maxRad**2
    points = [[],[]]

    edge_x_pad = np.pad(edge_x,((1,1),(1,1)),'constant')
    edge_y_pad = np.pad(edge_y,((1,1),(1,1)),'constant')
    Gaussian_filter_3 = 1.0 / 16 * np.array([(1.0, 2.0, 1.0), (2.0, 4.0, 2.0), (1.0, 2.0, 1.0)])

    for i in range(edge.shape[0]):
        for j in range(edge.shape[1]):
            if not edge[i,j] == 0:
                dx_neibor = edge_x_pad[i:i+3,j:j+3]
                dy_neibor = edge_y_pad[i:i+3,j:j+3]
                dx = (dx_neibor*Gaussian_filter_3).sum()
                dy = (dy_neibor*Gaussian_filter_3).sum()
                if not (dx == 0 and dy == 0):
                    t1 = (k/center_axis_scale-i)
                    t2 = (l/center_axis_scale-j)
                    t3 = t1**2 + t2**2
                    temp = (t3 > minRad_square)&(t3 < maxRad_square)&(np.abs(dx*t1-dy*t2) < 1e-4)
                    center_accumulator[temp] += 1
                    points[0].append(i)
                    points[1].append(j)

    M = center_accumulator.mean()
    for i in range(center_accumulator.shape[0]):
        for j in range(center_accumulator.shape[1]):
            neibor = \
                center_accumulator[max(0, i - halfWindow + 1):min(i + halfWindow, center_accumulator.shape[0]),
                max(0, j - halfWindow + 1):min(j + halfWindow, center_accumulator.shape[1])]
            if not (center_accumulator[i,j] >= neibor).all():
                center_accumulator[i,j] = 0
                                                                        # 非極大值抑制

    plt.imshow(center_accumulator,cmap='gray')
    plt.axis('off')
    plt.show()

    center_threshold = M * center_threhold_factor
    possible_centers = np.array(np.where(center_accumulator > center_threshold))  # 閾值化


    sort_centers = []
    for i in range(possible_centers.shape[1]):
        sort_centers.append([])
        sort_centers[-1].append(possible_centers[0,i])
        sort_centers[-1].append(possible_centers[1,i])
        sort_centers[-1].append(center_accumulator[sort_centers[-1][0],sort_centers[-1][1]])

    sort_centers.sort(key=lambda x:x[2],reverse=True)

    centers = [[],[],[]]
    points = np.array(points)
    for i in range(len(sort_centers)):
        radius_accumulator = np.zeros(
            (int(np.ceil(radius_scale * min(maxRad, np.sqrt(edge.shape[0] ** 2 + edge.shape[1] ** 2)) + 1))),dtype=np.float32)
        if not len(centers[0]) < max_circle_num:
            break
        iscenter = True
        for j in range(len(centers[0])):
            d1 = sort_centers[i][0]/center_axis_scale - centers[0][j]
            d2 = sort_centers[i][1]/center_axis_scale - centers[1][j]
            if d1**2 + d2**2 < min_center_dist_square:
                iscenter = False
                break

        if not iscenter:
            continue

        temp = np.sqrt((points[0,:] - sort_centers[i][0] / center_axis_scale) ** 2 + (points[1,:] - sort_centers[i][1] / center_axis_scale) ** 2)
        temp2 = (temp > minRad) & (temp < maxRad)
        temp = (np.round(radius_scale * temp)).astype(np.int32)
        for j in range(temp.shape[0]):
            if temp2[j]:
                radius_accumulator[temp[j]] += 1
        for j in range(radius_accumulator.shape[0]):
            if j == 0 or j == 1:
                continue
            if not radius_accumulator[j] == 0:
                radius_accumulator[j] = radius_accumulator[j]*radius_scale/np.log(j) #radius_accumulator[j]*radius_scale/j
        score_i = radius_accumulator.argmax(axis=-1)
        if radius_accumulator[score_i] < score_threhold:
            iscenter = False

        if iscenter:
            centers[0].append(sort_centers[i][0]/center_axis_scale)
            centers[1].append(sort_centers[i][1]/center_axis_scale)
            centers[2].append(score_i/radius_scale)

    centers = np.array(centers)
    centers = centers.astype(np.float64)

    return centers

代碼效果:
圖像處理之hough圓形檢測,圖像處理,圖像處理,人工智能
圖像處理之hough圓形檢測,圖像處理,圖像處理,人工智能

全部代碼可見本人GitHub倉庫,如果代碼有用,please click star and watching
hough檢測之前需要canny算子檢測基礎(chǔ)的邊緣,點擊這里可以查看有關(guān)canny算法相關(guān)內(nèi)容

如果本文對你有幫助,關(guān)注加點贊?。。。。?span toymoban-style="hidden">文章來源地址http://www.zghlxwxcb.cn/news/detail-608198.html

到了這里,關(guān)于圖像處理之hough圓形檢測的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 人工智能在圖像處理中的應(yīng)用:智能攝像頭與視覺識別

    人工智能(Artificial Intelligence, AI)是一種計算機(jī)科學(xué)的分支,旨在模擬人類智能的行為和能力。其中,圖像處理和視覺識別是人工智能領(lǐng)域中的重要應(yīng)用領(lǐng)域。隨著計算能力的提高和數(shù)據(jù)量的增加,人工智能在圖像處理和視覺識別方面取得了顯著的進(jìn)展。 智能攝像頭是一種具有

    2024年02月20日
    瀏覽(31)
  • 基于Springboot+百度AI人工智能圖像圖片智能處理系統(tǒng)設(shè)計與實現(xiàn)

    基于Springboot+百度AI人工智能圖像圖片智能處理系統(tǒng)設(shè)計與實現(xiàn)

    基于Springboot+百度AI人工智能圖像圖片智能處理系統(tǒng)設(shè)計與實現(xiàn) ?博主介紹: 《Vue.js入門與商城開發(fā)實戰(zhàn)》《微信小程序商城開發(fā)》圖書作者,CSDN博客專家,在線教育專家,CSDN鉆石講師;專注大學(xué)生畢業(yè)設(shè)計教育和輔導(dǎo)。 所有項目都配有從入門到精通的基礎(chǔ)知識視頻課程,

    2024年02月05日
    瀏覽(22)
  • 構(gòu)建基于AWSLambda的人工智能應(yīng)用:語音識別、圖像識別和自然語言處理

    作者:禪與計算機(jī)程序設(shè)計藝術(shù) 在人工智能領(lǐng)域,用大數(shù)據(jù)、機(jī)器學(xué)習(xí)等方法來解決復(fù)雜的問題,已經(jīng)成為越來越多企業(yè)和開發(fā)者關(guān)注的問題。但是,如何把這些方法落地到生產(chǎn)環(huán)境中,仍然是一個難題。 隨著云計算平臺的廣泛普及,AWS Lambda作為一項服務(wù)正在成為各個公司

    2024年02月09日
    瀏覽(36)
  • 【MATLAB圖像處理實用案例詳解(11)】——基于Hough變換的人眼虹膜定位方法

    【MATLAB圖像處理實用案例詳解(11)】——基于Hough變換的人眼虹膜定位方法

    Hough 變換作為一種參數(shù)空間變換算法,直線和其他參數(shù)化形狀檢測的重要工具。Hough 變換具有較強(qiáng)的穩(wěn)定性和魯棒性,可以在一定程度上避免噪聲的影響,后續(xù)研究將極坐標(biāo)引入Hough 變換,使這種方法可以更加有效地用于直線檢測和其他任意幾何形狀的檢測。Ballard 提出了非

    2023年04月16日
    瀏覽(24)
  • 【SCI征稿】3個月左右錄用!計算機(jī)信息技術(shù)等領(lǐng)域均可,如機(jī)器學(xué)習(xí)、遙感技術(shù)、人工智能、物聯(lián)網(wǎng)、人工神經(jīng)網(wǎng)絡(luò)、數(shù)據(jù)挖掘、圖像處理

    計算機(jī)技術(shù)類SCIEEI 【期刊簡介】IF:1.0-2.0,JCR4區(qū),中科院4區(qū) 【檢索情況】SCIEEI 雙檢,正刊 【參考周期】期刊部系統(tǒng)內(nèi)提交,錄用周期3個月左右,走完期刊部流程上線 【征稿領(lǐng)域】 計算機(jī)信息技術(shù)在土地變化檢測中的應(yīng)用 包括但不限于以下主題: ● 利用基于機(jī)器學(xué)習(xí)的

    2024年02月10日
    瀏覽(31)
  • 基于Java(SpringBoot框架)畢業(yè)設(shè)計作品成品(33)AI人工智能畢設(shè)AI常用數(shù)字圖像圖片特效處理系統(tǒng)設(shè)計與實現(xiàn)

    基于Java(SpringBoot框架)畢業(yè)設(shè)計作品成品(33)AI人工智能畢設(shè)AI常用數(shù)字圖像圖片特效處理系統(tǒng)設(shè)計與實現(xiàn)

    博主介紹: 《Vue.js入門與商城開發(fā)實戰(zhàn)》《微信小程序商城開發(fā)》圖書作者,CSDN博客專家,在線教育專家,CSDN鉆石講師;專注大學(xué)生畢業(yè)設(shè)計教育和輔導(dǎo)。 所有項目都配有從入門到精通的基礎(chǔ)知識視頻課程,免費 項目配有對應(yīng)開發(fā)文檔、開題報告、任務(wù)書、PPT、論文模版

    2024年02月08日
    瀏覽(34)
  • 【數(shù)字圖像處理】邊緣檢測

    【數(shù)字圖像處理】邊緣檢測

    邊緣檢測是一種圖像處理技術(shù),旨在標(biāo)識和定位數(shù)字圖像中的邊緣和輪廓。 邊緣是圖像中灰度值變化明顯的位置 ,通常是物體的邊緣或表面的變化。通過邊緣檢測算法,可以將圖像中的物體和背景分離出來,從而實現(xiàn)目標(biāo)檢測、圖像分割、計算機(jī)視覺和機(jī)器人視覺等應(yīng)用。

    2024年02月02日
    瀏覽(21)
  • 缺陷檢測(圖像處理部分)

    缺陷檢測(圖像處理部分)

    ?提出“基于像元搜索算法的微小缺陷檢測方法”。 首先采用直方圖均衡化提升背景與缺陷目標(biāo)的對比度,利用中值和均值濾波對圖像進(jìn)行去噪,根據(jù)背景灰度分布,在目標(biāo)分割過程中采用分塊、按方差大小排除背景圖像塊、初定目標(biāo)和剔除偽目標(biāo)的缺陷像元搜索算法,最后

    2024年02月02日
    瀏覽(26)
  • 圖像處理:邊緣檢測原理

    圖像處理:邊緣檢測原理

    很抱歉,前面推導(dǎo)三種邊緣檢測算子我不是很滿意就發(fā)出去了,現(xiàn)在以我的知識儲備看他們還是有著很大的問題,我潛下心的找資料,看視頻,就是為了將我的基礎(chǔ)打牢,所以,我在這一篇當(dāng)中好好的摳細(xì)節(jié),畢竟從實際的應(yīng)用上來說,這是我的學(xué)習(xí)筆記,再怎么也不能糊弄

    2024年02月06日
    瀏覽(23)
  • 數(shù)字圖像處理:圖像分割——邊緣檢測與區(qū)域分割

    數(shù)字圖像處理:圖像分割——邊緣檢測與區(qū)域分割

    1.圖像分割:根據(jù)圖像的某些局部特征(灰度級、紋理、彩色或統(tǒng)計特征等)的相似性和互斥性,將圖像分割成若干子區(qū)域,在每個子區(qū)域內(nèi)部具有相似(相同或相近)特性,而相鄰子區(qū)域的特性互斥。所以圖像分割是利用圖像局部特征的相似性和互斥性。 2.圖像分割方法分

    2024年02月05日
    瀏覽(23)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包