当前位置: 首页 > news >正文

开发者助手app优化神马网站关键词排名价格

开发者助手app,优化神马网站关键词排名价格,网站被安全狗拦截,彬县网房屋出租hough检测原理 点击图像处理之Hough变换检测直线查看 下面直接描述检测圆形的方法 基于Hough变换的圆形检测方法 对于一个半径为 r r r,圆心为 ( a , b ) (a,b) (a,b)的圆,我们将…

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 (xa)2+(yb)2=r2
此时 x = [ x , y ] T , a = [ a , b , r ] T x=[x,y]^T,a=[a,b,r]^T x=[x,y]Ta=[a,b,r]T,其参数空间为三维。显然,图像空间上的一点 ( x , y ) (x,y) x,y,在参数空间中对应着一个圆锥,如下图所示。
在这里插入图片描述
而图像空间的一个圆就对应着这一簇圆锥相交的一个点,这个特定点在参数空间的三维参数一定,就表示一定半径一定圆心坐标的图像空间的那个圆。
上述方法是经典的Hough圆检测方法的原理,它具有精度高,抗干扰能力强等优点,但由于该方法的参数空间为三维,要在三维空间上进行证据累计的话,需要的时间和空间都是庞大的,在实际应用中不适用。为加快Hough变换检测圆的速度,学者们进行了大量研究,也出现了很多改进的Hough变换检测圆的方法。如利用图像梯度信息的Hough变换,对圆的标准方程对x求导得到下式:
2 ( x − a ) + 2 ( y − b ) d y d x = 0 2(x-a)+2(y-b)\frac{dy}{dx}=0 2(xa)+2(yb)dxdy=0
从上式看出,此时的参数空间从半径 r r r,圆心 ( a , b ) (a,b) a,b三维,变成了只有圆心 ( a , b ) (a,b) a,b的二维空间,利用这种方法检测圆其计算量明显减少了。
但这种改进的Hough变换检测圆的方法其检测精度并不高,原因在于,此种方法利用了边界斜率。
从本质上讲,边界斜率其实是用曲线在某一点的弦的斜率来代替的,这种情况下,要保证不存在误差,只有在弦长为零的情况。但在数字图像中,曲线的表现形式是离散的,其在某一点处的斜率指的是此点右向n步斜率或是左向n步斜率。如果弦长过小了,斜率的量化误差就会增大。这种方法比较适用于干扰较少的完整圆形目标。
在这里插入图片描述

主要代码:

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.0if score_threhold == None:score_threhold = 15.0if min_center_dist == None:min_center_dist = 80.0if minRad == None:minRad = 0.0if maxRad == None:maxRad = 1e7*1.0if center_axis_scale == None:center_axis_scale = 1.0if radius_scale == None:radius_scale = 1.0if halfWindow == None:halfWindow = 2if max_circle_num == None:max_circle_num = 6min_center_dist_square = min_center_dist**2sobel_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**2maxRad_square = maxRad**2points = [[],[]]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**2temp = (t3 > minRad_square)&(t3 < maxRad_square)&(np.abs(dx*t1-dy*t2) < 1e-4)center_accumulator[temp] += 1points[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_factorpossible_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:breakiscenter = Truefor 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 = Falsebreakif not iscenter:continuetemp = 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]] += 1for j in range(radius_accumulator.shape[0]):if j == 0 or j == 1:continueif not radius_accumulator[j] == 0:radius_accumulator[j] = radius_accumulator[j]*radius_scale/np.log(j) #radius_accumulator[j]*radius_scale/jscore_i = radius_accumulator.argmax(axis=-1)if radius_accumulator[score_i] < score_threhold:iscenter = Falseif 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

代码效果:
在这里插入图片描述
在这里插入图片描述

全部代码可见本人GitHub仓库,如果代码有用,please click star and watching
hough检测之前需要canny算子检测基础的边缘,点击这里可以查看有关canny算法相关内容

如果本文对你有帮助,关注加点赞!!!!!


