-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadRubric.py
More file actions
37 lines (26 loc) · 759 Bytes
/
Copy pathreadRubric.py
File metadata and controls
37 lines (26 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'''
from pdf2image import convert_from_path, convert_from_bytes
from pdf2image.exceptions import (
PDFInfoNotInstalledError,
PDFPageCountError,
PDFSyntaxError
)
from PIL import Image
import glob, os
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
def PIL2array(img):
return np.array(img.getdata(),
np.uint8).reshape(img.size[1], img.size[0], 3)
#convert the pdf into an image
pil_img = convert_from_path('testRubric.pdf',output_folder='/Users/titusjohn/Documents/GitHub/tmac',fmt='jpg')
'''
import glob, os
import numpy as np
import scipy
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img=mpimg.imread('testRubric.jpg')
imgplot = plt.imshow(img)
plt.show()