-
Notifications
You must be signed in to change notification settings - Fork 14
test-pr #5
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?
test-pr #5
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,11 +26,32 @@ def read_frames(self, image_h, image_w): | |
| - Also assign frames to "self" object | ||
| - Return your results | ||
| ''' | ||
| frames = [] | ||
| # 5-1 /5-2 Read video and collect them | ||
|
|
||
| self.frames = ... # 5-3 let object have the result | ||
| return ... # return your results | ||
|
|
||
|
|
||
| # Read until video is completed | ||
| while(self.cap.isOpened()): | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (建議) Line33 可以省略括號 |
||
| ret, frame = self.cap.read() | ||
| if ret == True: | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line 35 可以寫成 if ret:,因為通常較少用 == 來比較物件跟 True/False boolean |
||
| frame_r=resize(frame,image_h,image_w) | ||
| cv2.imshow('Frame',frame) | ||
| self.frames.append(frame_r) | ||
| if cv2.waitKey(25) & 0xFF == ord('q'): | ||
| break | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line 39 40 這邊可以不寫哦。 因為目的就是要讓它處理完,不存在中途需要quit的問題。 |
||
| else : | ||
| break | ||
|
|
||
| # Press Q on keyboard to exit | ||
|
|
||
|
|
||
| # When everything done, release the video capture object | ||
|
|
||
| # Closes all the frames | ||
| cv2.destroyAllWindows() | ||
|
|
||
|
|
||
| #self.frames = ... # 5-3 let object have the result | ||
| return self.frames # return your results | ||
|
|
||
| def __exit__(self, exc_type, exc_val, exc_tb): | ||
| self.cap.release() | ||
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.
這邊不需要 import cv2哦