Skip to main content

This library contains various Audio and Video Signal Processing utilities

Project description

pyshine

A collection of simply yet high level utilities for Python.

Installation

Installing dependencies

Provided the below python packages are installed, pyshine is completely pip installable.

Installing pyshine

pip install pyshine

To upgrade to the newest version pip install --upgrade pyshine

pyshine.putBText()

putBText(): Put Background Box with Text

Inputs:
img: cv2 image img
text_offset_x, text_offset_x: X,Y location of text start
vspace, hspace: Vertical and Horizontal space between text and box boundries
font_scale: Font size
background_RGB: Background R,G,B color
text_RGB: Text R,G,B color
font: Font Style e.g. cv2.FONT_HERSHEY_DUPLEX,cv2.FONT_HERSHEY_SIMPLEX,cv2.FONT_HERSHEY_PLAIN,cv2.FONT_HERSHEY_COMPLEX
      cv2.FONT_HERSHEY_TRIPLEX, etc
thickness: Thickness of the text font
alpha: Opacity 0~1 of the box around text
gamma: 0 by default

Output:
img: CV2 image with text and background

usage

import pyshine as ps
import cv2
image = cv2.imread('lena.jpg')
text  =  'HELLO WORLD!'
image =  ps.putBText(image,text,text_offset_x=20,text_offset_y=20,vspace=10,hspace=10, font_scale=1.0,background_RGB=(228,225,222),text_RGB=(1,1,1))
cv2.imshow('Output', image)
cv2.waitKey(0)

pyshine.audioCapture()

audioCapture(): Send or Get the Audio from pc Microphone

Inputs:
mode: 'send' to send the audio chunk data or 'get' to receive the audio data

Output:
audio: Audio data, which can be accessed using audio.get() or send using audio.put()

usage

import pyshine as ps
mode =  'send'
audio=audioCapture(mode)

pyshine.showPlot()

showPlot(): Plots the live data

Inputs:
audio: audio data obtained 
name: 'Tile of the plot'
length defult 8 times 1024
xmin: default 0 along the x axis
ymin: default -0.5 along the x axis
xmax: default 8*1024 along the y axis
ymax: default 0.5 along the y axis
color: Color of the plot (0,1,0.29)


Output:
show the plot()

usage

import pyshine as ps
mode =  'send'
audio,context=ps.audioCapture(mode=mode)
name =  'pyshine.com'
ps.showPlot(context,name=name)
while True:
	frame = audio.get()

pyshine.RPSNET

A CNN model for the Keras library, incorporating Rock, Paper, Scissor learnining Network.

import pyshine as ps
from keras.optimizers import Adam

# WIDTH : width of image about 80 pixels
# HEIGHT : height of image about 80 pixels
# DEPTH : dimensions of image such as 3
# NUM_CLASSES : number of classes to classify as output
model =ps.RPSNET.build(width=WIDTH, height=HEIGHT, depth=DEPTH, classes=NUM_CLASSES)
INIT_LR = 1e-3
EPOCHS = 1000
OPT = Adam(lr=INIT_LR, decay=INIT_LR / EPOCHS)
model.compile(
		optimizer=OPT,
		loss='categorical_crossentropy',
		metrics=['accuracy']
		)
# data: numpy image array containing data samples
# labels: corresponding labels per data
model.fit(np.array(data), np.array(labels),epochs=EPOCHS)
model.save("RPS-model.h5")
pred = model.predict(np.array([image]))

License

© 2020 PyShine

This repository is licensed under the MIT license. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyshine-0.0.7.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyshine-0.0.7-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file pyshine-0.0.7.tar.gz.

File metadata

  • Download URL: pyshine-0.0.7.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.4

File hashes

Hashes for pyshine-0.0.7.tar.gz
Algorithm Hash digest
SHA256 f1d94c3f617ecc2c1fc84dda1569bac5bc316ea20d65a6fd9e8322acef9a7fdb
MD5 4ed32df6584cfd91d796289f4ff28e9f
BLAKE2b-256 736199381435b802f2b2007578b3467e71ae8f8c6ec71d11b0fe619123706034

See more details on using hashes here.

File details

Details for the file pyshine-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: pyshine-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.4

File hashes

Hashes for pyshine-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3487ec820d05e93aefb09099223ffcc6b9d65c14cc8c75ccb710734d90e717d6
MD5 bbb623799b0add6e11e91cc5d155292b
BLAKE2b-256 bdc5ab463351b6d4179ad8a990b4bb3090a97cedce627b9ee4b3af6572c1d2e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page