img.difference("temp/bg.bmp")
thresholds=(240,255)
img.find_blobs([thresholds], pixels_threshold=100, area_threshold=100, merge=True);
for l in img.find_lines(threshold = 1000, theta_margin = 25, rho_margin = 25):
if (min_degree <= l.theta()) and (l.theta() <= max_degree):
img.draw_line(l.line(), color = (255, 0, 0))
print(l)
//下面是一些重要函数用法
image.find_template(template, threshold, roi=Auto, step=2, search=image.SEARCH_EX)
Tries to find the first location in the image where template matches using Normalized Cross Correlation. Returns a bounding box tuple (x, y, w, h) for the matching location otherwise None.
template is a small image object that is matched against this image object. Note that both images must be grayscale.
threshold is floating point number (0.0-1.0) where a higher threshold prevents false positives while lowering the detection rate while a lower threshold does the opposite.
roi is the region-of-interest rectangle (x, y, w, h) to search in.
step is the number of pixels to skip past while looking for the template. Skipping pixels considerably speeds the algorithm up. This only affects the algorithm in SERACH_EX mode.
search can be either image.SEARCH_DS or image.SEARCH_EX. image.SEARCH_DS searches for the template using as faster algorithm than image.SEARCH_EX but may not find the template if it’s near the edges of the image. image.SEARCH_EX does an exhaustive search for the image but can be much slower than image.SEARCH_DS.
Note
roi, step, and search are keyword arguments which must be explicitly invoked in the function call by writing roi=, step=, or search=.