Skip to main content

WRP Client - Workswell Remote Protocol Client

Welcome to the WRP Client’s documentation! WRP Client and WRP Server are two parts of a driver that allows to connect to the Workswell InfraRed Camera using Python. This repository contains the client part, that is written in Python. The second part, WRP Server, is written in C# because the Workswell company provides and supports access to the cameras only through their C# SDK and not throught any other language.

Installation

The simplest way to install WRP client is from the pypi:

pip install wrpclient

Alternative method is to build this repository:

git clone https://github.com/Kasape/wrpclient.git
cd wrpclient
python setup.py install

Usage

This project is implemented using asyncio library. But because using asyncio library can be a little problematic for beginners in Python, there are also synchronous wrappers about the asynchronous ones. First we have to create a instance of Client class and then connect it to the server:

from datetime import datetime
import wrp_client
import asyncio

client = wrp_client.Client()
SERVER_IP_ADDRESS = "127.0.0.1"
# synchronous wrapper for the method (coroutine)
# client.connect_async(ip_adress=SERVER_IP_ADDRESS)
client.connect(ip_adress=SERVER_IP_ADDRESS, timeout="20")

Once the client is connected to the server, we can get list of all cameras that was identified by the server.

# get all cameras
all_cameras = client.get_cameras(timeout="20")

Or we can get only one camera identified by the serial number. If the camera is not available, ValueError exception is raised. Then we have to open the camera to get frame(s):

# find camera with specific serial number
my_camera = client.get_camera(serial_number="ABCDEF", timeout="20")

my_camera.open(timeout="20")

# Return 2D frame (numpy matrix) with dtype np.float32 filled with raw data (decimal values of temperatures)
frame = my_camera.get_frame(timeout="20")

As you can see, all the functions above have parameter timeout. That is because each function is sending some request and is expecting response from to the server and latence of the server depends on the latence of the cameras. There are also asynchronous versions of these functions for more advanced users. They are named xxx_async as shown in case of client.connect_async.

You can also ask camera for the continuous stream of frames:

def callback(frame):
        time_str = datetime.now().strftime("%Y-%m-%d-%H-%M-%S-%f")
        frame_color = cv2.applyColorMap(frame, cv2.COLORMAP_JET)
        cv2.imwrite(f"frame-{time_str}.jpg", frame_color)

# give handler for continuous shot that saves colorized images with timestamp suffix
my_camera.start_continuous_shot(callback)

# wait some time to collect images
asyncio.sleep(5)

my_camera.stop_continuous_shot(callback)

If you want to use the API in IPython enviroment (most common are Jupyter notebooks), you have to install Nest asyncio and run the following code before using wrpclient:

import nest_asyncio
nest_asyncio.apply()

Documentation

Above you can find guide for installation and example of usage. The full version of the documentation also containing class and methods description (API) can be found on ReadTheDocs page or you can build it from a repository with code:

git clone https://github.com/Kasape/wrpclient.git
cd wrpclient/docs
pip install sphinx
make html

and open it with your browser on the address file://<path_to_repo>/docs/_build/html/index.html.

Licence

This project has GNU GPLv3 License.

Release files for wrpclient 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wrpclient 0.1
File Size Uploaded
wrpclient-0.1.tar.gz 24.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wrpclient 0.1
File Interpreter ABI Platform
wrpclient-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 49.1 kB

Release files / wrpclient-0.1.tar.gz

Download URL wrpclient-0.1.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3c325fbf2d9d7f289b839ca584def4ffed9f665de1e7bc51f00ea6dfb77723c1
BLAKE2b-256 checksum
How to use checksums
23a0c6c1ed1c5243407f009e6f3a262fc6c20e9994af206ee4794b94346c95f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.5

Release files / wrpclient-0.1-py3-none-any.whl

Download URL wrpclient-0.1-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33ae7f6524e232bc4f6fbe84d505741585cc9e2b476875b50f933a14e29e7d98
BLAKE2b-256 checksum
How to use checksums
d288aa4ea07276960c125162ab081cb462209c9386661698f8ce1fcc23dd1b74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.5

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page