iPhone app to make all photos text searchable (free/no-ads)

栏目: IT技术 · 发布时间: 5年前

内容简介:Screenshot Hero scans through your screenshots (and other saved photos) and makes then instantly searchable by text in them.

iPhone app to make all photos text searchable (free/no-ads)

Screenshot Hero

Screenshot Hero scans through your screenshots (and other saved photos) and makes then instantly searchable by text in them.

Highlights

  • Images are all processed on-device and nothing is sent to any server.
  • Tested to work with thousands of images .
  • Best and most performant OCR technology .

iPhone app to make all photos text searchable (free/no-ads)

Technical Details

I wanted to build a simple utility app that would run OCR through my photos (all 5000+ of them) and make them searchable. I had following constraints for it:

  • It has to be fast . The UI needs to be fluid even for thousands of images.
  • All processing should happen on-device , should not be uploading photos to a cloud service.
  • I need to make it quick (I only had a week allocated for this project).

I am primarily a web developer and am not a skilled mobile developer. So I attempted this project with three different frameworks and here are my notes:

SwiftUI

SwiftUI is appealing as it’s a React-like framework. I wanted to learn SwiftUI but I struggled with the documentation and even writing a simple grid of photos was challenging. The community is tiny so there aren’t that many samples online either. I really wanted to use this but it was taking a bit too much of my time. Sadly, I had to ditch SwiftUI.

Expo.io

Expo is a React Native framework which bypasses the whole Android SDK + XCode step of making the app. It’s very easy to get started and the dev experience is great. Having written a React Native app before, I really wanted this to work. The only problem occured when I wanted to write the OCR part: expo eject workflow is kinda broken. In my case, the CameraRoll API broke due to some unlinked native module when I tried to run it via XCode after ejecting the app. I spent a few hours fixing the native modules but that didn’t work.

Without ejecting, I could have gone with Tessaract.js but it’s not fast enough to process thousands of images quickly.

There also isn’t a way to do background processing with Expo. I feel expo is great for simple CRUD apps for now and will fail you if your app needs a custom functionality.

React Native

In the end, I had to fallback to what I already knew. I copied views which I had created earlier for expo.io into a new ReactNative project. I then created a custom Swift native module which had all my business logic:

  • Methods to fetch all photos and process newer ones.
  • Queue to process only N photos concurrently.
  • Storage Model, went with MKKV as it was quick to set up.
  • OCR, used Apple’s Vision API which is surprisingly accurate and fastest on-device.
  • Set up BackgroundTasks to schedule photo processing for later, when the app is sent to background mid-processing (remember we may have 10,000+ photos in our queue, each photo takes ~1s to process).

Conclusion

I learned that React Native is fast enough if used only for views (and maybe lightweight logic) only. I used FlatList for the grid photo view (with some optimizations to lazy load photos) and it is very smooth even for thousands of photos. Real-time searching/filtering is also really smooth. React Native also has great community support.

This means writing more backend code per platform, which sucks but is straight-forward. It’s still better than writing front-end for each platform and dealing with all the quirks of each of them.

Try Screenshot Hero here .


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

算法设计与应用

算法设计与应用

迈克尔 T. 古德里奇(Michael T. Goodrich)、罗伯特·塔马契亚(Roberto Tamas / 乔海燕、李悫炜、王烁程 / 机械工业出版社 / 2017-11-20 / CNY 139.00

本书全面系统地介绍算法设计和算法应用的各个领域,内容涵盖经典数据结构、经典算法、算法分析方法、算法设计方法以及算法在各个领域的应用,还包含一些高级主题。本书采用应用驱动的方法引入各章内容,内容编排清晰合理,讲解由浅入深。此外,各章都附有巩固练习、创新练习和应用练习三种类型的题目,为读者理解和掌握算法设计和应用提供了很好的素材。 本书可作为高等院校计算机及相关专业“数据结构和算法”课程的本科生......一起来看看 《算法设计与应用》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

MD5 加密
MD5 加密

MD5 加密工具