saurish
saurish

Reputation: 78

How To Save Image Via Image Processing [Raspberry Pi]

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.

Upvotes: 0

Views: 3710

Answers (1)

Amal Vincent
Amal Vincent

Reputation: 154

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/

Upvotes: 1

Related Questions