Update v0.1.12
- Support text region with different angle.
- Higher resolution. min(height, width) of output is 256 (128 in v0.24.0)
See our project page for more details: https://github.com/csxmli2016/textbsr
This is a simple text image super-resolution package.
More details can be found in our Project Page: https://github.com/csxmli2016/textbsr
This package can post-process the text region with a simple command, i.e.,
textbsr -i [LR_TEXT_PATH] -b [BACKGROUND_SR_PATH]
- [LR_TEXT_PATH] is the LR image path.
- [BACKGROUND_SR_PATH] stores the results from any blind image super-resolution methods.
- If the text image is degraded severely, this method may still fail to obtain a plausible result.
Dependencies and Installation
- numpy
- cnstd
- torch>=1.8.1
- torchvision>=0.9
# Install with pip
pip install textbsr
Basic Usage
# On the terminal command
textbsr -i [LR_TEXT_PATH]
or
# On the python environment
from textbsr import textbsr
textbsr.bsr(input_path='./testsets/LQs')
Parameter details:
| parameter name | default | description |
|---|---|---|
| -i, --input_path | - | The lr text image path. It can store full images or text layouts only. |
| -b, --bg_path | None | The background sr path from other methods. If None, we only restore the text region detected by cnstd. |
| -o, --output_path | None | The save path for text sr result. If None, we save the results on the same path with the format of [input_path]_TIMESTAMP. |
| -a, --aligned | False | action='store_true'. If True, the input text image contains only text region. If False, we use CnSTD to detect text regions and then restore them. |
| -s, --save_text | False | action='store_true'. If True, save the LR and SR text layout. |
| -d, --device | None | Device, use 'gpu' or 'cpu'. If None, we use torch.cuda.is_available to select the device. |
Example for post-processing the text region
# On the terminal command
textbsr -i [LR_TEXT_PATH] -b [BACKGROUND_SR_PATH] -s
or
# On the python environment
from textbsr import textbsr
textbsr.bsr(input_path='./testsets/LQs', bg_path='./testsets/RealESRGANResults', save_text=True)
When [BACKGROUND_SR_PATH] is None, we only restore the text region and paste it back to the LR input, with the background region unchanged.
Example for restoring the aligned text region
# On the terminal command
textbsr -i [LR_TEXT_PATH] -a
or
# On the python environment
from textbsr import textbsr
textbsr.bsr(input_path='./testsets/LQs', aligned=True)
If you find this package helpful, please kindly consider citing our paper:
@InProceedings{li2023marconet,
author = {Li, Xiaoming and Zuo, Wangmeng and Loy, Chen Change},
title = {Learning Generative Structure Prior for Blind Text Image Super-resolution},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
year = {2023}
}
Metadata
Release files for textbsr 0.1.12
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 |
|---|---|---|---|---|
| textbsr-0.1.12.tar.gz | 10.3 kB | Without provenance | Details for textbsr-0.1.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| textbsr-0.1.12-py3-none-any.whl | Python 3 | none | any | Details for textbsr-0.1.12-py3-none-any.whl |
Total release size: 21.1 kB
Release files / textbsr-0.1.12.tar.gz
| Download URL | textbsr-0.1.12.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5dc71fec4119d5e6f656679f7adaf55b9d390ec8b4de508604461d3c050f92d8
|
|
BLAKE2b-256 checksum How to use checksums |
83c30810ba664432e956270810e935ed5bf7252c3a417bd333dbfbdac7eed3d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|
Release files / textbsr-0.1.12-py3-none-any.whl
| Download URL | textbsr-0.1.12-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
adaa1799259b5a18b84efaded1523188ddc763928003cb639507ef756d5c19dd
|
|
BLAKE2b-256 checksum How to use checksums |
da0b267d3298fe0f84cc7ecf24746678ba69622fca629d160765fb21389404e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|
Security for textbsr 0.1.12
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.