de52463f855369ad17148054fa5a0a634c6b99a1,calamari_ocr/ocr/dataset/datareader/pagexml/reader.py,PageXMLReader,cutout,#,200

Before Change


        rr, cc = polygon(coords[:, 0], coords[:, 1], pageimg.shape)
        offset = (min([x[0] for x in coords]), min([x[1] for x in coords]))
        box = np.ones(
            (max([x[0] for x in coords]) - offset[0],
             max([x[1] for x in coords]) - offset[1],
             ) + ((pageimg.shape[-1],) if len(pageimg.shape) == 3 else ()),
            dtype=pageimg.dtype) * 255

After Change


            return pageimg[min(c[0] for c in coords):max(c[0] for c in coords),
                   min(c[1] for c in coords):max(c[1] for c in coords)]
        rr, cc = polygon(coords[:, 0], coords[:, 1], pageimg.shape)
        coords = np.asarray([rr, cc])
        offset = np.min(coords, axis=1)
        size = np.max(coords, axis=1) - offset + 1
        box = np.ones(tuple(map(int, size)) + ((pageimg.shape[-1],) if len(pageimg.shape) == 3 else ()), dtype=pageimg.dtype) * 255
        box[rr - offset[0], cc - offset[1]] = pageimg[rr, cc]
        return box
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: Calamari-OCR/calamari
Commit Name: de52463f855369ad17148054fa5a0a634c6b99a1
Time: 2021-01-19
Author: christoph.wick@planet-ai.de
File Name: calamari_ocr/ocr/dataset/datareader/pagexml/reader.py
Class Name: PageXMLReader
Method Name: cutout


Project Name: explosion/thinc
Commit Name: 2eef369b7ac92e38f81819307a4af4238fd953ee
Time: 2020-01-19
Author: honnibal+gh@gmail.com
File Name: thinc/backends/jax_ops.py
Class Name: JaxOps
Method Name: pad


Project Name: geekcomputers/Python
Commit Name: e1c4e6a7c7db68e123d978bfc56feb057898935f
Time: 2019-10-24
Author: kostasdedesar@penguin
File Name: Counting-sort.py
Class Name:
Method Name: