banner



How To Use Raspberry Pi Camera

The Raspberry Pi camera module is a great accessory for the Pi—information technology's slap-up quality, and can capture still photos and record video in full HD (1080p). The original five-megapixel camera module was released in 2013, and a new 8-megapixel version was released in April this year. Both versions are compatible with all Raspberry Pi models. There are as well two variations—a regular visible light camera, and an infra-red photographic camera—both available for United states$ 25.

The camera module is high spec and much better quality than a bones USB webcam. Its feature-packed firmware fully utilizes the power of the VideoCore GPU in the Raspberry Pi SoC, allowing recording 1080p video at 30fps, 720p at 60fps, and VGA resolution (640x480) at 90fps—perfect for slow-motion playback.

Get started

Outset, with the Pi switched off, yous'll need to connect the camera module to the Raspberry Pi'south camera port, and then get-go upward the Pi and ensure the software is enabled. Locate the camera port on your Raspberry Pi and connect the camera:

Dave Jones, CC Past-SA

Ensure the photographic camera software is enabled in the Raspberry Pi Configuration tool:

screenshot

Test your camera by opening a terminal window and entering raspistill -k. This will bear witness you a camera preview on the monitor. If you're continued via SSH or VNC, this will exist shown on the Pi'due south monitor, not yours. Press Ctrl + C to exit the preview.

Python

Although you can control the camera using the control-line interface raspistill, using the Python picamera module is much easier and allows yous to alter the camera controls dynamically in real time—ideal for projects.

Open the Python 3 editor, IDLE, create a new file and type the post-obit code:

from picamera import PiCamera from fourth dimension import sleep  camera = PiCamera()  camera.start_preview() sleep(3) camera.capture('/home/pi/Desktop/paradigm.jpg') camera.stop_preview()        

Now run the code and information technology should evidence the preview for 3 seconds before capturing a photo. The photo volition be saved on your desktop, and you should see an icon with a thumbnail announced right away. Double-click the icon on your desktop to see the picture.

You can manipulate the camera object in various ways. You can alter the effulgence and dissimilarity with values between 0 and 100: camera.brightness = 70 camera.dissimilarity = twoscore You can add text to the prototype with: camera.

annotate_text = "Hello world"

You tin alter the epitome upshot with:

camera.image_effect = "colorswap"

Also try out effects, such as sketch, negative, and emboss. A list of furnishings is provided in camera.

IMAGE_EFFECTS, which you can loop over and makes a great demo:

camera.start_preview() for effect in photographic camera.IMAGE_EFFECTS:     camera.image_effect = effect     camera.annotate_text = effect     slumber(5) camera.stop_preview()        

At that place are many more attributes you tin alter, such every bit resolution, zoom, ISO, white-balance modes, and exposure modes. See the picamera documentation for more details.

Video

Recording video is just as easy—but use the methods start_recording() and stop_recording():

camera.start_preview() camera.start_recording('/home/pi/video.h264') sleep(10) camera.stop_recording() photographic camera.stop_preview()        

So play back using omxplayer. Annotation the video may play back at a college frame rate than was recorded.

Infrared

The Raspberry Pi infrared camera (Pi NoIR) was made especially considering people were buying the regular camera and taking it apart to remove the infrared filter—with varying success—and so the Foundation decided to produce a special camera without the infrared filter. The API works exactly the aforementioned, and in visible light, pictures will appear more often than not normal, but they tin can as well see infrared light, allowing capturing and recording at night.

Pi camera

This is groovy for wildlife cameras, such as the Naturebytes kit, projects like the infrared bird box, and various security camera projects. The IR photographic camera has even been used to monitor penguins in Antarctica.

As well the camera tin can be used to monitor the health of dark-green plants.

Pi Nil

When the $v Pi Zero was announced last year, it did not characteristic a camera connector due to its bare bones minimalist nature; however, last month a new version of the Naught was announced, which added a camera port.

The connector is smaller than the regular i. In fact, the same connector is used on the compute module, just a cable can be used to connect a camera. Both spins—visible and infrared—and both versions (V1 and V2) work with the new Pi Zero.

More than ideas

There's plenty more to read up on what y'all tin practice with the camera module, and why not necktie in with some GPIO for more than physical computing projects?

  • Meet the picamera documentation
  • Piece of work through the Getting Started with Picamera resource.
  • Try using GPIO Zippo in combination with Picamera (add a push button or a motion sensor).
  • Build a robot with sensors and a camera.
  • Utilise the Twitter API to post your photos to Twitter.
  • Make an infrared bird box. Besides check out the Naturebytes wildlife camera kit.
  • Make a parent detector.
  • Prepare up for fourth dimension-lapse or stop motion.

Source: https://opensource.com/life/15/6/raspberry-pi-camera-projects

Posted by: bairdanowbod.blogspot.com

0 Response to "How To Use Raspberry Pi Camera"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel