• Stars
    star
    128
  • Rank 281,044 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created about 7 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sliding Window library for image processing in Python

Version Build Status Anaconda-Server Badge Anaconda-Server Badge

Sliding Window

This is a simple little Python library for computing a set of windows into a larger dataset, designed for use with image-processing algorithms that utilise a sliding window to break the processing up into a series of smaller chunks. In addition, a set of optional transformations can be specified to be applied to each window.

Functionality is also included to compute a distance matrix for a window, for use cases where the position of each pixel in a window (relative to its centre) needs to be taken into account, as well as functionality for batching windows and merging the results of processing that is applied to windows.

For use cases where window bounds need to be modified after they have been generated, window objects can be converted to and from rectangles represented by a tuple of (x,y,w,h). Functionality for transforming rectangles (padding, cropping, forcing a square aspect ratio, etc.) are also provided.

Functionality is also provided for NumPy array creation that will fallback to using memory-mapped temporary files for the underling array buffers if there is insufficient system memory available, as well as determining the largest square window size that can be used when generating windows.

Installation

To install with pip, run:

pip install slidingwindow

To install with conda, run:

conda install slidingwindow

Usage Example

import slidingwindow as sw
import numpy as np

# Load our input image here
# data = load(...)

# Generate the set of windows, with a 256-pixel max window size and 50% overlap
windows = sw.generate(data, sw.DimOrder.HeightWidthChannel, 256, 0.5)

# Do stuff with the generated windows
for window in windows:
	subset = data[ window.indices() ]
	# ...

# Or, using some transformation functions
tranforms = [
	lambda m: np.fliplr(m),
	lambda m: np.flipud(m),
	lambda m: np.rot90(m, k=1, axes=(0, 1)),
	lambda m: np.rot90(m, k=3, axes=(0, 1))
]
windows = sw.generate(data, sw.DimOrder.HeightWidthChannel, 256, 0.5, tranforms)
for window in windows:
	transformed = window.apply(data)
	# ...

# Alternatively, if we want to modify each window
windows = sw.generate(data, sw.DimOrder.HeightWidthChannel, 256, 0.5)
for window in windows:
	rect = window.getRect()
	transformed = sw.padRectEqually(rect, 100, data.shape)
	window.setRect(transformed)
	# ...

More Repositories

1

ue4-docker

Windows and Linux containers for Unreal Engine 4
Python
703
star
2

ue4cli

Command-line interface for Unreal Engine 4
Python
232
star
3

conan-ue4cli

Integrate third-party libraries into the Unreal Engine with Conan
Python
88
star
4

UE4Capture

In-Engine Audio and Video Capture Plugin for Unreal Engine 4
C++
76
star
5

ue4-grpc-demo

Dockerised Unreal Engine 4 microservice demo using gRPC
C++
65
star
6

ue4-example-dockerfiles

Example Dockerfiles for using Unreal Engine containers
C++
63
star
7

ue4-runtime

Container images for running packaged Unreal Engine projects via the NVIDIA Container Toolkit
Python
62
star
8

ue4-cloud-rendering-demo

Unreal Engine 4 cloud rendering demo for NVIDIA Docker containers
C++
54
star
9

websocket-server-demo

C++ WebSocket Server Demo
C++
53
star
10

ue4-opencv-demo

Demo for integrating OpenCV and UE4 using conan-ue4cli
Python
40
star
11

ue4-ci-helpers

Unreal Engine 4 Continuous Integration helper functionality
Python
31
star
12

dll-diagnostics

Tools for diagnosing DLL dependency loading issues
Python
29
star
13

ue4-conan-recipes

Conan recipes for UE4-compatible library packages
Python
28
star
14

pixel-streaming-linux

Issue tracker repository for Pixel Streaming for Linux
22
star
15

MediaIPC

IPC-based media transfer library
C++
18
star
16

unreal-cli

The successor to ue4cli, for both Unreal Engine 4 and 5 [COMING SOON]
Python
10
star
17

mergetiff

Library and command-line tool to merge GeoTiff files using GDAL (Python Version)
Python
6
star
18

docker-watchdog

Service to perform automatic shutdown of idle container hosts
Python
6
star
19

gdb-multiarch-windows

GDB multi-architecture build for Windows
Dockerfile
6
star
20

jekyll-theme-gitbook

GitBook-inspired documentation theme for Jekyll
HTML
6
star
21

ue4-utils

Miscellaneous utilities for working with Unreal Engine 4
Python
6
star
22

docker-script

Run script files inside Docker containers
C++
6
star
23

gen-invoice

Template-based invoice generator
Python
4
star
24

jekyll-theme-gitbook-demo

Demo site for the GitBook-inspired documentation theme for Jekyll
Ruby
3
star
25

language-toolbox

Multi-language source code processing and analysis engine
TypeScript
3
star
26

docker-shell

Docker Interactive Shell Runner
Python
3
star
27

assorted-utils

Assorted libraries and utilities
C++
3
star
28

VideoAnnotator

Metadata annotation tool for video files
TypeScript
3
star
29

charcoal-morphotypes

Fossil charcoal particle identification and classification by two convolutional neural networks
Python
3
star
30

application-images

Container images for graphical applications
Python
2
star
31

mergetiff-cxx

Library and command-line tool to merge GeoTiff files using GDAL (C++ Version)
C++
2
star
32

taxonomist

Manual image classification workflow tool
TypeScript
2
star
33

encrypted-file-container

Simple single-file encryption utilities
C++
2
star
34

jenkins-pipeline-utils

Helper code for use in Jenkins Declarative Pipelines
Groovy
2
star
35

llvm-select

LLVM/Clang Library Version Selector Tool
Python
2
star
36

jcu-timetable-tools

JCU Timetable Tools
Python
1
star
37

spirv-installer

SPIR-V Toolchain Installer
Python
1
star
38

Cluster1D

Efficient hierarchical clustering for single-dimensional data using CUDA
Cuda
1
star
39

developer-images

Container images for developer tools and environments
Dockerfile
1
star
40

ue4-sample-project

Sample Unreal Engine project for demonstration purposes
C++
1
star
41

qol-windows

Quality of Life (QoL) tools and tweaks for Windows
C++
1
star
42

userscripts

Assorted userscripts for augmenting web pages
JavaScript
1
star