Coder Social home page Coder Social logo

Comments (6)

Belval avatar Belval commented on May 20, 2024

At the moment no, but I will try to implement it this weekend.

from textrecognitiondatagenerator.

aagainbeyond2 avatar aagainbeyond2 commented on May 20, 2024

what's more , could it generate bold or italic text like WPS do?
image

from textrecognitiondatagenerator.

Belval avatar Belval commented on May 20, 2024

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.

hqzz avatar hqzz commented on May 20, 2024

WPS is a chinese office software like MS word@Belval

from textrecognitiondatagenerator.

Belval avatar Belval commented on May 20, 2024

Thanks!

from textrecognitiondatagenerator.

hongyinjie avatar hongyinjie commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.