a simple version for blind text image super-resolution (current version is only for English and Chinese)
Project description
This is a simple text image super-resolution package.
More details can be found in our Project Page: https://github.com/csxmli2016/textbsr
It can post-process the text region with a simple commond, i.e.,
textbsr -i [LR_TEXT_PATH] -b [BACKGROUND_SR_PATH]
Quick Start
Dependencies and Installation
- numpy
- opencv-python
- 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 be a full image or a text region only |
-b, --bg_path | None | The background sr path from other methods. If None, we only super-resolve the text region. |
-o, --output_path | None | The save path for text sr result. If None, we save the results on the same path with [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 and restore the text region. |
-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 back to the LR input, with the background region unchanged.
Example for super-resolving 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 to cite 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}
}
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
textbsr-0.0.24.tar.gz
(10.0 kB
view details)
Built Distribution
textbsr-0.0.24-py3-none-any.whl
(25.7 kB
view details)
File details
Details for the file textbsr-0.0.24.tar.gz
.
File metadata
- Download URL: textbsr-0.0.24.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 947fd7ce289148909d62b04e39fcdac9ff4340a7dfc9b4d8ad72088ccc5208dd |
|
MD5 | 7d01724187403bd4dedb4247533d612d |
|
BLAKE2b-256 | a9b3d8c6cb575ecb33cec9fab6261733dc3d10ab550ea026d03a0d7bb676c0b9 |
File details
Details for the file textbsr-0.0.24-py3-none-any.whl
.
File metadata
- Download URL: textbsr-0.0.24-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba585f2e2d7b9da5ffd9369ecf829f43f7c35c0a1da5939750fc7012ce474763 |
|
MD5 | 516681423effaf2f5f42c82bc45ef100 |
|
BLAKE2b-256 | 4417091db836f35a580591e36452583d83a419ccdaa27081ec3e9f9db274d7da |