Skip to main content

This package provides quick and easy way to compute camera motion field given two consecutive images.

Project description

Cam_motion_field

Description

This package provides quick and easy way to compute camera motion field given two consecutive images.

Install

pip install cam-motion-field

Usage

from cam_motion_field import get_cam_flow
import cv2
image1_file = "PATH/TO/THE/FIRST/IMAGE/FILE"
image2_file = "PATH/TO/THE/SECOND/IMAGE/FILE"
ncol = 10
nrow = 10
grid_size = (ncol, nrow)

img1 = cv2.imread(image1_file, 0)
img2 = cv2.imread(image2_file, 0)
# origins.shape = (10,10,2)
# displacements.shape = (10,10,2)
origins, displacements = get_cam_flow(img1, img2, grid_size[0], grid_size[1])

The above example defines a 10x10 grid and returns 100 origins and displacement points. Both origins and displacements are absolute coordinates!

Parameters:
Parameters
----------
image1 : numpy array
    image1 a grayscale image
image2 : numpy array
    image2 a grayscale image
n_rows : int
    number of rows in the grid
n_cols : int
    number of columns in the grid

Example

Examples where generated using the example.py. This gif shows two images where either the camera moved forward or some zoom effect took place

The resuts are: 5x5 Grid

10x10 Grid

20x20 Grid

Notice that 20x20 has many zero displacements. This happens when the grid is too fine and no good features are detected in the cell.

Project details


Release history Release notifications | RSS feed

This version

1.4

Download files

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

Source Distribution

cam-motion-field-1.4.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

cam_motion_field-1.4-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file cam-motion-field-1.4.tar.gz.

File metadata

  • Download URL: cam-motion-field-1.4.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for cam-motion-field-1.4.tar.gz
Algorithm Hash digest
SHA256 643fd7decc5c06c6ee48928d68570b1bd7224dc473ec2a20cf98414b9f1c628e
MD5 1aa807938923e2bcf50eb162782b1fba
BLAKE2b-256 27b738430d5190254b37c42b797a40a8134e1c5c379748bcdbef851f8ca2b3f6

See more details on using hashes here.

File details

Details for the file cam_motion_field-1.4-py3-none-any.whl.

File metadata

  • Download URL: cam_motion_field-1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for cam_motion_field-1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2d29c430e504519d9db5e9a87877c12cbfa261e6433d556917e5d1e9e2b79e33
MD5 add39822bffc4b08df22c568b6ecef20
BLAKE2b-256 2a654e87572c5b9c799a3104735cd3c2097ae95d5655fd55721df24aad93581d

See more details on using hashes here.

Supported by

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