From 4f587aac817cfd97b30d967aa5923ee84950a30e Mon Sep 17 00:00:00 2001 From: Neucrack Date: Sun, 31 Mar 2024 03:29:27 +0800 Subject: [PATCH] change draw_text to draw_string --- README.md | 2 +- README_ZH.md | 2 +- docs/pages/index/README.md | 2 +- docs/pages/index_en/README.md | 2 +- examples/vision/ai_classify/nn_classifier.py | 2 +- examples/vision/ai_detect/nn_yolov5.py | 2 +- examples/vision/display/display_show.py | 4 +- test/test_image_font.py | 10 ++--- test/test_image_load.py | 14 +++---- test/test_image_method/test_find_apriltags.py | 20 +++++----- test/test_image_method/test_find_barcodes.py | 12 +++--- test/test_image_method/test_find_blobs.py | 38 +++++++++---------- test/test_image_method/test_find_circles.py | 4 +- .../test_find_datamatrices.py | 14 +++---- test/test_image_method/test_find_edges.py | 2 +- .../test_find_line_segments.py | 6 +-- test/test_image_method/test_find_lines.py | 4 +- test/test_image_method/test_find_qrcodes.py | 26 ++++++------- test/test_image_method/test_find_rects.py | 6 +-- test/test_image_method/test_find_template.py | 2 +- 20 files changed, 87 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index 2087c2a2..8bac003e 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ while 1: res = classifier.classify(img) max_idx, max_prob = res[0] msg = f"{max_prob:5.2f}: {classifier.labels[max_idx]}" - img.draw_text(10, 10, msg, image.COLOR_RED) + img.draw_string(10, 10, msg, image.COLOR_RED) dis.show(img) ``` diff --git a/README_ZH.md b/README_ZH.md index 5c767864..ac279adf 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -51,7 +51,7 @@ while 1: res = classifier.classify(img) max_idx, max_prob = res[0] msg = f"{max_prob:5.2f}: {classifier.labels[max_idx]}" - img.draw_text(10, 10, msg, image.COLOR_RED) + img.draw_string(10, 10, msg, image.COLOR_RED) dis.show(img) ``` diff --git a/docs/pages/index/README.md b/docs/pages/index/README.md index e13cee63..14e186fb 100644 --- a/docs/pages/index/README.md +++ b/docs/pages/index/README.md @@ -166,7 +166,7 @@ while 1: res = classifier.classify(img) max_idx, max_prob = res[0] msg = f"{max_prob:5.2f}: {classifier.labels[max_idx]}" - img.draw_text(10, 10, msg, image.COLOR_RED) + img.draw_string(10, 10, msg, image.COLOR_RED) dis.show(img) ``` diff --git a/docs/pages/index_en/README.md b/docs/pages/index_en/README.md index 10269ec6..64c6142c 100644 --- a/docs/pages/index_en/README.md +++ b/docs/pages/index_en/README.md @@ -166,7 +166,7 @@ while 1: res = classifier.classify(img) max_idx, max_prob = res[0] msg = f"{max_prob:5.2f}: {classifier.labels[max_idx]}" - img.draw_text(10, 10, msg, image.COLOR_RED) + img.draw_string(10, 10, msg, image.COLOR_RED) dis.show(img) ``` diff --git a/examples/vision/ai_classify/nn_classifier.py b/examples/vision/ai_classify/nn_classifier.py index 58a9a1b6..3fd97002 100644 --- a/examples/vision/ai_classify/nn_classifier.py +++ b/examples/vision/ai_classify/nn_classifier.py @@ -10,6 +10,6 @@ res = classifier.classify(img) max_idx, max_prob = res[0] msg = f"{max_prob:5.2f}: {classifier.labels[max_idx]}" - img.draw_text(10, 10, msg, image.COLOR_RED) + img.draw_string(10, 10, msg, image.COLOR_RED) img = img.resize(disp.width(), disp.height(), image.Fit.FIT_CONTAIN) disp.show(img) diff --git a/examples/vision/ai_detect/nn_yolov5.py b/examples/vision/ai_detect/nn_yolov5.py index c58c998f..7a64a7b2 100644 --- a/examples/vision/ai_detect/nn_yolov5.py +++ b/examples/vision/ai_detect/nn_yolov5.py @@ -11,5 +11,5 @@ for obj in objs: img.draw_rect(obj.x, obj.y, obj.w, obj.h, color = image.COLOR_RED) msg = f'{detector.labels[obj.class_id]}: {obj.score:.2f}' - img.draw_text(obj.x, obj.y, msg, color = image.COLOR_RED) + img.draw_string(obj.x, obj.y, msg, color = image.COLOR_RED) dis.show(img) diff --git a/examples/vision/display/display_show.py b/examples/vision/display/display_show.py index cf409330..b62ec4b5 100644 --- a/examples/vision/display/display_show.py +++ b/examples/vision/display/display_show.py @@ -8,8 +8,8 @@ text = "Hello, MaixPy!" while not app.need_exit(): img = image.Image(disp.width(), disp.height(), image.Format.FMT_RGB888) - img.draw_rect(0, y, image.text_size(text, scale=2).width + 10, 80, color=image.Color.from_rgb(255, 0, 0), thickness=-1) - img.draw_text(4, y + 4, text, color=image.Color.from_rgb(255, 255, 255), scale=2) + img.draw_rect(0, y, image.string_size(text, scale=2).width + 10, 80, color=image.Color.from_rgb(255, 0, 0), thickness=-1) + img.draw_string(4, y + 4, text, color=image.Color.from_rgb(255, 255, 255), scale=2) disp.show(img) diff --git a/test/test_image_font.py b/test/test_image_font.py index d6f59c0f..8f75cfac 100644 --- a/test/test_image_font.py +++ b/test/test_image_font.py @@ -12,13 +12,13 @@ img_show = image.Image(screen.width(), screen.height(), image.Format.FMT_RGBA8888) -size = image.text_size("Hello, world!", font = "hershey_simplex") +size = image.string_size("Hello, world!", font = "hershey_simplex") img_show.draw_rect(0, 0, size[0], size[1], image.Color.from_rgba(255, 255, 0, 0.5)) -img_show.draw_text(0, 0, "Hello, world!", image.Color.from_rgba(255, 255, 255, 1), font = "hershey_simplex") -size = image.text_size("你好!Hello, world!") -x_start = image.text_size("Hello, world!", font = "hershey_simplex")[0] +img_show.draw_string(0, 0, "Hello, world!", image.Color.from_rgba(255, 255, 255, 1), font = "hershey_simplex") +size = image.string_size("你好!Hello, world!") +x_start = image.string_size("Hello, world!", font = "hershey_simplex")[0] img_show.draw_rect(x_start, 0, size[0], size[1], image.Color.from_rgba(255, 255, 0, 0.5)) -img_show.draw_text(x_start, 0, "你好!Hello, world!", image.Color.from_rgba(255, 0, 0, 1)) +img_show.draw_string(x_start, 0, "你好!Hello, world!", image.Color.from_rgba(255, 0, 0, 1)) screen.show(img_show, fit = image.Fit.FIT_NONE) diff --git a/test/test_image_load.py b/test/test_image_load.py index 572490f5..25c30e7e 100644 --- a/test/test_image_load.py +++ b/test/test_image_load.py @@ -28,18 +28,18 @@ img_show.draw_image(0, img.height() + 10, img_rgba_jpg) img_show.draw_image(0, img.height() + 20, img_rgba_png) half_w = screen_size[0] // 2 -font_h0 = img.height() + 150 + image.text_size("H", scale = 0.5)[1] +font_h0 = img.height() + 150 + image.string_size("H", scale = 0.5)[1] font_h = font_h0 img_show.draw_rect(half_w + 100, font_h, 40, 80, image.Color.from_rgb(255, 255, 255)) img_show.draw_rect(half_w + 110, font_h + 10, 40, 80, image.Color.from_rgba(255, 255, 255, 0.5)) img_show.draw_line(half_w + 100, font_h - 10, half_w + 140, font_h + 10, image.COLOR_RED) img_show.draw_circle(half_w + 100, font_h - 20, 5, image.COLOR_GREEN) -img_show.draw_text(0, font_h, "Hello, world!", image.Color.from_rgba(255, 255, 255, 1), scale = 0.5) -font_h += image.text_size("H", scale = 1)[1] -img_show.draw_text(0, font_h, "Hello, world!", image.Color.from_rgba(255, 255, 255, 1), scale = 1, thickness = 2) -font_h += image.text_size("H", scale = 2)[1] -img_show.draw_text(0, font_h, "Hello, world!", image.Color.from_rgba(255, 255, 255, 1), scale = 2) -img_show.draw_text(half_w, font_h0 - 100, "Hello, world! ABCDEFGHIJKLMNOPQRSTUVWXYZ", image.Color.from_rgba(255, 255, 255, 1)) +img_show.draw_string(0, font_h, "Hello, world!", image.Color.from_rgba(255, 255, 255, 1), scale = 0.5) +font_h += image.string_size("H", scale = 1)[1] +img_show.draw_string(0, font_h, "Hello, world!", image.Color.from_rgba(255, 255, 255, 1), scale = 1, thickness = 2) +font_h += image.string_size("H", scale = 2)[1] +img_show.draw_string(0, font_h, "Hello, world!", image.Color.from_rgba(255, 255, 255, 1), scale = 2) +img_show.draw_string(half_w, font_h0 - 100, "Hello, world! ABCDEFGHIJKLMNOPQRSTUVWXYZ", image.Color.from_rgba(255, 255, 255, 1)) screen.show(img_show, fit = image.Fit.FIT_NONE) diff --git a/test/test_image_method/test_find_apriltags.py b/test/test_image_method/test_find_apriltags.py index 32441c57..48cf23e2 100644 --- a/test/test_image_method/test_find_apriltags.py +++ b/test/test_image_method/test_find_apriltags.py @@ -25,32 +25,32 @@ # rect rect = a.rect() img.draw_rect(rect[0], rect[1], rect[2], rect[3], image.COLOR_BLUE, 2) - img.draw_text(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_BLUE) + img.draw_string(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_BLUE) # apriltag - img.draw_text(a.x() + a.w() + 5, rect[1] + 20, "id: " + str(a.id()), image.COLOR_RED) + img.draw_string(a.x() + a.w() + 5, rect[1] + 20, "id: " + str(a.id()), image.COLOR_RED) # family - img.draw_text(a.x() + a.w() + 5, rect[1] + 35, "family: " + str(a.family()), image.COLOR_RED) + img.draw_string(a.x() + a.w() + 5, rect[1] + 35, "family: " + str(a.family()), image.COLOR_RED) # center coordinate - img.draw_text(a.cx(), a.cy(), "(" + str(a.cx()) + "," + str(a.cy()) + ")", image.COLOR_RED) + img.draw_string(a.cx(), a.cy(), "(" + str(a.cx()) + "," + str(a.cy()) + ")", image.COLOR_RED) # rotation - img.draw_text(a.cx(), a.cy() + 15, "rot: " + str(a.rotation()), image.COLOR_RED) + img.draw_string(a.cx(), a.cy() + 15, "rot: " + str(a.rotation()), image.COLOR_RED) # hamming - img.draw_text(a.cx(), a.cy() + 30, "hamming: " + str(a.hamming()), image.COLOR_RED) + img.draw_string(a.cx(), a.cy() + 30, "hamming: " + str(a.hamming()), image.COLOR_RED) # goodness - img.draw_text(a.cx(), a.cy() + 45, "goodness: " + str(a.goodness()), image.COLOR_RED) + img.draw_string(a.cx(), a.cy() + 45, "goodness: " + str(a.goodness()), image.COLOR_RED) # translation - img.draw_text(a.cx(), a.cy() + 60, "translation: (" + str(round(a.x_translation(), 2)) + "," + str(round(a.y_translation(), 2)) + "," + str(round(a.z_translation(), 2)) + ")", image.COLOR_RED) + img.draw_string(a.cx(), a.cy() + 60, "translation: (" + str(round(a.x_translation(), 2)) + "," + str(round(a.y_translation(), 2)) + "," + str(round(a.z_translation(), 2)) + ")", image.COLOR_RED) # rotation - img.draw_text(a.cx(), a.cy() + 75, "rotation: (" + str(round(a.x_rotation(), 2)) + "," + str(round(a.y_rotation(), 2)) + "," + str(round(a.z_rotation(), 2)) + ")", image.COLOR_RED) + img.draw_string(a.cx(), a.cy() + 75, "rotation: (" + str(round(a.x_rotation(), 2)) + "," + str(round(a.y_rotation(), 2)) + "," + str(round(a.z_rotation(), 2)) + ")", image.COLOR_RED) img.draw_rect(roi[0], roi[1], roi[2], roi[3], image.COLOR_GREEN) - img.draw_text(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) + img.draw_string(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) screen.show(img) diff --git a/test/test_image_method/test_find_barcodes.py b/test/test_image_method/test_find_barcodes.py index 28bbc483..ae804ebe 100644 --- a/test/test_image_method/test_find_barcodes.py +++ b/test/test_image_method/test_find_barcodes.py @@ -20,20 +20,20 @@ # rect rect = a.rect() img.draw_rect(rect[0], rect[1], rect[2], rect[3], image.COLOR_BLUE, 2) - img.draw_text(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_BLUE) + img.draw_string(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_BLUE) # payload - img.draw_text(a.x() + a.w() + 5, rect[1] + 20, "payload: " + a.payload(), image.COLOR_RED) + img.draw_string(a.x() + a.w() + 5, rect[1] + 20, "payload: " + a.payload(), image.COLOR_RED) # type - img.draw_text(a.x() + a.w() + 5, rect[1] + 35, "type: " + str(a.type()), image.COLOR_RED) + img.draw_string(a.x() + a.w() + 5, rect[1] + 35, "type: " + str(a.type()), image.COLOR_RED) # rotation - img.draw_text(a.x(), a.y() + 15, "rot: " + str(a.rotation()), image.COLOR_RED) + img.draw_string(a.x(), a.y() + 15, "rot: " + str(a.rotation()), image.COLOR_RED) # quality - img.draw_text(a.x(), a.y() + 30, "quality: " + str(a.quality()), image.COLOR_RED) + img.draw_string(a.x(), a.y() + 30, "quality: " + str(a.quality()), image.COLOR_RED) img.draw_rect(roi[0], roi[1], roi[2], roi[3], image.COLOR_GREEN) - img.draw_text(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) + img.draw_string(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) screen.show(img) diff --git a/test/test_image_method/test_find_blobs.py b/test/test_image_method/test_find_blobs.py index 271c27ac..b8394620 100644 --- a/test/test_image_method/test_find_blobs.py +++ b/test/test_image_method/test_find_blobs.py @@ -35,35 +35,35 @@ corners = a.corners() for i in range(4): img.draw_line(corners[i][0], corners[i][1], corners[(i + 1) % 4][0], corners[(i + 1) % 4][1], image.COLOR_RED) - img.draw_text(corners[0][0] + 5, corners[0][1] + 5, "corners area: " + str(a.area()), image.COLOR_RED) + img.draw_string(corners[0][0] + 5, corners[0][1] + 5, "corners area: " + str(a.area()), image.COLOR_RED) # mini_corners mini_corners = a.mini_corners() for i in range(4): img.draw_line(mini_corners[i][0], mini_corners[i][1], mini_corners[(i + 1) % 4][0], mini_corners[(i + 1) % 4][1], image.COLOR_GREEN) - img.draw_text(mini_corners[0][0] + 5, mini_corners[0][1] + 5, "mini_corners", image.COLOR_GREEN) + img.draw_string(mini_corners[0][0] + 5, mini_corners[0][1] + 5, "mini_corners", image.COLOR_GREEN) # rect rect = a.rect() img.draw_rect(rect[0], rect[1], rect[2], rect[3], image.COLOR_BLUE) - img.draw_text(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_BLUE) + img.draw_string(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_BLUE) # ... - img.draw_text(a.x() + a.w() + 5, a.y(), "(" + str(a.x()) + "," + str(a.y()) + ")", image.COLOR_GREEN) - img.draw_text(a.cx(), a.cy(), "(" + str(a.cx()) + "," + str(a.cy()) + ")", image.COLOR_GREEN) - img.draw_text(a.x() + a.w() // 2, a.y(), str(a.w()), image.COLOR_GREEN) - img.draw_text(a.x(), a.y() + a.h() // 2, str(a.h()), image.COLOR_GREEN) - img.draw_text(a.x() + a.w() + 5, a.y() + 15, str(a.rotation_deg()), image.COLOR_GREEN) - img.draw_text(a.x() + a.w() + 5, a.y() + 30, "code:" + str(a.code()) + ", count:" + str(a.count()), image.COLOR_GREEN) - img.draw_text(a.x() + a.w() + 5, a.y() + 45, "perimeter:" + str(a.perimeter()), image.COLOR_GREEN) - img.draw_text(a.x() + a.w() + 5, a.y() + 60, "roundness:" + str(a.roundness()), image.COLOR_GREEN) - img.draw_text(a.x() + a.w() + 5, a.y() + 75, "elongation:" + str(a.elongation()), image.COLOR_GREEN) - img.draw_text(a.x() + a.w() + 5, a.y() + 90, "area:" + str(a.area()), image.COLOR_GREEN) - img.draw_text(a.x() + a.w() + 5, a.y() + 105, "density:" + str(round(a.density(), 2)), image.COLOR_GREEN) - img.draw_text(a.x() + a.w() + 5, a.y() + 120, "extent:" + str(round(a.extent(), 2)), image.COLOR_GREEN) - img.draw_text(a.x() + a.w() + 5, a.y() + 135, "compactness:" + str(round(a.compactness(), 2)), image.COLOR_GREEN) - img.draw_text(a.x() + a.w() + 5, a.y() + 150, "solidity:" + str(a.solidity()), image.COLOR_GREEN) - img.draw_text(a.x() + a.w() + 5, a.y() + 165, "convexity:" + str(a.convexity()), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y(), "(" + str(a.x()) + "," + str(a.y()) + ")", image.COLOR_GREEN) + img.draw_string(a.cx(), a.cy(), "(" + str(a.cx()) + "," + str(a.cy()) + ")", image.COLOR_GREEN) + img.draw_string(a.x() + a.w() // 2, a.y(), str(a.w()), image.COLOR_GREEN) + img.draw_string(a.x(), a.y() + a.h() // 2, str(a.h()), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y() + 15, str(a.rotation_deg()), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y() + 30, "code:" + str(a.code()) + ", count:" + str(a.count()), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y() + 45, "perimeter:" + str(a.perimeter()), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y() + 60, "roundness:" + str(a.roundness()), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y() + 75, "elongation:" + str(a.elongation()), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y() + 90, "area:" + str(a.area()), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y() + 105, "density:" + str(round(a.density(), 2)), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y() + 120, "extent:" + str(round(a.extent(), 2)), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y() + 135, "compactness:" + str(round(a.compactness(), 2)), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y() + 150, "solidity:" + str(a.solidity()), image.COLOR_GREEN) + img.draw_string(a.x() + a.w() + 5, a.y() + 165, "convexity:" + str(a.convexity()), image.COLOR_GREEN) # major axis line major_axis_line = a.major_axis_line() @@ -86,5 +86,5 @@ y_hist_bins = a.y_hist_bins() img.draw_rect(roi[0], roi[1], roi[2], roi[3], image.COLOR_GREEN) - img.draw_text(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) + img.draw_string(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) screen.show(img) diff --git a/test/test_image_method/test_find_circles.py b/test/test_image_method/test_find_circles.py index f30ea1ce..0b29629c 100644 --- a/test/test_image_method/test_find_circles.py +++ b/test/test_image_method/test_find_circles.py @@ -22,8 +22,8 @@ circles = img.find_circles(roi, x_stride, y_stride, threshold, x_margin, y_margin, r_margin, r_min, r_max, r_step) for a in circles: img.draw_circle(a.x(), a.y(), a.r(), image.COLOR_RED, 2) - img.draw_text(a.x() + a.r() + 5, a.y() + a.r() + 5, "r: " + str(a.r()) + "magnitude: " + str(a.magnitude()), image.COLOR_RED) + img.draw_string(a.x() + a.r() + 5, a.y() + a.r() + 5, "r: " + str(a.r()) + "magnitude: " + str(a.magnitude()), image.COLOR_RED) img.draw_rect(roi[0], roi[1], roi[2], roi[3], image.COLOR_GREEN) - img.draw_text(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) + img.draw_string(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) screen.show(img) diff --git a/test/test_image_method/test_find_datamatrices.py b/test/test_image_method/test_find_datamatrices.py index d74f5ed2..7d8cfc70 100644 --- a/test/test_image_method/test_find_datamatrices.py +++ b/test/test_image_method/test_find_datamatrices.py @@ -21,23 +21,23 @@ # rect rect = a.rect() img.draw_rect(rect[0], rect[1], rect[2], rect[3], image.COLOR_BLUE, 2) - img.draw_text(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_BLUE) + img.draw_string(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_BLUE) # payload - img.draw_text(a.x() + a.w() + 5, rect[1] + 20, "payload: " + a.payload(), image.COLOR_RED) + img.draw_string(a.x() + a.w() + 5, rect[1] + 20, "payload: " + a.payload(), image.COLOR_RED) # rotation - img.draw_text(a.x(), a.y() + 15, "rot: " + str(a.rotation()), image.COLOR_RED) + img.draw_string(a.x(), a.y() + 15, "rot: " + str(a.rotation()), image.COLOR_RED) # rows and columns - img.draw_text(a.x(), a.y() + 30, "rows: " + str(a.rows()) + ", columns: " + str(a.columns()), image.COLOR_RED) + img.draw_string(a.x(), a.y() + 30, "rows: " + str(a.rows()) + ", columns: " + str(a.columns()), image.COLOR_RED) # capacity - img.draw_text(a.x(), a.y() + 45, "capacity: " + str(a.capacity()), image.COLOR_RED) + img.draw_string(a.x(), a.y() + 45, "capacity: " + str(a.capacity()), image.COLOR_RED) # padding - img.draw_text(a.x(), a.y() + 60, "padding: " + str(a.padding()), image.COLOR_RED) + img.draw_string(a.x(), a.y() + 60, "padding: " + str(a.padding()), image.COLOR_RED) img.draw_rect(roi[0], roi[1], roi[2], roi[3], image.COLOR_GREEN) - img.draw_text(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) + img.draw_string(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) screen.show(img) diff --git a/test/test_image_method/test_find_edges.py b/test/test_image_method/test_find_edges.py index 640c8849..f4f4ca8f 100644 --- a/test/test_image_method/test_find_edges.py +++ b/test/test_image_method/test_find_edges.py @@ -14,6 +14,6 @@ img.find_edges(type, roi, threshold) img.draw_rect(roi[0], roi[1], roi[2], roi[3], image.COLOR_GREEN) - img.draw_text(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) + img.draw_string(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) screen.show(img) diff --git a/test/test_image_method/test_find_line_segments.py b/test/test_image_method/test_find_line_segments.py index feab0400..4c0ea81e 100644 --- a/test/test_image_method/test_find_line_segments.py +++ b/test/test_image_method/test_find_line_segments.py @@ -16,7 +16,7 @@ lines = img.find_line_segments(roi, merge_distance, max_theta_diff) for a in lines: img.draw_line(a.x1(), a.y1(), a.x2(), a.y2(), image.COLOR_RED, 2) - img.draw_text(a.x2() + 5, a.y2() + 5, "len: " + str(a.length()), image.COLOR_RED) + img.draw_string(a.x2() + 5, a.y2() + 5, "len: " + str(a.length()), image.COLOR_RED) theta = a.theta() rho = a.rho() @@ -24,8 +24,8 @@ x = int(math.cos(angle_in_radians) * rho) y = int(math.sin(angle_in_radians) * rho) img.draw_line(0, 0, x, y, image.COLOR_GREEN, 2) - img.draw_text(x, y, "theta: " + str(theta) + "," + "rho: " + str(rho), image.COLOR_GREEN) + img.draw_string(x, y, "theta: " + str(theta) + "," + "rho: " + str(rho), image.COLOR_GREEN) img.draw_rect(roi[0], roi[1], roi[2], roi[3], image.COLOR_GREEN) - img.draw_text(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) + img.draw_string(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) screen.show(img) diff --git a/test/test_image_method/test_find_lines.py b/test/test_image_method/test_find_lines.py index 3e9eff81..72f1bb5b 100644 --- a/test/test_image_method/test_find_lines.py +++ b/test/test_image_method/test_find_lines.py @@ -27,8 +27,8 @@ x = int(math.cos(angle_in_radians) * rho) y = int(math.sin(angle_in_radians) * rho) img.draw_line(0, 0, x, y, image.COLOR_GREEN, 2) - img.draw_text(x, y, "theta: " + str(theta) + "," + "rho: " + str(rho), image.COLOR_GREEN) + img.draw_string(x, y, "theta: " + str(theta) + "," + "rho: " + str(rho), image.COLOR_GREEN) img.draw_rect(roi[0], roi[1], roi[2], roi[3], image.COLOR_GREEN) - img.draw_text(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) + img.draw_string(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) screen.show(img) diff --git a/test/test_image_method/test_find_qrcodes.py b/test/test_image_method/test_find_qrcodes.py index 67b5922b..42b2b59e 100644 --- a/test/test_image_method/test_find_qrcodes.py +++ b/test/test_image_method/test_find_qrcodes.py @@ -20,28 +20,28 @@ # rect rect = a.rect() img.draw_rect(rect[0], rect[1], rect[2], rect[3], image.COLOR_BLUE) - img.draw_text(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_BLUE) + img.draw_string(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_BLUE) # payload - img.draw_text(a.x() + a.w() + 5, rect[1] + 20, "payload: " + a.payload(), image.COLOR_BLUE) + img.draw_string(a.x() + a.w() + 5, rect[1] + 20, "payload: " + a.payload(), image.COLOR_BLUE) # version - img.draw_text(a.x() + a.w() + 5, rect[1] + 35, "version: " + str(a.version()), image.COLOR_BLUE) - img.draw_text(a.x() + a.w() + 5, rect[1] + 50, "ecc_level: " + str(a.ecc_level()), image.COLOR_BLUE) - img.draw_text(a.x() + a.w() + 5, rect[1] + 65, "mask: " + str(a.mask()), image.COLOR_BLUE) - img.draw_text(a.x() + a.w() + 5, rect[1] + 80, "data_type: " + str(a.data_type()), image.COLOR_BLUE) - img.draw_text(a.x() + a.w() + 5, rect[1] + 95, "eci: " + str(a.eci()), image.COLOR_BLUE) + img.draw_string(a.x() + a.w() + 5, rect[1] + 35, "version: " + str(a.version()), image.COLOR_BLUE) + img.draw_string(a.x() + a.w() + 5, rect[1] + 50, "ecc_level: " + str(a.ecc_level()), image.COLOR_BLUE) + img.draw_string(a.x() + a.w() + 5, rect[1] + 65, "mask: " + str(a.mask()), image.COLOR_BLUE) + img.draw_string(a.x() + a.w() + 5, rect[1] + 80, "data_type: " + str(a.data_type()), image.COLOR_BLUE) + img.draw_string(a.x() + a.w() + 5, rect[1] + 95, "eci: " + str(a.eci()), image.COLOR_BLUE) if a.is_numeric(): - img.draw_text(a.x() + a.w() + 5, rect[1] + 110, "is numeric", image.COLOR_BLUE) + img.draw_string(a.x() + a.w() + 5, rect[1] + 110, "is numeric", image.COLOR_BLUE) elif a.is_alphanumeric(): - img.draw_text(a.x() + a.w() + 5, rect[1] + 110, "is alphanumeric", image.COLOR_BLUE) + img.draw_string(a.x() + a.w() + 5, rect[1] + 110, "is alphanumeric", image.COLOR_BLUE) elif a.is_binary(): - img.draw_text(a.x() + a.w() + 5, rect[1] + 110, "is binary", image.COLOR_BLUE) + img.draw_string(a.x() + a.w() + 5, rect[1] + 110, "is binary", image.COLOR_BLUE) elif a.is_kanji(): - img.draw_text(a.x() + a.w() + 5, rect[1] + 110, "is kanji", image.COLOR_BLUE) + img.draw_string(a.x() + a.w() + 5, rect[1] + 110, "is kanji", image.COLOR_BLUE) else: - img.draw_text(a.x() + a.w() + 5, rect[1] + 110, "is unknown", image.COLOR_BLUE) + img.draw_string(a.x() + a.w() + 5, rect[1] + 110, "is unknown", image.COLOR_BLUE) img.draw_rect(roi[0], roi[1], roi[2], roi[3], image.COLOR_GREEN) - img.draw_text(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) + img.draw_string(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) screen.show(img) diff --git a/test/test_image_method/test_find_rects.py b/test/test_image_method/test_find_rects.py index 5e08ccb8..a152a868 100644 --- a/test/test_image_method/test_find_rects.py +++ b/test/test_image_method/test_find_rects.py @@ -21,9 +21,9 @@ # rect rect = a.rect() img.draw_rect(rect[0], rect[1], rect[2], rect[3], image.COLOR_GREEN) - img.draw_text(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_GREEN) - img.draw_text(rect[0] + 5, rect[1] + 20, "magnitude: " + str(a.magnitude()), image.COLOR_GREEN) + img.draw_string(rect[0] + 5, rect[1] + 5, "rect", image.COLOR_GREEN) + img.draw_string(rect[0] + 5, rect[1] + 20, "magnitude: " + str(a.magnitude()), image.COLOR_GREEN) img.draw_rect(roi[0], roi[1], roi[2], roi[3], image.COLOR_GREEN) - img.draw_text(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) + img.draw_string(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) screen.show(img) diff --git a/test/test_image_method/test_find_template.py b/test/test_image_method/test_find_template.py index c8f931ad..bb831a8e 100644 --- a/test/test_image_method/test_find_template.py +++ b/test/test_image_method/test_find_template.py @@ -29,5 +29,5 @@ img.draw_image(10, 10, template_image) img.draw_rect(roi[0], roi[1], roi[2], roi[3], image.COLOR_GREEN) - img.draw_text(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) + img.draw_string(roi[0] + 5, roi[1] + 5, "ROI", image.COLOR_GREEN) screen.show(img)