Skip to content

Instantly share code, notes, and snippets.

@Prasad9
Prasad9 / perspective_transform.py
Last active October 21, 2017 07:27
Perform the perspective transform on an image
def get_mask_coord(imshape):
vertices = np.array([[(0.09 * imshape[1], 0.99 * imshape[0]),
(0.43 * imshape[1], 0.32 * imshape[0]),
(0.56 * imshape[1], 0.32 * imshape[0]),
(0.85 * imshape[1], 0.99 * imshape[0])]], dtype = np.int32)
return vertices
def get_perspective_matrices(X_img):
offset = 15
img_size = (X_img.shape[1], X_img.shape[0])
@Prasad9
Prasad9 / annotation.xml
Created November 6, 2017 13:54
A sample XML annotation file based on Pascal VOC format.
<annotation>
<folder>GeneratedData_Train</folder>
<filename>000001.png</filename>
<path>/my/path/GeneratedData_Train/000001.png</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>224</width>
<height>224</height>