Commit 4894ffea authored by André Melo's avatar André Melo
Browse files

Resize images in paper_images. Ensure no aliasing happens due to jpg conversion

parent fcbf5e8e
Pipeline #31704 failed with stage
in 1 minute and 6 seconds
......@@ -121,7 +121,7 @@ def paper_images(paths):
continue
with PIL.Image.open(file) as image:
image = convert_to_rgb(image)
image = convert_to_rgb(image).thumbnail((400, 400), PIL.Image.NEAREST)
# Check if the image is just a background with a constant color.
if all(low == high for low, high in image.getextrema()):
......@@ -161,7 +161,7 @@ def extract_images_tar(tar):
yield convert_to_rgb(image)
elif suffix == "pdf":
image = pdf2image.convert_from_bytes(
tar.extractfile(member).read(), size=400, fmt="jpg"
tar.extractfile(member).read(), size=400, fmt="ppm"
)[0]
yield convert_to_rgb(image)
elif suffix in IGNORE_EXTS:
......@@ -250,8 +250,7 @@ def find_jet_papers(todays_ids):
found_jet = False
for img in extract_images(response(paper_id)):
with img:
resized_img = img.resize((200, 200))
candidates = points_near_jet(resized_img, 0.2)
candidates = points_near_jet(img, 0.2)
labeled_image = label_image(candidates, 200, 200)
contours, hierarchy = cv2.findContours(
labeled_image, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment