-
Notifications
You must be signed in to change notification settings - Fork 203
detect the boundary of the relics objects, and fix the savage relics bug #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
for line in lines_h: | ||
if abs(line[1]-line[3]) < 2 and not any(abs(prev_line[1] - line[1]) < 5 for prev_line in lines_result_h): | ||
lines_result_h.append(line) | ||
h_axis.append(line[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 尽量不要用 for-append
- HoughLines返回的是极座标,可以直接判断不用转直角坐标
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直角坐标最后还是要来计算边框的位置的,所以似乎极坐标转直角坐标是不可避免的。
整个流程也就一次极坐标转直角坐标,感觉开销并不大。
(而且本地测过时间了,目前的性能瓶颈在houghlines这个函数上,已经没有太大的优化可能了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直角坐标最后还是要来计算边框的位置的,所以似乎极坐标转直角坐标是不可避免的。 整个流程也就一次极坐标转直角坐标,感觉开销并不大。 (而且本地测过时间了,目前的性能瓶颈在houghlines这个函数上,已经没有太大的优化可能了
theta = 0/90° 的时候,rho 就是截距吧,这也许可以转换快一点。然后距离判断也可以直接算截距差
relics_selected_count += 1 | ||
logger.info(f"Trying to find the savagable relics for the {relics_selected_count} time") | ||
|
||
time.sleep(3) | ||
relics_selected_sign = RelicsUI._get_relics_selected_button(relics_v, relics_h) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
禁止 sleep,需要判断物品是否被选中
rec_h_pair = [] | ||
for h_index in range(1, len(lines_h)-1): | ||
if abs((lines_h[h_index] - lines_h[h_index-1]) - 89) < 2 and abs((lines_h[h_index+1] - lines_h[h_index]) - 20) < 2: | ||
rec_h_pair.append((lines_h[h_index-1], lines_h[h_index+1])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改用 np.diff
No description provided.