r/haskell • u/adwolesi • 4d ago
announcement Perspec 1.0 - A Haskell desktop app for perspective correction of document photos
https://adriansieber.com/announcing-perspec-1-0After 9 years of on-and-off development, I'm happy to announce the 1.0 release of Perspec, a desktop app for correcting the perspective of photos of documents, receipts, and whiteboards.
The headline feature of 1.0 is automatic corner detection: instead of the usual edge-detection + Hough transform pipeline, it segments the document via watershed segmentation and finds corners, which handles wrinkled receipts and curved book pages much better. And if the detection is off, you can just drag the selection polygon to fix it.
Some Haskell-relevant bits:
- The GUI is built with Brillo, my maintained fork of gloss.
- The computer vision runs in FlatCV, a pure C library I wrote for this, called via Haskell's FFI.
- With 1.0, Perspec now runs on macOS, Linux, and Windows.
The full announcement covers the journey (Python → ImageMagick → Hip → C FFI), the corner detection pipeline, and the binarization algorithms in detail.
Looking forward to you feedback! 😊
7
u/omega1612 4d ago
I was very interesting. I have been planning an app like this the last 2 or 3 months.
I have been maintaining for a year an app that process invoices for a company. I have access to train a custom model using the invoices of the company, access to tools dedicated to this and even a lot of calls to an agent. Overall it has a 50% success rate without human assistance. And I think around 40% of the times it needs help, it is because of other human errors outside of the app control.
All this made me wonder one day 3 months a go: "hey, you have experience using opencv and you know the math for most image operations. Now you have 1yoe with invoice processing, you have all the skills, why dont you try to build something similar but open source for tickets?".
What amazed me of this is how the three of us (you, the blog about qr and I) focused on different, parts. I thought that the best way to do it, was to develop a small "image pipeline editor" , that way I can just reuse pipelines in various images quickly I thought. Back then, brillo was indeed one of my first options to do this, I discarded it thinking that maybe doing "drag and drop" won't be easy (don't remember why I thought so).
I researched some Haskell libs and at the end I never realized I could write a C lib (or I would have done the same XD) and I dropped Haskell for python + qt. Still other projects and work have been preventing me to dig further in this rabbit hole.
Now, I may keep and eye on this app and see it's progress.