Skip to content
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

Capturing an image using pygame and saving it #78

Closed
illume opened this Issue Aug 25, 2011 · 4 comments

Comments

Projects
None yet
1 participant
@illume
Copy link
Member

illume commented Aug 25, 2011

Originally reported by: Anonymous


I had a problem with respect to the capturing of a image from a webcam and saving it. I wrote a small code to do this, but on executing the program i am just getting a black(blank) image of size(640,480).

"import pygame

import pygame.camera

from pygame.locals import *

pygame.init()

pygame.camera.init()

window = pygame.display.set_mode((640,480),0)

cam = pygame.camera.Camera(0)

cam.start()

image = cam.get_image()

pygame.image.save(window,'abc.jpg')

cam.stop()"

It also opens the pygame window but that is also blank, and it goes to the NOT RESPONDING state in a seconds time. Any solutions you could suggest me regarding the above?


@illume

This comment has been minimized.

Copy link
Member Author

illume commented Aug 26, 2011

Original comment by Anonymous:


Thank you Nirav(nrp).

I am working on a Image processing task.

Is there any method to control the exposure time and frame rate of the camera from the pygame package? I am asking this because when the images are captured in dark situations then the same image is copied to around 30 frames before the next frame is captured and copied for the next 30 frames. Can this be because of the Buffer involved. Is the buffer slow ??

Any Inputs ??

@illume

This comment has been minimized.

Copy link
Member Author

illume commented Aug 26, 2011

Original comment by René Dudfield (Bitbucket: illume, GitHub: illume):


Which OS are you on?

@illume

This comment has been minimized.

Copy link
Member Author

illume commented Aug 27, 2011

Original comment by Anonymous:


I am on Windows 7.

@illume

This comment has been minimized.

Copy link
Member Author

illume commented Jul 7, 2012

Original comment by Sam Bull (Bitbucket: Dreamsorcerer, GitHub: Dreamsorcerer):


Change the line from your code:

pygame.image.save(window,'abc.jpg')

to:

pygame.image.save(image,'abc.jpg')

You saved the window screen, and not the camera image.

@illume illume added this to the 1.9.2 milestone Mar 26, 2017

@illume illume closed this Mar 26, 2017

illume pushed a commit that referenced this issue Apr 3, 2017

Merged in takluyver/pygame/config-extra-base (pull request #78)
Add environment PYGAME_EXTRA_BASE to add an extra base directory to the start of the search path.

Approved-by: Ren? Dudfield <renesd@gmail.com>

illume pushed a commit that referenced this issue Apr 3, 2017

Merged in takluyver/pygame/config-extra-base (pull request #78)
Add environment PYGAME_EXTRA_BASE to add an extra base directory to the start of the search path.

Approved-by: Ren? Dudfield <renesd@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.