createBinaryImage(CRImage)
createBinaryImage()所属R语言包:CRImage
Thresholding
阈值
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Creates a binary image from a grayscale image by thresholding.
通过阈值的灰度图像创建一个二进制图像。
用法----------Usage----------
createBinaryImage(imgG,img=NULL,method="otsu",threshold=NA,numWindows=1,whitePixelMask=c())
参数----------Arguments----------
参数:img
An Image object or an array.
Image对象或数组。
参数:imgG
The grey valued Image object.
灰值图像对象。
参数:method
Either "otsu" or "phansalkar"
无论是“大津”或“phansalkar”
参数:threshold
Fixed threshold
固定阈值
参数:numWindows
Number of windows to use for threshold calculation.
使用阈值计算窗口的数量。
参数:whitePixelMask
Boolean mask of white pixels, if they should be excluded from thresholding
白色像素,如果他们被排除阈值的布尔面膜
Details
详情----------Details----------
The functions returns the binary image resulting from the thresholding. If threshold is defined, all pixels smaller than this value will be fixed to 1 all other values will be set to 0. If threshold is undefined, the thresholding value is calculated automatically using 'otsu' or 'phansalkar' thresholding.
该函数返回的二进制图像的阈值。如果定义阈值,超过此值的所有像素较小的,将被固定在1所有其他值将被设置为0。阈值是不确定的,如果使用“津市或phansalkar”阈值阈值自动计算。
The function 'otsu' does Otsu thresholding on the grey level histograms of the image. The function 'phansalkar' does thresholding using the mean and standard deviation of a specified window. The thresholding is done on the RGB as well as the LAP color space and the results are ORed. The window size is dim(img)/numWindows. White pixel can be excluded from thresholding (e.g. if white is background) by defining a whitePixelMask
“大津”功能的Otsu阈值对图像的灰度直方图。函数“phansalkar”不阈值使用一个指定的窗口的均值和标准差。阈值是做对RGB以及LAP色彩空间和或运算的结果。窗口的大小是暗淡(IMG)/ numWindows。可以排除白色像素阈值(例如,如果白色背景)的定义whitePixelMask
值----------Value----------
The binary image.
二进制图像。
作者(S)----------Author(s)----------
Henrik Failmezger, failmezger@lmb.uni-muenchen.de
参考文献----------References----------
举例----------Examples----------
f= system.file("extdata", "exImg.jpg", package="CRImage")
img=readImage(f)
#conversion to grayscale[转换为灰度]
imgG=EBImage::channel(img,"gray")
imgB=createBinaryImage(imgG,img=img,method="otsu",numWindows=4)
#white pixel mask[白色像素面膜]
whitePixelMask=img[,,1]>0.85 & img[,,2]>0.85 & img[,,3]>0.85
#exclude white pixels from thresholding[排除阈值白色像素]
imgB=createBinaryImage(imgG,img=img,method="otsu",numWindows=4,whitePixelMask)
#phansalkar threshold[phansalkar阈值]
imgB=createBinaryImage(imgG,img=img,method="phansalkar",numWindows=4)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|