Skip to content

Commit 477d814

Browse files
committed
Update README.md
1 parent 5a5895d commit 477d814

File tree

1 file changed

+27
-31
lines changed

1 file changed

+27
-31
lines changed

README.md

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
1-
# Image Translator
2-
3-
This project utilizes optical character recognition (OCR) and translation to translate text within images from one language to another. It performs the following steps:
4-
5-
1. **OCR Processing:** The project extracts text and its bounding boxes from input images using the EasyOCR library.
6-
2. **Translation:** It translates the extracted text using the Google Translator API.
7-
3. **Text Replacement:** The translated text is then overlaid onto the image, replacing the original text while maintaining its position and style.
8-
4. **Output:** Finally, the modified image with translated text is saved to an output folder.
9-
10-
## Setup
11-
12-
### Installation
1+
## Usage
132

14-
1. Clone this repository to your local machine.
15-
2. Install the required Python dependencies using `pip install pipenv && pipenv install`.
3+
1. Place your input images in the `input` folder.
4+
2. Run the script `main.py`.
5+
3. Translated images will be saved in the `output` folder.
166

17-
or
7+
## New Features
188

19-
```
20-
py -3.10 -m venv venv
21-
venv\Scripts\activate
22-
pip install -r requirements.txt
23-
```
9+
### SyncVideoToAudio.py
10+
This script syncs audio to a video file using advanced checks and features. It performs the following steps:
11+
- **Duration Check:** Ensures that the video and audio durations are within a specified tolerance.
12+
- **Audio Extraction:** Extracts audio from the video if available, or generates silent audio if not.
13+
- **Audio Alignment:** Aligns the audio using cross-correlation to calculate the offset.
14+
- **Synchronization:** Syncs the audio to the video using FFmpeg and saves the output.
2415

25-
If you like to use torch with cuda:
16+
### MultipleImageProcessing.py
17+
This script processes multiple images by performing OCR to extract text, translating the text, and replacing the original text in the images with the translated text. It includes:
18+
- **Batch Processing:** Allows processing images one by one or multiple images simultaneously using multithreading.
19+
- **Error Handling:** Handles translation errors and missing translations gracefully.
20+
- **Customization:** Supports custom source and target languages for OCR and translation.
2621

27-
```
28-
pip uninstall torch torchvision
29-
pip install torch==2.5.1+cu118 torchaudio==2.5.1+cu118 torchvision==0.20.1+cu118 --index-url https://download.pytorch.org/whl/cu118
30-
```
22+
### videoToImage.py
23+
This script extracts frames from a video file and saves them as individual images. It features:
24+
- **Frame Extraction:** Reads and saves each frame of the video as a separate image.
25+
- **Output Management:** Ensures the output folder exists and manages the file naming for the frames.
3126

32-
## Usage
27+
### imageToVideo.py
28+
This script converts a series of images into a video file. It includes:
29+
- **Image-to-Video Conversion:** Reads images from a folder and combines them into a video file.
30+
- **Frame Rate Customization:** Allows setting the frame rate for the output video.
31+
- **Error Handling:** Uses a placeholder frame for any invalid or unreadable images.
3332

34-
1. Place your input images in the `input` folder.
35-
2. Run the script `main.py`.
36-
3. Translated images will be saved in the `output` folder.
33+
## The goal of this update is to be able to translate video to video with the combination of [OpenTranslator](https://github.com/overcrash66/OpenTranslator).
3734

3835
## Notes
3936

@@ -50,9 +47,8 @@ pip install torch==2.5.1+cu118 torchaudio==2.5.1+cu118 torchvision==0.20.1+cu118
5047
![image-1](https://github.com/boysugi20/python-image-translator/assets/53815726/cc2a52b3-2627-4f08-a428-c0dba4341bda)
5148
![image-1-translated](https://github.com/boysugi20/python-image-translator/assets/53815726/3ecafe2e-df19-4ca2-aeff-b05cc89394db)
5249

53-
5450
## Acknowledgments
5551

5652
- [EasyOCR](https://github.com/JaidedAI/EasyOCR) - For OCR processing.
5753
- [Google Translator](https://pypi.org/project/deep-translator/) - For text translation.
58-
- [Pillow (PIL Fork)](https://python-pillow.org/) - For image manipulation.
54+
- [Pillow (PIL Fork)](https://python-pillow.org/) - For image manipulation.

0 commit comments

Comments
 (0)