Spaces:
Sleeping
Sleeping
Update pixelconversion.py
Browse files- pixelconversion.py +2 -2
pixelconversion.py
CHANGED
|
@@ -73,7 +73,7 @@ def openDrawPDF(path):
|
|
| 73 |
text = """Scale Document"""
|
| 74 |
annot1=page.add_freetext_annot(rectText, text, fontsize=45, fontname='helv', border_color=(1,1,1), text_color=(1,1,1), rotate=rotate, align=1)
|
| 75 |
annot1.update()
|
| 76 |
-
|
| 77 |
return doc
|
| 78 |
"""### Extract color"""
|
| 79 |
|
|
@@ -119,7 +119,7 @@ def getAreaPerimeter(pdfpath, plan):
|
|
| 119 |
print(img.shape)
|
| 120 |
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
|
| 121 |
mask=DetectColor(img,color=(73,0,130)) #detect colored rect drawn on the pdf
|
| 122 |
-
|
| 123 |
contours, hierarchy = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 124 |
for contour in contours:
|
| 125 |
area = cv2.contourArea(contour)
|
|
|
|
| 73 |
text = """Scale Document"""
|
| 74 |
annot1=page.add_freetext_annot(rectText, text, fontsize=45, fontname='helv', border_color=(1,1,1), text_color=(1,1,1), rotate=rotate, align=1)
|
| 75 |
annot1.update()
|
| 76 |
+
doc.save('k.pdf')
|
| 77 |
return doc
|
| 78 |
"""### Extract color"""
|
| 79 |
|
|
|
|
| 119 |
print(img.shape)
|
| 120 |
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
|
| 121 |
mask=DetectColor(img,color=(73,0,130)) #detect colored rect drawn on the pdf
|
| 122 |
+
cv2.imwrite('maskk.png',mask)
|
| 123 |
contours, hierarchy = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 124 |
for contour in contours:
|
| 125 |
area = cv2.contourArea(contour)
|