New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pycamera

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pycamera - pypi Package Compare versions

Comparing version
0.2.1
to
0.3
+31
-12
PKG-INFO
Metadata-Version: 2.1
Name: pycamera
Version: 0.2.1
Version: 0.3
Summary: An easier solution to computer vision.

@@ -13,4 +13,2 @@ Home-page: https://github.com/IsmaeelAkram/pycamera

# pycamera
An easier solution to computer vision.

@@ -22,21 +20,42 @@

## Installation
## Examples
```sh
pip3 install pycamera
### Save Picture
```python
from pycamera import camera
cam = camera.Camera(0) # Choosing a camera
snap = cam.snap() # Snapping a picture from that camera
snap.save("output.jpg") # Save picture to output.jpg
```
This will install pycamera, NumPy, and OpenCV.
### Editing with Pillow
## Example Usage
```python
from pycamera import camera
from PIL import Image, ImageDraw
cam = camera.Camera(0) # Choosing a camera
snap = cam.snap() # Snap photo
image = snap.to_pillow() # Convert pycamera image to Pillow image
draw = ImageDraw.Draw(image)
# Draw stuff here
image.show()
```
### Live View
```python
import pycamera
from pycamera import camera
cam = camera.Camera(1) # Choosing a camera
snap = cam.snap() # Snapping a picture from that camera
cam = camera.Camera(0) # Choosing a camera
snap.save("output.jpg") # Save picture to output.jpg
while True:
snap = cam.read() # (reading is better for loops)
snap.show()
pycamera.waitForKey() # Wait until key is pressed (default key is Escape)
```
Metadata-Version: 2.1
Name: pycamera
Version: 0.2.1
Version: 0.3
Summary: An easier solution to computer vision.

@@ -13,4 +13,2 @@ Home-page: https://github.com/IsmaeelAkram/pycamera

# pycamera
An easier solution to computer vision.

@@ -22,21 +20,42 @@

## Installation
## Examples
```sh
pip3 install pycamera
### Save Picture
```python
from pycamera import camera
cam = camera.Camera(0) # Choosing a camera
snap = cam.snap() # Snapping a picture from that camera
snap.save("output.jpg") # Save picture to output.jpg
```
This will install pycamera, NumPy, and OpenCV.
### Editing with Pillow
## Example Usage
```python
from pycamera import camera
from PIL import Image, ImageDraw
cam = camera.Camera(0) # Choosing a camera
snap = cam.snap() # Snap photo
image = snap.to_pillow() # Convert pycamera image to Pillow image
draw = ImageDraw.Draw(image)
# Draw stuff here
image.show()
```
### Live View
```python
import pycamera
from pycamera import camera
cam = camera.Camera(1) # Choosing a camera
snap = cam.snap() # Snapping a picture from that camera
cam = camera.Camera(0) # Choosing a camera
snap.save("output.jpg") # Save picture to output.jpg
while True:
snap = cam.read() # (reading is better for loops)
snap.show()
pycamera.waitForKey() # Wait until key is pressed (default key is Escape)
```
import cv2
def disable_logging():
cv2.setLogLevel(0)
class UserQuit(Exception):
pass
def waitForKey(delay=15, key=27):
"""Returns if key (Escape, by default) is pressed"""
if cv2.waitKey(delay) == key:
raise UserQuit("User has quit, this is perfectly normal.")
import cv2
from .frame import Frame
import time

@@ -10,3 +11,5 @@

def snap(self, delay: float = 0, count: int = 30):
def snap(self, delay_seconds: float = 0, count: int = 30):
"""Snaps a picture from the camera. IF YOU ARE IN A LOOP, USE read(). THIS HAS A DELAY FOR LIGHTING"""
time.sleep(delay_seconds)
ret, frame = None, None

@@ -16,1 +19,6 @@ for i in range(count):

return Frame(img)
def read(self):
"""Reads camera; better for loops. If taking a singular picture, use snap() to fix lighting/exposure."""
ret, frame = self.cap.read()
return Frame(frame)
import cv2
import numpy as np
import PIL

@@ -17,5 +18,5 @@

def pillow(self):
def to_pillow(self) -> PIL.Image:
"""Returns a PIL (Pillow) compatible image. Alias of rgb()"""
return self.rgb()
return PIL.Image.fromarray(self.rgb().to_numpy())

@@ -22,0 +23,0 @@ def show(self):

@@ -17,8 +17,9 @@ # pycamera

## Example Usage
## Examples
### Save Picture
```python
from pycamera import camera
cam = camera.Camera(1) # Choosing a camera
cam = camera.Camera(0) # Choosing a camera
snap = cam.snap() # Snapping a picture from that camera

@@ -28,1 +29,30 @@

```
### Editing with Pillow
```python
from pycamera import camera
from PIL import ImageDraw
cam = camera.Camera(0) # Choosing a camera
snap = cam.snap() # Snap photo
image = snap.to_pillow() # Convert pycamera image to Pillow image
draw = ImageDraw.Draw(image)
# Draw stuff here
image.show()
```
### Live View
```python
import pycamera
from pycamera import camera
cam = camera.Camera(0) # Choosing a camera
while True:
snap = cam.read() # (reading is better for loops)
snap.show()
pycamera.waitForKey() # Wait until key is pressed (default key is Escape)
```
from setuptools import setup
readme = ""
with open("README.md") as f:
with open("README-pypi.md") as f:
readme = f.read()

@@ -9,3 +9,3 @@

name="pycamera",
version="0.2.1",
version="0.3",
description="An easier solution to computer vision.",

@@ -12,0 +12,0 @@ long_description=readme,