This release is a pre-release and may not be stable for production use.
hwc-bgrx-8888-ndarray-to-chw-rgb-0-1-tensor
Convert an HWC BGR 888 or BGRX 8888 NumPy ndarray to a CHW RGB PyTorch tensor, with pixel values normalized to [0, 1]
and the alpha/unused channel discarded.
This function helps bridge interoperability between Qt, OpenCV (which often use HWC BGRX 8888 images), and PyTorch (
which often uses CHW RGB tensors with pixel values normalized to [0, 1]).
Installation
pip install hwc-bgrx-8888-ndarray-to-chw-rgb-0-1-tensor
Usage
import numpy as np
from hwc_bgrx_8888_ndarray_to_chw_rgb_0_1_tensor import hwc_bgrx_8888_ndarray_to_chw_rgb_0_1_tensor
# Example: create a dummy BGRX image
hwc_bgrx = np.random.randint(0, 256, (224, 224, 4), dtype=np.uint8)
tensor = hwc_bgrx_8888_ndarray_to_chw_rgb_0_1_tensor(hwc_bgrx)
print(tensor.shape) # (3, 224, 224)
print(tensor.min(), tensor.max()) # [0.0, 1.0]
Notes
- This function makes the array contiguous for compatibility with PyTorch tensors.
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Metadata
Release files for hwc-bgrx-8888-ndarray-to-chw-rgb-0-1-tensor 0.1.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hwc_bgrx_8888_ndarray_to_chw_rgb_0_1_tensor-0.1.0a0.tar.gz | 3.0 kB | Without provenance | Details for hwc_bgrx_8888_ndarray_to_chw_rgb_0_1_tensor-0.1.0a0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hwc_bgrx_8888_ndarray_to_chw_rgb_0_1_tensor-0.1.0a0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for hwc_bgrx_8888_ndarray_to_chw_rgb_0_1_tensor-0.1.0a0-py2.py3-none-any.whl |
Total release size: 6.5 kB
Release files / hwc_bgrx_8888_ndarray_to_chw_rgb_0_1_tensor-0.1.0a0.tar.gz
| Download URL | hwc_bgrx_8888_ndarray_to_chw_rgb_0_1_tensor-0.1.0a0.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
852d1b73567ff7f7cc8fa34e265cbca4bb56027de81a0188938bb3aea97c82b2
|
|
BLAKE2b-256 checksum How to use checksums |
5e487978d67e7a22eb52fbde87c8d36c065f83d09213aeff461377f10166f926
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / hwc_bgrx_8888_ndarray_to_chw_rgb_0_1_tensor-0.1.0a0-py2.py3-none-any.whl
| Download URL | hwc_bgrx_8888_ndarray_to_chw_rgb_0_1_tensor-0.1.0a0-py2.py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
10315171bfcab0c0f5e720dabb472e34e7e43dcadeb562e76d6ce79f428df8c1
|
|
BLAKE2b-256 checksum How to use checksums |
7c5e7bcfc36c4fe285d3a56db2bbfaf93d1c559ef8b22e3f04874671a3bbca34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for hwc-bgrx-8888-ndarray-to-chw-rgb-0-1-tensor 0.1.0a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.