detect the boundary of the relics objects, and fix the savage relics bug#53
Open
jackw1997 wants to merge 1 commit intoLmeSzinc:masterfrom
Open
detect the boundary of the relics objects, and fix the savage relics bug#53jackw1997 wants to merge 1 commit intoLmeSzinc:masterfrom
jackw1997 wants to merge 1 commit intoLmeSzinc:masterfrom
Conversation
LmeSzinc
reviewed
Aug 5, 2023
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]) |
Owner
There was a problem hiding this comment.
- 尽量不要用 for-append
- HoughLines返回的是极座标,可以直接判断不用转直角坐标
Author
There was a problem hiding this comment.
直角坐标最后还是要来计算边框的位置的,所以似乎极坐标转直角坐标是不可避免的。
整个流程也就一次极坐标转直角坐标,感觉开销并不大。
(而且本地测过时间了,目前的性能瓶颈在houghlines这个函数上,已经没有太大的优化可能了
Contributor
There was a problem hiding this comment.
直角坐标最后还是要来计算边框的位置的,所以似乎极坐标转直角坐标是不可避免的。 整个流程也就一次极坐标转直角坐标,感觉开销并不大。 (而且本地测过时间了,目前的性能瓶颈在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) |
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])) |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.