ImageSearch - 公差,单位是什么?
ImageSearch - tollerance, what are the units?
AHK ImageSearch 函数接受如下公差:
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 image.png
但是 *50
数字是什么意思,范围是多少?它在某处记录了吗?
*50
中的50
是ImageSearch
期间每个像素的RGB值的允许变化。它的范围是 0-255。默认值为 0,ImageSearch
将只匹配准确的颜色,将其设置为 255 将匹配所有颜色。
AHK doc 指出:
*n (variation): Specify for n a number between 0 and 255 (inclusive) to indicate the allowed number of shades of variation in either
direction for the intensity of the red, green, and blue components of
each pixel's color. For example, *2
would allow two shades of
variation. This parameter is helpful if the coloring of the image
varies slightly or if ImageFile uses a format such as GIF or JPG that
does not accurately represent an image on the screen. If you specify
255 shades of variation, all colors will match. The default is 0
shades.
对于 ImageSearch,我通常使用从屏幕截图裁剪的未压缩 BMP 文件,并使用默认容差进行精确颜色匹配。
AHK ImageSearch 函数接受如下公差:
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 image.png
但是 *50
数字是什么意思,范围是多少?它在某处记录了吗?
*50
中的50
是ImageSearch
期间每个像素的RGB值的允许变化。它的范围是 0-255。默认值为 0,ImageSearch
将只匹配准确的颜色,将其设置为 255 将匹配所有颜色。
AHK doc 指出:
*n (variation): Specify for n a number between 0 and 255 (inclusive) to indicate the allowed number of shades of variation in either direction for the intensity of the red, green, and blue components of each pixel's color. For example,
*2
would allow two shades of variation. This parameter is helpful if the coloring of the image varies slightly or if ImageFile uses a format such as GIF or JPG that does not accurately represent an image on the screen. If you specify 255 shades of variation, all colors will match. The default is 0 shades.
对于 ImageSearch,我通常使用从屏幕截图裁剪的未压缩 BMP 文件,并使用默认容差进行精确颜色匹配。