Skip to content

Commit 5bb1f58

Browse files
committed
now locate image center will return int array not numpy int64 array
now locate image center will return int array not numpy int64 array int(numpy int64)
1 parent 95b0917 commit 5bb1f58

File tree

6 files changed

+365
-97
lines changed

6 files changed

+365
-97
lines changed

.idea/workspace.xml

Lines changed: 60 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="je_auto_control_dev",
8-
version="0.0.48",
8+
version="0.0.49",
99
author="JE-Chen",
1010
author_email="[email protected]",
1111
description="auto testing",

je_auto_control/wrapper/auto_control_image.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22
from typing import List, Union
33

4+
45
from je_auto_control.utils.exception.exception_tag import cant_find_image
56
from je_auto_control.utils.exception.exception_tag import find_image_error_variable
67
from je_auto_control.utils.exception.exceptions import ImageNotFoundException
@@ -24,7 +25,7 @@ def locate_all_image(image, detect_threshold: [float, int] = 1,
2425
try:
2526
image_data_array = template_detection.find_image_multi(image, detect_threshold, draw_image)
2627
except ImageNotFoundException as error:
27-
raise ImageNotFoundException(find_image_error_variable + " " + repr(error))
28+
raise ImageNotFoundException(find_image_error_variable + " " + repr(error) + " " + str(image))
2829
if image_data_array[0] is True:
2930
record_action_to_list("locate_all_image", param)
3031
return image_data_array[1]
@@ -47,13 +48,13 @@ def locate_image_center(image, detect_threshold: [float, int] = 1, draw_image: b
4748
try:
4849
image_data_array = template_detection.find_image(image, detect_threshold, draw_image)
4950
except ImageNotFoundException as error:
50-
raise ImageNotFoundException(find_image_error_variable + " " + repr(error))
51+
raise ImageNotFoundException(find_image_error_variable + " " + repr(error) + " " + str(image))
5152
if image_data_array[0] is True:
5253
height = image_data_array[1][2] - image_data_array[1][0]
5354
width = image_data_array[1][3] - image_data_array[1][1]
5455
center = [int(height / 2), int(width / 2)]
5556
record_action_to_list("locate_image_center", param)
56-
return [image_data_array[1][0] + center[0], image_data_array[1][1] + center[1]]
57+
return [int(image_data_array[1][0] + center[0]), int(image_data_array[1][1] + center[1])]
5758
else:
5859
raise ImageNotFoundException(cant_find_image)
5960
except Exception as error:

test/test_source/1.png

-20 Bytes
Loading
Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,7 @@
11
[
2-
[
3-
"type_key",
4-
{
5-
"keycode": 0
6-
}
7-
],
8-
[
9-
"mouse_left",
10-
{
11-
"mouse_keycode": "mouse_left",
12-
"x": 500,
13-
"y": 500
14-
}
15-
],
16-
[
17-
"position"
18-
],
19-
[
20-
"press_mouse",
21-
{
22-
"mouse_keycode": "mouse_left",
23-
"x": 500,
24-
"y": 500
25-
}
26-
],
27-
[
28-
"release_mouse",
29-
{
30-
"mouse_keycode": "mouse_left",
31-
"x": 500,
32-
"y": 500
33-
}
34-
]
2+
["type_key", {"keycode": 0}],
3+
["mouse_left", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}],
4+
["position"],
5+
["press_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}],
6+
["release_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}]
357
]
Lines changed: 295 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8"/>
5+
<title>AutoControl Report</title>
6+
7+
<style>
8+
9+
body{
10+
font-size: 100%;
11+
}
12+
13+
h1{
14+
font-size: 2em;
15+
}
16+
17+
.main_table {
18+
margin: 0 auto;
19+
border-collapse: collapse;
20+
width: 75%;
21+
font-size: 1.5em;
22+
}
23+
24+
.event_table_head {
25+
border: 3px solid #262626;
26+
background-color: aqua;
27+
font-family: "Times New Roman", sans-serif;
28+
text-align: center;
29+
}
30+
31+
.failure_table_head {
32+
border: 3px solid #262626;
33+
background-color: #f84c5f;
34+
font-family: "Times New Roman", sans-serif;
35+
text-align: center;
36+
}
37+
38+
.table_data_field_title {
39+
border: 3px solid #262626;
40+
padding: 0;
41+
margin: 0;
42+
background-color: #dedede;
43+
font-family: "Times New Roman", sans-serif;
44+
text-align: center;
45+
width: 25%;
46+
}
47+
48+
.table_data_field_text {
49+
border: 3px solid #262626;
50+
padding: 0;
51+
margin: 0;
52+
background-color: #dedede;
53+
font-family: "Times New Roman", sans-serif;
54+
text-align: left;
55+
width: 75%;
56+
}
57+
58+
.text {
59+
text-align: center;
60+
font-family: "Times New Roman", sans-serif;
61+
}
62+
</style>
63+
</head>
64+
<body>
65+
<h1 class="text">
66+
Test Report
67+
</h1>
68+
<table class="main_table">
69+
<thead>
70+
<tr>
71+
<th colspan="2" class="event_table_head">Test Report</th>
72+
</tr>
73+
</thead>
74+
<tbody>
75+
<tr>
76+
<td class="table_data_field_title">function_name</td>
77+
<td class="table_data_field_text">type_key</td>
78+
</tr>
79+
<tr>
80+
<td class="table_data_field_title">param</td>
81+
<td class="table_data_field_text">{'keycode': 65, 'is_shift': False, 'skip_record': False}</td>
82+
</tr>
83+
<tr>
84+
<td class="table_data_field_title">time</td>
85+
<td class="table_data_field_text">2022-11-29 14:29:16.294245</td>
86+
</tr>
87+
<tr>
88+
<td class="table_data_field_title">exception</td>
89+
<td class="table_data_field_text">None</td>
90+
</tr>
91+
</tbody>
92+
</table>
93+
<br><table class="main_table">
94+
<thead>
95+
<tr>
96+
<th colspan="2" class="event_table_head">Test Report</th>
97+
</tr>
98+
</thead>
99+
<tbody>
100+
<tr>
101+
<td class="table_data_field_title">function_name</td>
102+
<td class="table_data_field_text">position</td>
103+
</tr>
104+
<tr>
105+
<td class="table_data_field_title">param</td>
106+
<td class="table_data_field_text">None</td>
107+
</tr>
108+
<tr>
109+
<td class="table_data_field_title">time</td>
110+
<td class="table_data_field_text">2022-11-29 14:29:16.300627</td>
111+
</tr>
112+
<tr>
113+
<td class="table_data_field_title">exception</td>
114+
<td class="table_data_field_text">None</td>
115+
</tr>
116+
</tbody>
117+
</table>
118+
<br><table class="main_table">
119+
<thead>
120+
<tr>
121+
<th colspan="2" class="event_table_head">Test Report</th>
122+
</tr>
123+
</thead>
124+
<tbody>
125+
<tr>
126+
<td class="table_data_field_title">function_name</td>
127+
<td class="table_data_field_text">click_mouse</td>
128+
</tr>
129+
<tr>
130+
<td class="table_data_field_title">param</td>
131+
<td class="table_data_field_text">{'mouse_keycode': 'mouse_left', 'x': 500, 'y': 500}</td>
132+
</tr>
133+
<tr>
134+
<td class="table_data_field_title">time</td>
135+
<td class="table_data_field_text">2022-11-29 14:29:16.307549</td>
136+
</tr>
137+
<tr>
138+
<td class="table_data_field_title">exception</td>
139+
<td class="table_data_field_text">None</td>
140+
</tr>
141+
</tbody>
142+
</table>
143+
<br><table class="main_table">
144+
<thead>
145+
<tr>
146+
<th colspan="2" class="event_table_head">Test Report</th>
147+
</tr>
148+
</thead>
149+
<tbody>
150+
<tr>
151+
<td class="table_data_field_title">function_name</td>
152+
<td class="table_data_field_text">position</td>
153+
</tr>
154+
<tr>
155+
<td class="table_data_field_title">param</td>
156+
<td class="table_data_field_text">None</td>
157+
</tr>
158+
<tr>
159+
<td class="table_data_field_title">time</td>
160+
<td class="table_data_field_text">2022-11-29 14:29:16.307549</td>
161+
</tr>
162+
<tr>
163+
<td class="table_data_field_title">exception</td>
164+
<td class="table_data_field_text">None</td>
165+
</tr>
166+
</tbody>
167+
</table>
168+
<br><table class="main_table">
169+
<thead>
170+
<tr>
171+
<th colspan="2" class="event_table_head">Test Report</th>
172+
</tr>
173+
</thead>
174+
<tbody>
175+
<tr>
176+
<td class="table_data_field_title">function_name</td>
177+
<td class="table_data_field_text">position</td>
178+
</tr>
179+
<tr>
180+
<td class="table_data_field_title">param</td>
181+
<td class="table_data_field_text">None</td>
182+
</tr>
183+
<tr>
184+
<td class="table_data_field_title">time</td>
185+
<td class="table_data_field_text">2022-11-29 14:29:16.307549</td>
186+
</tr>
187+
<tr>
188+
<td class="table_data_field_title">exception</td>
189+
<td class="table_data_field_text">None</td>
190+
</tr>
191+
</tbody>
192+
</table>
193+
<br><table class="main_table">
194+
<thead>
195+
<tr>
196+
<th colspan="2" class="event_table_head">Test Report</th>
197+
</tr>
198+
</thead>
199+
<tbody>
200+
<tr>
201+
<td class="table_data_field_title">function_name</td>
202+
<td class="table_data_field_text">press_mouse</td>
203+
</tr>
204+
<tr>
205+
<td class="table_data_field_title">param</td>
206+
<td class="table_data_field_text">{'mouse_keycode': 'mouse_left', 'x': 500, 'y': 500}</td>
207+
</tr>
208+
<tr>
209+
<td class="table_data_field_title">time</td>
210+
<td class="table_data_field_text">2022-11-29 14:29:16.311854</td>
211+
</tr>
212+
<tr>
213+
<td class="table_data_field_title">exception</td>
214+
<td class="table_data_field_text">None</td>
215+
</tr>
216+
</tbody>
217+
</table>
218+
<br><table class="main_table">
219+
<thead>
220+
<tr>
221+
<th colspan="2" class="event_table_head">Test Report</th>
222+
</tr>
223+
</thead>
224+
<tbody>
225+
<tr>
226+
<td class="table_data_field_title">function_name</td>
227+
<td class="table_data_field_text">position</td>
228+
</tr>
229+
<tr>
230+
<td class="table_data_field_title">param</td>
231+
<td class="table_data_field_text">None</td>
232+
</tr>
233+
<tr>
234+
<td class="table_data_field_title">time</td>
235+
<td class="table_data_field_text">2022-11-29 14:29:16.311854</td>
236+
</tr>
237+
<tr>
238+
<td class="table_data_field_title">exception</td>
239+
<td class="table_data_field_text">None</td>
240+
</tr>
241+
</tbody>
242+
</table>
243+
<br><table class="main_table">
244+
<thead>
245+
<tr>
246+
<th colspan="2" class="event_table_head">Test Report</th>
247+
</tr>
248+
</thead>
249+
<tbody>
250+
<tr>
251+
<td class="table_data_field_title">function_name</td>
252+
<td class="table_data_field_text">press_mouse</td>
253+
</tr>
254+
<tr>
255+
<td class="table_data_field_title">param</td>
256+
<td class="table_data_field_text">{'mouse_keycode': 'mouse_left', 'x': 500, 'y': 500}</td>
257+
</tr>
258+
<tr>
259+
<td class="table_data_field_title">time</td>
260+
<td class="table_data_field_text">2022-11-29 14:29:16.312852</td>
261+
</tr>
262+
<tr>
263+
<td class="table_data_field_title">exception</td>
264+
<td class="table_data_field_text">None</td>
265+
</tr>
266+
</tbody>
267+
</table>
268+
<br><table class="main_table">
269+
<thead>
270+
<tr>
271+
<th colspan="2" class="failure_table_head">Test Report</th>
272+
</tr>
273+
</thead>
274+
<tbody>
275+
<tr>
276+
<td class="table_data_field_title">function_name</td>
277+
<td class="table_data_field_text">execute_action</td>
278+
</tr>
279+
<tr>
280+
<td class="table_data_field_title">param</td>
281+
<td class="table_data_field_text">None</td>
282+
</tr>
283+
<tr>
284+
<td class="table_data_field_title">time</td>
285+
<td class="table_data_field_text">2022-11-29 14:29:16.312852</td>
286+
</tr>
287+
<tr>
288+
<td class="table_data_field_title">exception</td>
289+
<td class="table_data_field_text">'TypeError("type_key() got an unexpected keyword argument \'mouse_keycode\'")'</td>
290+
</tr>
291+
</tbody>
292+
</table>
293+
<br>
294+
</body>
295+
</html>

0 commit comments

Comments
 (0)