Skip to content

infinicam/pypuclib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pypuclib

pypuclib is python package for INFINICAM SDK PUCLIB. This package allows user to control INFINICAM UC-1 on python.

infinicam_demo_python_tracking_en.mp4

*This is tracking_sample demo movie.

How to Use

  1. Install INFINICAM SDK PUCLIB, driver, and Visual C++ Redistributable 2019.
  2. See Install section to install pypuclib package.
  3. See Quick Start section to start programming.

Install

You can install it in any of the following ways:

  • Open command prompt and install using pip from pypi.

    pip install pypuclib
    

    If you don't register environment variable for python path, use this command instead.

    py -m pip install pypuclib
    
  • Install from source code.

    git clone repositryURL
    

    Move current directory to pypuclib/pypuclib/ and install using this command.

    pip install ./
    

Quick Start for Image Processing

To connect the first detected camera:

cam = CameraFactory().create()

And grab the image:

xferdata = cam.grab()

To decode image, get decoder object from camera and use it like:

decoder = cam.decoder()
img = decoder.decode(xferdata)

Decoded array is numpy array, so now you can use to imageprocessing package like opencv directory.

If you want to use only the resion of interest:

x = 0, y = 0, w = 128, h = 128
img = decoder.decode(xferdata, x, y, w, h)

This can reduce the decoding time.

For High Speed Processing

Use beginXfer and endXfer to get callback from C++.

  # xfercallback from c++
  def callback(data) :
    seq = data.sequenceNo()
    if oldSeq != seq:
      # avoid same sequence number.


  # beginn xfer and start callback background
  cam.beginXfer(callback)

  ~~ # some processing here

  cam.endXfer()

How to Run Samples

  1. Install pypuclib using pip.

  2. Download following sample source code.

  3. Run on python.

  python hello_world.py
  • hello_world

    Sample of streaming a live image and saving a bitmap. If a GPU device is available, decoding is done on the GPU. Otherwise, decoding is done on the CPU.

  • create_movie

    Sample of saving videos with high speed streaming.

  • tracking_sample

    Sample of real-time tracking at 1,000 fps.

  • gui_sample

    GUI sample for controlling camera parameters and recording.

  • find_1000

    This sample code implements the a deep learning network to detect objects such as people, cellphones etc.

Source Code Structure

This repository consists of three projects.

Prerequisites

To build pypuclib, the following environment is required.

  • Installed Visual Studio 2019

  ⚠️ The MSVC compiler is required to build the package.

  ⚠️ This package is available for Windows only.

Issues

Don't hesitate to ask any questions or issues on GitHub.

developped by: