šŸ™ƒThe world is full of pain, but we can fix it with love!

Posts

Nov 30, 2022

Use PaddleOCR

I guess OCR is not something new for us. While there are a lot of open source artificial intelligence engines to achieve this, I need a easy-to-use one.
Recently I got a task to convert images into text. The image number is fairly big. So itā€™s just impossible to OCR them one by one manually. So I wrote a python script to handle this tedious task.
Basic Processing The original images contain a identical useless frame around the part that I need. So a crop is required because it will improve the performance (of course, the image is smaller) and there are unrelated texts in the frame.
Cropping is a easy problem. Just install Pillow package with pip:
1 pip install Pillow Then use Pillow to do the cropping:

... Read more

Jan 24, 2022

Pattern in C++

The secret ingredient of secret ingredient soup is ā€¦ Nothing!
This is a script from Kung Fu Panda, which is one of my favorite film.
People have been struggling for days to find a pattern in which they can code better. Especially those who use Java. They even wrote a book called ā€œProgramming Patternā€ (or another name since I might forget the name) to show the common patterns.
I donā€™t mean patterns are bad. However there exists many people who strive to the patterns, stick to the patterns or even get stubborn to patterns. Maybe there exists a way to achieve their goals with some not that patterned code but they donā€™t want to use them at all just because the code is not patterned.
I love C++. And the pattern of C++ is exactly NO PATTERN. You write code in the way that they do the task most effectively and neatly. You donā€™t need to apply a pattern to achieve your goal. You just write your code naturally with the way you are most comfortable with.

... Read more