Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Aniket025
GitHub Repository: Aniket025/Medical-Prescription-OCR
Path: blob/master/Model-3/ocr/helpers.pyc
426 views
�
�>�Zc@sjdZddljZddlZddlZdZddd�Z	ee
d�Zed�Zd�Z
dS(	s"
Helper functions for ocr project
i����Ni tcCs.tj|d|�tj|�tj�dS(s Show image using plt tcmapN(tplttimshowttitletshow(timgtcmptt((s;/Users/Piyush_Jena/Documents/Opensoft/MASTER/ocr/helpers.pytimplts
cCsb|jd|ks|r^d||jd}tj|t||jd�|fdtj�S|S(s Resize image to given height ig�?it
interpolation(tshapetcv2tresizetinttINTER_CUBIC(Rtheighttallwaystrat((s;/Users/Piyush_Jena/Documents/Opensoft/MASTER/ocr/helpers.pyR
s0cCs|jd|S(s Getting scale ratio i(R(RR((s;/Users/Piyush_Jena/Documents/Opensoft/MASTER/ocr/helpers.pytratioscCsCtj|tj�}||d|jd�d|jd�f<|S(s� Extend 2D image (numpy array) in vertical and horizontal direction
    Shape of result image will match 'shape'
    Args:
        img: image to be extended
        shape: shape (touple) of result image
    Returns:
        Extended image
    Nii(tnptzerostuint8R(RRtx((s;/Users/Piyush_Jena/Documents/Opensoft/MASTER/ocr/helpers.pyt	extendImgs	*(t__doc__tmatplotlib.pyplottpyplotRtnumpyRRtSMALL_HEIGHTtNoneR	tFalseR
RR(((s;/Users/Piyush_Jena/Documents/Opensoft/MASTER/ocr/helpers.pyt<module>s