Hi all. Non-programmer here. I've been using pythonista to process photos of student work, to remove the background and shadows etc. It is working fairly well, however, it is incredibly slow if I use full resolution photos. I thought I might be able to speed things up by using ObjC and CoreImage Filters, however, I have no idea how to get started using ObjC within Pythonista, other than what is shown in the sample script Camera Scanner.py, which is significantly past my understanding.
Can anyone give me an idea on how to get started? I'm happy to experiment with different filters, just not sure how to get a filter actually working and have an image file outputted.
My original Pythonista script is very simple - just a series of filters (I use the workflow app to get the photos into Pythonista, then the cleaned up photos are PDFed so I can open them in Notability to annotate, to send back to my students (highschool Chemistry)).
Any help would be much appreciated!
Original Script:
from PIL import Image, ImageOps, ImageFilter, ImageChops
import photos, clipboard, webbrowser
imo=clipboard.get_image(idx=0)
if not imo.mode == 'RGB':
img=imo.convert('RGB')
im1=img.filter(ImageFilter.MaxFilter(size=9))
im2=ImageChops.subtract(im1,img)
im3=ImageOps.invert(im2)
im4=im3.filter(ImageFilter.SHARPEN)
im5=ImageOps.autocontrast(im4,cutoff=1)
clipboard.set_image(im5,jpeg_quality=1.0)
webbrowser.open('workflow://')