Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jackw1997
Copy link

No description provided.

Comment on lines +125 to +128
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])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 尽量不要用 for-append
  2. HoughLines返回的是极座标,可以直接判断不用转直角坐标

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直角坐标最后还是要来计算边框的位置的,所以似乎极坐标转直角坐标是不可避免的。
整个流程也就一次极坐标转直角坐标,感觉开销并不大。
(而且本地测过时间了,目前的性能瓶颈在houghlines这个函数上,已经没有太大的优化可能了

Copy link
Contributor

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 就是截距吧,这也许可以转换快一点。然后距离判断也可以直接算截距差

Comment on lines +70 to +74
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)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

禁止 sleep,需要判断物品是否被选中

Comment on lines +157 to +160
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]))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改用 np.diff

@LmeSzinc LmeSzinc added the feature request / 功能请求 New feature or requests label Aug 15, 2023
@LmeSzinc LmeSzinc added the good first issue / 首次贡献 Good for newcomers label Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants