Conversation
avesk
left a comment
There was a problem hiding this comment.
Sorry, should have been a bit more clear. What I was looking for here was a camera class that contains a method capture() which conditionally uses the piCam, or webcam (depending on whether the piCam is connected) to capture a single frame and return a numpy img object.
avesk
left a comment
There was a problem hiding this comment.
Looking good! Few more pieces of feedback
apps/Vision/Capture.py
Outdated
| if found_picamera: | ||
| # initialize the camera and grab a reference to the raw camera capture | ||
| self.picamera = PiCamera() | ||
| self.picamera.resolution = (3280, 2464) |
There was a problem hiding this comment.
Hey can we make the resolution a class property? And set the default to (2592 , 1944)? I would say make it a constructor value, but use the default if no value is provided
There was a problem hiding this comment.
Hey @avesk , is there a reason you want to keep the resolution lower than 8mp? Is that more suitable for your classifier?
apps/Vision/Capture.py
Outdated
| # initialize the camera and grab a reference to the raw camera capture | ||
| self.picamera = PiCamera() | ||
| self.picamera.resolution = (3280, 2464) | ||
| self.picamera.framerate = 32 |
There was a problem hiding this comment.
I think this would also be best stored as a class prop
apps/Vision/Capture.py
Outdated
| self.picamera.framerate = 32 | ||
| rawCapture = PiRGBArray(self.picamera, size=(640, 480)) | ||
| self.camera_feed = camera.capture() | ||
| pass |
There was a problem hiding this comment.
we can remove this call to pass now too
apps/Vision/Capture.py
Outdated
| self.picamera = PiCamera() | ||
| self.picamera.resolution = (3280, 2464) | ||
| self.picamera.framerate = 32 | ||
| rawCapture = PiRGBArray(self.picamera, size=(640, 480)) |
There was a problem hiding this comment.
Is this necessary? I dont see it used anywhere
apps/Vision/Capture.py
Outdated
| def capture(self): | ||
| cam = cv2.VideoCapture(self.camera_feed) | ||
| ret_val, frame = cam.read() | ||
| return cv2.imshow('my webcam', frame) |
There was a problem hiding this comment.
We'll wanna return the frame here. We'll have to come up with a different method for testing, probably write a test script that instantiates this class, calls capture() and then writes it to disk so that we can check that its coming in correctly
apps/Vision/Capture.py
Outdated
| ret_val, frame = cam.read() | ||
| return cv2.imshow('my webcam', frame) | ||
|
|
||
| if __name__ == "__main__": |
There was a problem hiding this comment.
I guess this is just for testing?
|
Hey guys, Im a little late on the ball for this one but I feel that this has mostly been implemented in the PiCam module. It seems this is issue is almost complete already... but to keep client code working maybe we should try and port the code from this Capture file over to the PiCam module? |
sounds good, let's move the changes into the PiCam app then. |
This closes https://github.com/uvic-aero/onboard-computer/issues/39
Needs tests for pycam portion