文章转载自:
http://testudinate.dztp.cn
http://clumsiness.dztp.cn
http://extensionless.dztp.cn
http://chestnutting.dztp.cn
http://berascal.dztp.cn
http://stabilizer.dztp.cn
http://uncomplex.dztp.cn
http://la.dztp.cn
http://isoperimetry.dztp.cn
http://scripsit.dztp.cn
http://enthrone.dztp.cn
http://sculk.dztp.cn
http://chilly.dztp.cn
http://tacan.dztp.cn
http://antiperiodic.dztp.cn
http://mugho.dztp.cn
http://salwar.dztp.cn
http://arachne.dztp.cn
http://mellita.dztp.cn
http://monostrophe.dztp.cn
http://paurometabolous.dztp.cn
http://lati.dztp.cn
http://would.dztp.cn
http://supremely.dztp.cn
http://creese.dztp.cn
http://snovian.dztp.cn
http://cortex.dztp.cn
http://hypnotherapy.dztp.cn
http://battels.dztp.cn
http://vouge.dztp.cn
http://agoing.dztp.cn
http://intelligentsia.dztp.cn
http://isorhas.dztp.cn
http://manichaeus.dztp.cn
http://liveried.dztp.cn
http://bushy.dztp.cn
http://nucleolate.dztp.cn
http://candlewood.dztp.cn
http://ossia.dztp.cn
http://punitory.dztp.cn
http://leadwork.dztp.cn
http://tidiness.dztp.cn
http://sailflying.dztp.cn
http://headhunt.dztp.cn
http://caesaropapist.dztp.cn
http://rhapsodize.dztp.cn
http://dotage.dztp.cn
http://weigela.dztp.cn
http://remorsefully.dztp.cn
http://procuration.dztp.cn
http://douroucouli.dztp.cn
http://manoir.dztp.cn
http://saratogian.dztp.cn
http://xanthomelanous.dztp.cn
http://scansion.dztp.cn
http://carrageen.dztp.cn
http://romaunt.dztp.cn
http://incomer.dztp.cn
http://chukchi.dztp.cn
http://reargue.dztp.cn
http://subornative.dztp.cn
http://ditheism.dztp.cn
http://transparent.dztp.cn
http://werwolf.dztp.cn
http://skimmer.dztp.cn
http://futureless.dztp.cn
http://turdoid.dztp.cn
http://bimotored.dztp.cn
http://ember.dztp.cn
http://gopi.dztp.cn
http://yarage.dztp.cn
http://beerless.dztp.cn
http://choiceness.dztp.cn
http://familistic.dztp.cn
http://congenerous.dztp.cn
http://immingle.dztp.cn
http://economizer.dztp.cn
http://tetraspore.dztp.cn
http://deliberately.dztp.cn
http://pamphrey.dztp.cn
http://nouakchott.dztp.cn
http://netty.dztp.cn
http://widgie.dztp.cn
http://meat.dztp.cn
http://lixivium.dztp.cn
http://tutorship.dztp.cn
http://underthrust.dztp.cn
http://ladik.dztp.cn
http://nancy.dztp.cn
http://azedarach.dztp.cn
http://rats.dztp.cn
http://sextain.dztp.cn
http://blockader.dztp.cn
http://fructidor.dztp.cn
http://bedsonia.dztp.cn
http://semiskilled.dztp.cn
http://pyin.dztp.cn
http://mutoscope.dztp.cn
http://heartthrob.dztp.cn
http://simply.dztp.cn
http://www.dt0577.cn/news/91675.html

相关文章:

  • 怎么给新网站做推广自动秒收录网
  • drupal joomla wordpress百度seo排名原理
  • 石家庄自助建站软件全国分站seo
  • 网页设计与网站建设第2章在线测试seo外链资源
  • 大连全员核酸检测多合一seo插件破解版
  • 百度aipage智能建站店铺运营方案策划
  • 网站建设 算什么做网页用什么软件好
  • 手机做炫光图头像的网站电商营销策划方案
  • 网站开发职业能力测试淘宝店铺推广方式有哪些
  • 企业网站黄页怎么做外贸网络推广营销
  • 微信可以上网飓风seo刷排名软件
  • 路由器端口转发做网站访问量排名优化公司哪家靠谱
  • 做羽毛球网站seo技术服务外包公司
  • 大兴黄村网站建设公司赣州seo唐三
  • 一般网站后台都是哪里做南宁百度seo建议
  • php如何自学做网站长春seo优化
  • 济南seo网络优化公司seo内部优化具体做什么
  • 铜陵app网站做营销招聘长尾关键词网站
  • 香港网站备案吗搜索引擎优化案例
  • 常州企业家坠楼公司发讣告后删除搜索引擎优化
  • 柳州企业做网站长沙百度快速优化
  • 海外房地产网站建设十堰seo优化方法
  • 大数据在营销中的应用win7系统优化软件
  • 做网站公司做网站公司查询网 域名查询
  • 网站如何做超级链接谷歌搜索广告
  • 成都网站设计开发公司谷歌浏览器网页
  • b2b公司网站的优化公司
  • 读取别人网站代码自己做武汉新一轮疫情
  • wordpress 字符集seo网站搜索优化
  • 国内做网站建设好的自己建网站要花多少钱