A package for template matching using Torch
Project description
hd-tmf
A high-dimensional template matching framework based on PyTorch.
Installation
pip install Hough-TMF
Usage
from hd_tmf import tmf
TMF Example
# generate a random template
tmp = np.random.rand(10, 20, 20)
# generate a random image
data = np.random.rand(1000, 1000)
# calculate the cross-correlation between the template and the image
corr = tmf(tmp, data, step=1, device='cpu', moves=[], batch_size=-1, save_memory=False, max_workers=4)
Parameters
tmp(numpy.ndarray or torch.Tensor): The template to be matched.data(numpy.ndarray or torch.Tensor): The image to search for the template.step(int, optional): The step size of the convolution. Defaults to 1.device(str, optional): The device to perform the computation on. Defaults to 'cpu'.moves(list, optional): A list of moves to apply to the template before matching. Defaults to [].batch_size(int, optional): The batch size to use for the computation. Defaults to -1.save_memory(bool, optional): Whether to use half-precision floating point numbers to save memory. Defaults to False.max_workers(int, optional): The maximum number of worker threads to use for the computation. Defaults to 4.
Returns
numpy.ndarray: The cross-correlation between the template and the image.
Hough Example
from hd_tmf import hough
data = np.random.randn(256, 256)
hough(data,freq=100,bandpass=[2,8],sl=[10,20],resample=1, sigma=1.3, low_threshold=3, high_threshold=6,theta=np.linspace(np.pi/2/90*10/100,np.pi/2/90*10,99), fil='bandpass', S_L=True,beta=0,kernel=(3,3))
Parameters
data(numpy.ndarray or torch.Tensor): The image to search for the template.freq(int, optional): The frequency of the template. Defaults to 100.bandpass(list, optional): The bandpass filter to apply to the image. Defaults to [2,8].sl(list, optional): The size of the template. Defaults to [10,20].resample(int, optional): The resample rate of the image. Defaults to 1.sigma(float, optional): The sigma of the Gaussian filter. Defaults to 1.3.low_threshold(float, optional): The low threshold of the Canny edge detector. Defaults to 3.high_threshold(float, optional): The high threshold of the Canny edge detector. Defaults to 6.theta(numpy.ndarray, optional): The theta of the Hough transform. Defaults to np.linspace(np.pi/2/9010/100,np.pi/2/9010,99).fil(str, optional): The filter to apply to the image. Defaults to 'bandpass'.S_L(bool, optional): Whether to apply the Laplacian filter to the image. Defaults to True.beta(float, optional): The beta of the Laplacian filter. Defaults to 0.kernel(tuple, optional): The kernel size of the Laplacian filter. Defaults to (3,3).
License
Reference
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hough-TMF-0.0.3.tar.gz
(6.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Hough-TMF-0.0.3.tar.gz.
File metadata
- Download URL: Hough-TMF-0.0.3.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a52ea2de21c77fc4f07b96e47b9b48e62168c01ab7886f4f9a1025925b8a6a6
|
|
| MD5 |
6de45b759edd32091ea992d79b485936
|
|
| BLAKE2b-256 |
f25c58cdff8a9821798693353f7cee3b1d1b094c4154e014663d5491884b23ce
|
File details
Details for the file Hough_TMF-0.0.3-py3-none-any.whl.
File metadata
- Download URL: Hough_TMF-0.0.3-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
054a5562d9279191512b2f47e31f31a4532cb137832352f247fe4d43bd4343cb
|
|
| MD5 |
1ed734061b9c9041d57a000eb1271047
|
|
| BLAKE2b-256 |
21416d7e3654860ca9f80582cdc13edfcb083fd5d4059aa5113912f1dca2f478
|