-
Notifications
You must be signed in to change notification settings - Fork 0
Added filter to points in Lines, adapted algorithms according to changes, standardized outputs to return frame and angle #6
Conversation
algorithms/utils/Lines.py
Outdated
# xPoints = [] | ||
# yPoints = [] |
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.
Delete?
algorithms/utils/Lines.py
Outdated
# xPoints.append(intersect[0]) | ||
# yPoints.append(intersect[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.
same
algorithms/utils/Lines.py
Outdated
def filterPoints(numArray): | ||
low = np.percentile(numArray, 20) | ||
high = np.percentile(numArray, 80) | ||
filtered = [] | ||
|
||
for num in numArray: | ||
if num >= low and num <= high: | ||
filtered.append(num) | ||
|
||
return filtered |
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.
documentation
algorithms/utils/Lines.py
Outdated
|
||
filteredX = filterPoints(xPoints) | ||
filteredY = filterPoints(yPoints) | ||
|
||
if len(filteredX) != 0: | ||
if use_median: | ||
IntersectingX = np.median(points) | ||
IntersectingX = np.median(filteredX) | ||
IntersectingY = np.median(filteredY) | ||
else: | ||
IntersectingX = np.mean(points) | ||
IntersectingX = np.mean(filteredX) | ||
IntersectingY = np.mean(filteredY) | ||
|
||
cv2.circle(frame, (int(IntersectingX), int(frame.shape[1] / 2)), 8, (255, 0, 0), -1) | ||
cv2.circle(frame, (int(IntersectingX), int(IntersectingY)), 8, (255, 0, 0), -1) | ||
|
||
return (int(IntersectingX), int(frame.shape[1] / 2)) | ||
return (int(IntersectingX), int(IntersectingY)) |
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.
update documentation for this change and any other methods that are changed
algorithms/CenterRowAlgorithm.py
Outdated
|
||
intersections = Lines.getIntersections(lines) | ||
xPoints = [point[0] for point in intersections] | ||
yPoints = [point[1] for point in intersections] | ||
vanishing_point = Lines.drawVanishingPoint(ellipse_frame, xPoints, yPoints) |
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.
python variable conventions, here and everywhere else.
if show: | ||
cv2.imshow('frame', frame) | ||
cv2.imshow('mask', mask) | ||
cv2.imshow('c_mask', c_mask) | ||
cv2.imshow('points', points) | ||
cv2.waitKey(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.
See if we can remove unnecassary frame processes for algorithms
When will this be merged by? If this successfully standardizes the outputs, can we merge and move the other changes requested by @L0Lmaker to another PR? |
Yeah that should be doable @AnimeAllstar I'll merge it in and ping you. |
So it looks like we can't merge this in yet. There are runtime errors when the code is run on videos. |
No description provided.