Comments (6)
At the moment no, but I will try to implement it this weekend.
from textrecognitiondatagenerator.
what's more , could it generate bold or italic text like WPS do?
from textrecognitiondatagenerator.
Bold/italic/normal is managed as the font level so you'd want the italic/bold version of whichever font you are using.
Also, what is WPS?
from textrecognitiondatagenerator.
WPS is a chinese office software like MS word@Belval
from textrecognitiondatagenerator.
Thanks!
from textrecognitiondatagenerator.
italic can done by next step:
def italic_img(img, angle):
ih, iw = img.shape[:2]
dw = int(math.ceil(ih * math.tan(math.pi * angle / 360)))
if dw > 0:
img1 = cv2.copyMakeBorder(img, 0 , 0, dw, dw, cv2.BORDER_CONSTANT, value=[255, 255, 255])
_4points = 0, 0, iw+dw, 0, iw+2*dw, ih, dw,ih
img2 = crop_img_4points(img1,_4points)
return img2
return img
def crop_img_4points(image, _4points):
x1,y1,x2,y2,x3,y3,x4,y4 = _4points
pts1 = np.float32([[x1,y1], [x2,y2], [x3,y3], [x4, y4]])
width, height = calc_4points_shape(_4points)
pts2 = np.float32([[0, 0], [width, 0], [width, height], [0, height]])
M = cv2.getPerspectiveTransform(pts1, pts2)
cropped = cv2.warpPerspective(image, M, (int(width), int(height)))
return cropped
def calc_4points_shape(_4points):
x1,y1,x2,y2,x3,y3,x4,y4 = _4points
w1 = math.sqrt(math.pow(y2-y1, 2) + math.pow(x2-x1, 2))
h1 = math.sqrt(math.pow(y3-y2, 2) + math.pow(x3-x2, 2))
w2 = math.sqrt(math.pow(y4-y3, 2) + math.pow(x4-x3, 2))
h2 = math.sqrt(math.pow(y4-y1, 2) + math.pow(x4-x1, 2))
return (w1 + w2) / 2, (h1 + h2) / 2
from textrecognitiondatagenerator.
Related Issues (20)
- tibeten generating(ligature)issue HOT 1
- Different font for each character or each word?
- Good way to cover a wide range of different fonts
- TypeError: Image data of dtype object cannot be converted to float For Handwritten Generation
- Curve Text Generation: For Scene Text Images
- Pillow Version HOT 3
- Missing modules for handwritten text generation. HOT 1
- ModuleNotFoundError: Arabic Reshaper
- For the dictionary passed in by "--dict", I want the dictionary to produce only one image in order of each line
- Option for other image formats HOT 1
- Write the labels to separate files
- sentence length of generated image.
- Freely control the number of characters
- question about generate multiline text HOT 1
- Error Thai font not appear HOT 4
- absence of ground truth for the generated dataset
- fail installation of tensorflow in requirements-hw.txt
- spanish text image with acute accent getting wrong
- Pypi Version Not Up to Date
- Yanked arabic-reshaper 2.1.3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textrecognitiondatagenerator.