*dyn_threshold分割应用更为复杂

*它应用于图像预参考图像(该图像滤波处理之后)之间在指定偏差范围内的阈值分割

*偏差值offset设置影响非常大

*而lightdark指定的类型为“dark”暗,‘light’亮,‘equal’亮度相等的,‘not equal’不等的

dyn_threshold函数将图像的部分与背景差异较小的灰度也能分割出来

read_image (Image, 'photometric_stereo/embossed_01')
get_image_size(Image,Width,Height)
*原型为:mean_image(Image : ImageMean : MaskWidth, MaskHeight : )
mean_image(Image,ImageMean,59,59)
*原型为:dyn_threshold(OrigImage, ThresholdImage : RegionDynThresh : Offset,
LightDark : )
dyn_threshold(Image,ImageMean,RegionDynThresh,15,'not_equal')
*区域处理
*原型是:closing_circle(Region : RegionClosing : Radius : )
closing_circle(RegionDynThresh,RegionClosing,8.5)
*原型是:opening_circle(Region : RegionOpening : Radius : )
opening_circle(RegionClosing,RegionOpening,6.5)
connection(RegionOpening,ConnectedRegions)
*原型是:smallest_circle(Regions : : : Row, Column, Radius)
smallest_circle(ConnectedRegions,Row,Column,Radius)
*原型是gen_circle_contour_xld( : ContCircle : Row, Column, Radius, StartPhi,
EndPhi, PointOrder, Resolution : )
gen_circle_contour_xld(ContCircle,Row,Column,Radius,0,6.28318,'positive',1)

*显示
dev_display(Image)
dev_set_color('green')
dev_display(ContCircle)

*重点说明

g_o=g_[OrigImage]
g_t=g_[ThresholdImage]
当选择light模式
阈值计算公式:
for LightDark = ‘light’ is:
g_o >= g_t + Offset
即为原图中大于等于g_t + Offset点的像素值被选中。

当选择dark 模式
For LightDark = ‘dark’ the condition is:
g_o <= g_t - Offset
即为原图中小于等于g_t - Offset点的像素值被选中。

当选择equal 模式时:
For LightDark = ‘equal’ it is:
g_t - Offset <= g_o <= g_t + Offset
原图中像素值在g_t - Offset 和 g_t + Offset之间的像素点被选中。

当选择not_equal模式时
Finally, for LightDark = ‘not_equal’ it is:
g_t - Offset > g_o or g_o > g_t + Offset
原图中像素值在g_t - Offset 和 g_t + Offset之外的像素点被选中。

*使用dyn_threshold函数的可能分为以下几种情况:

1)图像对应的背景图像位非均匀的

2)图像中目标物体的局部范围比背景更明亮或更暗一些

3)采用固定阈值来区分目标物体和背景的难度较大

实现过程中需要对图像中目标平滑处理,

比如mean_image(均值滤波)或binomial_filter(二项式滤波)等。

 

技术
今日推荐
PPT
阅读数 135
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信