0

I am creating a project with python and Raspberry Pi. I am trying to use my Webcam, as I, unfortunately burned my Camera Module. I was following along: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/image_processing/

Everything is working fine, except for one problem. I am not able to save the image file that is captured. I would like to take the photo I have created and turn it into a .jpg image. Code I have currently:

from imgproc import *
import cv2

# open the webcam
my_camera = Camera(320, 240)
# grab an image from the camera
my_image = my_camera.grabImage()

# open a view, setting the view to the size of the captured image
my_view = Viewer(my_image.width, my_image.height, "ETSBot Look")

# display the image on the screen
my_view.displayImage(my_image)

# wait for 5 seconds, so we can see the image
waitTime(0)

Can someone please help me with this problem?

Thanks in advance! -Saurish Srivastava

Custom Library: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/downloads/

UPDATE: It does not have to just use this type of code. You can give me an example with a different software. Just tell me how to use it properly so I don't mess up.

1 Answer 1

1

Adding the following in your code should save the image in the array my_image as picture.jpg

cv2.imwrite('picture.jpg', my_image)

For details on configuring raspberry pi-http://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/

Sign up to request clarification or add additional context in comments.

1 Comment

If you found this useful, you can upvote or accept this as the answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.