Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Aniket025
GitHub Repository: Aniket025/Medical-Prescription-OCR
Path: blob/master/Model-1/ocr/helpers.pyc
427 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((socr/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((socr/helpers.pyR
s0cCs|jd|S(s Getting scale ratio i(R(RR((socr/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((socr/helpers.pyt	extendImgs	*(t__doc__tmatplotlib.pyplottpyplotRtnumpyRRtSMALL_HEIGHTtNoneR	tFalseR
RR(((socr/helpers.pyt<module>s