Home
Black Book - Too Lazy To Type
Contents
1. Select image NOT BAD MeenakshiOCR Approved publication Select image Approved publication Results Image processing is too slow Accuracy is too low Ul needs improvements Asynclask works beautifully All other improvements work correctly Ceiling Analysis Summary Component Accuracy Overall System 34 6 15 Pre processing 76 47 OCR engine 100 47 TOO LAZY TO TYPE Pre processing and Training OCR for better accuracy Iteration 2 Objectives Use Leptonicas built in image processing functions to improve accuracy Use image processing techniques such as thresholding etc Train the Tesseract engine to improve accuracy Design a better Ul Add functionality to use the text such as copy to clipboard save as text file and googling it Codin Chang s since last increment v Trained Tesseract engine with 30 fonts v Added new image processing filters v Created a separate OCR screen Y Customized Ul vl 48 TOO LAZY TO TYPE v Added several new utility classes Y ncorporated copy save and Google text feature This class handles the OCR processing and unsharp masking for processing the image author Meenakshi Madan af import java io File import com googlecod import com goog ecod import com goog import com googlecod import com goog import com goog import com go
2. This book contains the details and inner workings of my final year project which consists of an Android OCR app and a dedicated website for the app Black Book Tuo Project Documentation Meenakshi Madan gt gt Ml TOO LAZY TO TYPE Android OCR app Acknowledgements First and foremost offer my sincerest gratitude to the principal and professors of my college who have supported me throughout my time here given me valuable knowledge molded and shaped me into the person am today like to thank our coordinator Prof Smruti Nanavaty for her patience and for sharing her expertise whilst giving me the space to work in my own way cannot thank my family enough for bringing me up the way they did The source behind my excellence is you like to thank Ayush Samantroy for lending me his Android tablet This has helped me immensely in developing and testing my app This list would be incomplete without mentioning all of the developers and education institutes around the world that share their knowledge work and wisdom over the Internet Preface It gives me immense pleasure in presenting this book the Android application and the website developed as my final year project The idea came to me first while was pursuing an online course on Machine Learning but at the time didn t seem to think much of it Text recognition seemed too ordinary and couldn t think of any reason
3. Number of times ocr has been performed in this transaction int tessRepeatCount 0 Maximum number of times that OCR can be performed on the image in this transaction int tessRepeatMAXCOUNT 5 Mean confidence as returned by tesseract on the recognized text int meanConfidence original meanConfidence_processed 0 String text original text_processed static int LEVEL ORIGINAL 0 LEVEL PROCESSED 1 private SharedPreferences ocrPref private SharedPreferences mPreferences 102 TOO LAZY TO TYPE private String BLACK LIST AUTOMATIC amp M NN V 0 private String WHITE LIST AUTOMATIC 1234567890ABCDEFGHJKLMNPRSTVWXYZabcdefghijklmnopqrstuvwxyz Object of OCRActivity to access variables such as DATA PATH and view elements private OCRActivity act public UnsharpMask OCRActivity act Log v TAG Begin constructor this act act octPref act getSharedPreferences MainActivity PREFS NAME Context MODE PRIVATE Override protected void onPreExecute Log v CopData AsyncTask Mein Entered onPreExecute pg ProgressDialog show act Processing true Displays text to the user hides progress bar Override protected void onPostExecute Void result Log v AsyncTask Mein Entered onPostExecute if meanConfidence_original gt meanConfidence_processed act recognizedText text origina
4. AlertDialog Builder imageDialog new AlertDialog Builder this LayoutInflater inflater Layoutlnflater getSystemService LAYOUT_INFLATER_SERVICE View layout inflater inflate R layout about_layout ViewGroup findViewByld R id layout_toot WebView webView WebView layout findViewByld R id wvabout if webView null t Log v help webview is null o_o j webView loadUtl file android_asset U1 about html imageDialog setView layout imageDialog cteate imageDialog show public void tips View v AlertDialog Builder imageDialog new AlertDialog Builder this LayoutInflater inflater LayoutInflater getSystemService LAYOUT INFLATER SERVICE View layout inflater inflate R layout about layout ViewGroup find ViewBylId R id layout root WebView webView WebView layout findViewByld R id wvabout if webView null Log v help webview is null o_o j webView loadUtl file andtoid asset UI tips html imageDialog set View layout 107 TOO LAZY TO TYPE imageDialog cteate imageDialog show public void buttons View v AlertDialog Builder imageDialog new AlertDialog Builder this LayoutInflater inflater LayoutInflater getSystemService LAYOUT_INFLATER_SERVICE View layout inflater inflate R layout about layout ViewGroup findViewByld R id layout_toot WebView webView WebView layout findViewByld R id wvabout if webView nul
5. OBAN WIGAN KADY aia GG display chooser select application sendText and open appli delete message 4 __ display updated history User HistoryActiVvi ClipboardMane WebBrows SmsManag ExternalApplical 30 TOO LAZY TO TYPE Help Screen community WebBrowser community send URL and open browser display forum Help Screen website VVebBrowse User website send URL and open browser display website User HelpActivi VVebBrowsel 31 TOO LAZY TO TYPE Help Screen HelpActivits User submit a review if first time prompt for alias enter alias prompt for review enter review post review to website return response display success failure message User Submit review 32 TOO LAZY TO TYPE Use Case Diagrams Go to OCR screen Go to Settings screen Go to History screen User Go to Help screen Main Screen lt lt indude gt gt Select option User Settings Screen 33 Select value TOO LAZY TO TYPE Read tutorial Read button descriptions Read tips Read about Use Submit a review Browse offical website Browse forum Helo Screen 34 TOO LAZY TO TYPE OCR Screen Delete lt lt include gt gt P att ae at a lt lt include gt gt is af _ 26
6. if pix getWidth lt 300 pix getHeight lt 300 pix Scale scale pix 2 else if pix getWidth gt 1200 pix getHeight gt 1200 pix Scale scale pix 1 2 pix Convett convettIo8 pix pix Rotate rotate pix Skew findSkew pix pix Binarize otsuAdaptiveThreshold pix Log v TAG After scale and binarize pix Enhance unsharpMasking pix 3 0 7F gives OutOfMemoryError WriteFile writelmpliedFormat pix pic 100 true afterProcess WriteFile writeBitmap pix Log v TAG In runnable thread after processing publishProgress 8 publishProgress 10 Log v AsyncTask End of do In Background pix recycle Check if a given String contains any of the characters in the given array param str source string to check for characters param seatchChars sequence of characters to check for in source string return boolean value true if string contains any character false otherwise 4 public static boolean containsAny String str char searchChars 4 if str null str length 0 searchChars null searchChars length 0 return false for int i 0 i str length i chat ch str charAt i for int j 0 lt searchChars length j if searchChars j ch return true 51 TOO LAZY TO TYPE j j return false Computes whether the string contains any character from the given s
7. Override protected Void doInBackground Void params 44 TOO LAZY TO TYPE Log v TAG In runnable thread before processing int w bitmap Source getWidth h bitmap Source getHeight if w 300 amp amp h lt 300 afterProcess OCRImageProcessing increaseDPI bitmap_Source w h else if w gt 1000 h gt 1000 afterProcess OCRImageProcessing decreaseDPI bitmap_Source w h else afterProcess bitmap_Soutce afterProcess OCRImageProcessing makeGreyScale afterProcess afterProcess OCRImageProcessing applyGaussianBlur afterProcess afterProcess OCRImageProcessing applyGaussianBlur afterProcess afterProcess processingBitmap afterProcess kernal blur afterProcess processingBitmap afterProcess kernal blur afterProcess processingBitmap afterProcess kernal blur afterProcess OCRImageProcessing applyGaussianBlur afterProcess Log v TAG In runnable thread after processing try FileOutputStream out new FileOutputStream mainActivity path afterProcess compress Bitmap CompressFormat JPEG 100 out catch Exception e Log v TAG e toString j performOCR Log v AsyncTask End of do In Background return null 45 TOO LAZY TO TYPE Tests MeenakshiOCR Too Lazy To Type Select mage Select Image Take from camera Select from gallery Too Lazy To Type Select image NOT BAD 46 TOO LAZY TO TYPE MeenakshiOCR
8. ad ojoij ZWSWZ ZWSWZL EL uo EJoqE 3 peuuela panoidde sdo s ZWEWZL ZWOE LL 1 pauuejg uonda u casa panoidde 4 55 ZWSOZL ZWOS LL b jen uoqdazu 37 TOO LAZY TO TYPE 38 TOO LAZY TO TYPE Construction Tasks Coding and testing Experimentation and analysis Objectives Finish software development Deliverables Source code Product demonstration 39 TOO LAZY TO TYPE Iterations Spirals This part consists of the increments produced over the 4 iterations to develop the product 4 iterations were required as neu requirements and changes were required to be added and also because the product did not quite pass the exit criteria in the first 3 iterations In each iteration a set of objectives are stated which define WHAT is to be achieved in the iteration Following that code and incorporate the changes into the product Within each iteration several small increments commits were produced but will only show a code snippet of the final increment of each iteration in this book The code snippet contains disjointed statements separated by a horizontal separator specifically only those statements that have changed in the Pre processing and OCR module since the last iteration At each stage at least 3 types of tests were performed Unit tests of
9. gt J SettingsActivity java gt If UnsharpMask java b 28 gen Generated Java Files gt BA Android 2 3 3 gt BA Android Dependencies 4 assets gt Gy tessdata gt Gg UI gt amp bin gt diagrams gt By libs 4 Gy res gt gg drawable gt y drawable hdpi gt Gy drawable ldpi gt ley drawabie mdpi gt y drawable xhdpi gt zg layout b Gy menu gt values gt Gg xml cy AndroidManifest xml 4 launcher web png E proguard project txt EQ project properties sequence_OCRActivity googleRT png 96 TOO LAZY TO TYPE MainActivityjava package meenakshi project meenakshiocr import android app Activity import android app AlertDialog import android content Context import android content Intent import android content SharedPreferences import android os Bundle import android util Log import andtoid view Layoutlnflatet import android view View import android view ViewGroup import android webkit Web View public class MainActivity extends Activity public static String PREFS_NAME OCRSettings private SharedPreferences mPreferences private static final String TAG MainActivity java Override public void onCreate Bundle savedInstanceState super onCreate savedInstanceState setContentView R layout activity main mPreferences getSharedPreferences MeenakshiOCRSharedPreferences Context MODE PRIVATE boolean firstTime mPrefere
10. new Intent Intent ACTION VIEW uriUrl startActivity launchBrowser 109 TOO LAZY TO TYPE public void community View v 1 Uri uriUrl Uri parse http meenakshi ocr fofou appspot com Too Lazy To Type Intent launchBrowser new Intent Intent ACTION VIEW uriUrl startActivity launchBrowser HistoryActivityjava package meenakshi project meenakshioct import android app Activity import android app AlertDialog import android content Context import android content DialogInterface import android content SharedPreferences import android os Bundle import android view View import android widget ArrayAdapter import android widget TextView ublic class HistoryActivity extends Activity P ry y String recognized Text TextView tv int clicked 0 private String TAG HistoryActivity private SharedPreferences mPreferences Override protected void onCreate Bundle savedInstanceState super onCreate savedInstanceState setContentView R layout activity history tv 7 new TextView 5 0 TextView findViewById R id his0 1 TextView findViewByld R id his1 2 TextView findViewByld R id his2 3 TextView findViewById R id his3 4 TextView findViewByld R id his4 22333 Preferences getSharedPreferences MeenakshiOCRSharedPreferences Context MODE_PRIVATE 0 setText mPreferences getString his0 1 setText mPreferen
11. subSumB subSumB DIV_BY_9 int orgColor src getPixel i j int orgA Color alpha orgColor int orgR Color red orgColor int orgG Color green orgColor int orgB Color b subSumR orgR 4 subSumG orgG ue orgColor subSumA orgA orgA subSumA orgR subSumR otgG subSumG subSumB orgB orgB subSumB if subSumA lt 0 bSumA 0 if subSumA gt 255 bSumA 255 su else s if subSumR lt 0 bSumR 0 if subSumR gt 255 bSumR 255 u sul yelse s if subSumG lt 0 bSumG 0 if subSumG gt 255 bSumG 255 u sul else su if subSumB lt 0 subSumB 0 jelse if subSumB gt 255 subSumB 255 dest setPixel i Color argb int subSumA int subSumR int subSumG int subSumB return dest protected void performOCR BitmapFactory Options options new BitmapFactoty Options options inSampleSize 4 Bitmap bitmap BitmapFactory decodeFile mainActivity _path options Getting width amp height of the given image int w bitmap getWidth int h bitmap getHeight try ExifInterface exif new ExifInterface mainActivity path int exifOrientation exif getAttributeInt ExifInterface TAG ORIENTATION ExifInterface ORIENTATION NORMAL 43 TOO LAZY TO TYPE Log v TAG Orient exifOrientation g gt int rotate 0 switch e
12. 12 A EM ME 13 4 Initial Demonstration esee 14 EVM TIC BRE E TH 17 5 WBS and 1 18 Photo OCR Pipeline eere 18 Components and 4 20 TESLEYGLGIENCNE N kaka a AA 23 6 Visual MODEM 25 seguence Diagram 25 Case DiGi Gil oO AWA 33 Class Diagram RE 36 SG Gobi div ipd DEO GG GA GE 37 Production Phase Construction 22 444 39 Iterations Spirals and System Evolution 40 7 basic Skeleton of the 41 8 Pre processing and Training OCR 48 9 Advanced Image Processing and CUI 56 10 Final Touches and Wrap Up 62 11 Iteration i uie dT 66 12 The Website eerte 68 13 Graphical User Interface 72 4 APK Structure and Source Code 96 PINS El Ol 114 15 Deployment Pre requisites and Summary 1 15 16 Future Enhancements Releases 117 ser MONUGI aso OR OLGA 118 DIDlIOGTADNY AR 143 TOO LAZY TO TYPE Inception Tasks Research and analyse basic idea Set goals objectives Synthesize an initial demonstration Objecti
13. When taking new images users can use phones flash if applicable TOO LAZY TO TYPE Il Recognizes line breaks 12 Doesnt save any information on 3rd party systems so user s data is completely private 13 Users can submit a review of the app through the help screen 14 Direct link to the website and community from the app 15 Dedicated lightweight application without unnecessary extra features that use up resources 16 Supported by highest possible percentage of Android phones 17 Reasonably high 95 and consistent accuracy of OCR 18 Reasonably less a few seconds at most response time 19 Support for a reasonable variety of font types and sizes on images 20 Attractive but easy to use interface 2 Self contained application requiring no internet and data connection charges 22 Basic help sereen for detailed usage helo TOO LAZY TO TYPE What can click and what do the buttons do 1 Screen TOO LAZY TO TYPE Settings Tapping on screen where OCR The standard icon for OCR throughout the app A tap on this button will open up the OCR screen this opens up Settings and Preferences you can customize the app History Tapping on this button opens up Recent History screen where the 5 most recent text that you have OCRed are displayed Help Information A tap on this will open the Help Information screen where you can find out more about this app interact with other users o
14. 31 Fl Meenakshi 216 41 Removed allnon leptonica 9 Itasztienz FinalzFaaturaa czaahfix jy 1 moze 2012 12 30 MeenakshiMa saa721s Added buttons for googling saving to bo P pi mara 20121229 Meenakshi 1 2 4 Make over new buttons Ul design v1 p FinaizFeatures fy craahfix fy 1 more 2012 12 28 El Meenakshi Ma 2 1 re trained 30 fonts to add 7 p FinalzFaaturaa fy craahfix fy 1 mare 2012 12 27 Meenakshi Ma 7522022 trained 30 fonts p FinalzFaaturaa craahfix fy 1 mora 2012 12 26 Meenakshi Ma zaa76de added training for franklin gothic and gulim ch FinaizFaats aes fy c asnfix fy 1 2012 12 26 BA Meenakshi a0ce7a4 Added shared preferences to make sure files FinalzFeatures fy c ashfix fy 1 more 2012 12 26 66 TOO LAZY TO TYPE Author Commit Message Date BA Meenakshi M 385677 It s giving a stupid runtime exception but I m D FinalzFeatures fy crashfix 1 more 2012 12 26 A Meenakshi M 5726a30 All stable very good accuracy trained data fo fy FinalzFeatures fy crashfix 0 1 more 2012 12 25 Meenakshi M 32ae4c8 added new training data still not as accurate D Finsl2Features 0 crashfix 0 1 more 2012 12 25 BA Meenakshi M sse3857 crashfixv2 works okay accu zsezseioni Jy Fina12Features crashfix fy 1 more 2012 12 24 FJ Meenakshi M 8281852 1 dunno what this is but it s making me
15. 8 Tips for optimal USA S a GA GG GA 19 Getting NEJD asina oir W W i A W R GAIA 20 The website 22 120 TOO LAZY TO TYPE e Configuring your device to install 3 party apps This is required as you ll be downloading the app from my website and not Google Play As a safety precaution all Android devices come with the option to install non market apps disabled by default If you want to allow the installation of non market third party apps such as Too Lazy To Type on your smartohone then youll have to follow the steps below to get your settings configured properly Step Click the MENU button Step 2 Go to SETTINGS Step 3 Click on APPLICATIONS Step 4 Make sure that UNKNOWN SOURCES is checked Step 5 Read the warning message and acknowledge if you are OK to proceed with the changes TOO LAZY TO TYPE Applications Unknown sources Manage applications Running services Development Storage use Start automatically Notifications That s it TOO LAZY TO TYPE Downloading and installing the app Step Simply go to meenakshi ocr appspot com using a Web browser on your Android device and click on Download Make sure you read the application description so youll know whether the app is compatible with your Android device Step 2 Locate the APK Android Package file on your device and install it usually the default action when you tap on the APK in your file brows
16. Gallery start gallery app select image ae return selected image process image display text User 26 TOO LAZY TO TYPE OCR Screen Copy To Clipboard ClipboardManage User copy to clipboard setText display success message eer ClipboardManage OCR Screen Google OCRACTIVITY VWebBrowse send URL and open browser VWebBrowse 27 TOO LAZY TO TYPE OCR Screen Save TAWDE User save file to sdcard return success failure display success failure message User FileVVrite OCR Screen Share ExternalApplicatigi User display chooser select application sendText and open application User ExternalApplicatig 28 TOO LAZY TO TYPE Settings Screen SettingsActivit User select settings parameter if options display value options select value update parameter User Help Screen tutorial buttons about tips HelpActivib User select topic display topic help User 29 TOO LAZY TO TYPE History Screen History Activi ClipboardMane V 5 g User select entry display action chooser select action alt copy to clipboard copy to clipboard display success message goo google send URL and open browser EN echec Reed te LTE MESSIS send as SMS Lak Be Loa ae A enter phone number sendTextMessage Leah DILLO
17. a future update may feature games that require API level 15 or higher Development and testing will be done using an emulator device on a Windows machine using the Android SDK ADT Bundle and other libraries for efficient and accurate image processing The file i e the application itself will be publicly available for download The Android device will need at least one hardware camera and a camera app which is usually present by default IV FUTURE IMPROVEMENTS e Automatically adding tags to images for quicker searches e Recognizing hand written text e ext with messy backgrounds e Automatically recognizing and saving phone numbers to contacts e Automatic detection of text regions in scene images e Improved accuracy and efficiency V SUMMARY This app will serve as a simple but incredibly useful application that uses machine learning and image processing techniques to quickly convert images to text Table of Contents Acknowledgements Preface Synopsis Engineering Phase 2 Problem Definition 2 Exis tiM 3 Why e tpm Fett 4 2 he PIODSE citer 8 E 8 ObIeclve GF CNS 9 3 Feasibility Study sie bi RA EDD HAMM MU 11 Rn 11 ECONOM ICOl Een ned A I 12 Le see ee 12
18. image before OCR Takes longer better accuracy Segment Mode What kind of text do the images contain Characters What sets of characters do the images contain 84 TOO LAZY TO TYPE Touch for details 85 TOO LAZY TO TYPE TOO LAZY TO TYPE Saving screenshot Screenshot is being saved TOO LAZY TO TYPE TOO LAZY TO TYPE TOO LAZY TO TYPE The OCR button Click it The OCR TOO LAZY TO TYPE The OCR button again Click it Select either of these and then select or click your picture Take from camera Select from gallery TOO LAZY TO TYPE Move the edges around your target piece of text and then click CROP The app will process your image TOO LAZY TO TYPE The app will process your image Now touch any or all of these buttons to use your text TOO LAZY TO TYPE Product Review Please enter your review feedback Cancel TOO LAZY TO TYPE APK structure and source code 4 3 MeenakshiOCR meenakshiocr ty project 2 src gt 8 fakeawt gt fy magick gt fj magick util fj meenakshi project meenakshiocr gt J Constants java gt JJ CopyDataToSDAsync java gt CropOption java gt D CropOptionAdapter java gt Deskew java gt J HelpActivity java gt HistoryActivity java gt f MainActivity java gt J NetworkThread java gt A OCRActivity java gt in RecognizedTextUses java
19. me decide hou to break down my project into a sequence of different components and modules which is discussed next Photo OCR Pipeline 1 Text Detection First we go through the image and find the regions where there is text in an image For example here is a picture taken from my smart phones camera of a box of Bisleri water bottles The highlighted area shows some text that a Photo OCR system may find 18 TOO LAZY TO TYPE 2 Character Segmentation Second given the rectangle around the text region we can do character segmentation where we segment the rectangle out into the locations of the individual characters 3 Character Classification And finally having segmented it out into individual characters we can then run a classifier which looks at the images of the individual characters and tries to figure out the letters gt 8 gt 19 TOO LAZY TO TYPE And so on till you find out what all the characters are and what the entire text is A system like this is called a machine learning pipeline and in particular the photo OCR pipeline is depicted as follows Components and Modules As identified in the Inception Phase the natural break down of the system is input gt process gt Output Input The input will consist of two levels At the first level the user selects whether he wants to select an existing image from the gallery OR click a fresh image using the phone camera At the sec
20. processing library Y implemented complex techniques such as text dewarp v Created a Settings Activity for users preferences v Designed custom Ul v2 56 TOO LAZY TO TYPE Mean confidence as returned by tesseract on the recognized text int meanConfidence_original meanConfidence_processed 0 String text original text_processed static int LEVEL_ORIGINAL 0 LEVEL_PROCESSED 1 private SharedPreferences ocrPref private String BLACK LIST AUTOMATIC amp 3 7 V0 private String WHITE LIST AUTOMATIC 1234567890ABCDEFGHJKLMNPRSTVWXYZabcdefghijklmnopqrstuvwxyz if meanConfidence original gt meanConfidence processed j else j TableRow act find ViewByld R id tableRow3 setVisibility View VISIBLE TableRow act find ViewByld R id tableRow4 setVisibility View VISIBLE ImageView act find ViewByld R id dbrobotarms setImageResource R drawable ocrscreen1 4 act recognizedText text original act recognizedText text processed else Toast makeText act Oops no text found Toast LENGTH SHORT show protected void performOCR int level if ocrPref getString whitelist None equals None baseApi setVariable TessBaseAPLVAR CHAR BLACKLIST BLACK LIST AUTOMATIO baseApi setVariable TessBaseAPLVAR CHAR WHITELIST WHITE LIST AUTOMATIC Log v TAG whitelist preferences returned None else baseApi setVariable TessBaseAPI VAR_CHAR_WHITELIST ocrPr
21. response out write template render params def datetimeformat value format H M d m Y return value strftime format jinja_environment filters datetimeformat datetimeformat class Reviewss db Model user db StringProperty content db TextProperty requited True created db DateTimeProperty auto_now_add Ttue app webapp2 WSGIApplication MainHandler reviews ReviewsHandler dev DevHandler debug True 113 TOO LAZY TO TYPE Transition Tasks Final documentation Prepare for presentation Objectives Wrap up and present project Deliverables Black book Final product 114 TOO LAZY TO TYPE Deployment Pre requisites and Summary Pre requisites Minimum Android version required 2 2 Froyo Camera app if you dont have this you can always use pictures from gallery Gallery app if you dont have this you can always click new pictures using the built in camera Permissions required o Write on SDCard o Send data to other apps o Send SMS directly Internet connection ONLY IF you want to use some of the optional features Not required otherwise Summary v Java was the primary coding language v Some parts of the code were implemented in native C Doing this improved the performance of the app 115 TOO LAZY TO TYPE v The help screen is static for the most part and thus created and formatted individual helo topics as local htm
22. the app all reviews submitted by people using this app developer tools for fellow developers or students looking to play around with the code the forum latest updates the user manual the facebook page etc You can also Like us on facebook 22 TOO LAZY TO TYPE Bibliography www coursera org www udacity com developer android com stackoverflow com code google com p tesseract ocr github com puelocesar android lib magick http kurup87 blogspot in 20 2 03 android ocr tutorial image to text html vietocr sourceforge net training html developers google com appengine blog kowalczyk info software fofou fancyapps com fancybox www objectaid com marketplace eclipse org content modelgoon umli4java UTMqJjBDS W plantuml sourceforge net mobiforge com developing story sms messaging android x yuml me 143
23. the website so submission will require an Internet connection o You can view your and other peoples reviews on the website gt Visit the official website Opens up the website meenakshi ocr appspot com in your default web browser Be a part of the community TOO LAZY TO TYPE Opens up the community forum in your default web browser Here you can interact with other people using this app post questions ask for helo share your experience chit chat etc TOO LAZY TO TYPE 5 Preferences Settings screen Image Cleanup v e I wv Filter image before OCR Takes longer better accuracy Segment Mode What kind of text do the images contain Characters What sets of characters do the images contain 17 TOO LAZY TO TYPE Image clean up o If checked ticked the app will perform pre processing on your image to remove noise clean up the background etc to help you get better results and accuracy o his may mean that the app takes slightly longer to process and display the text but the accuracy will be better e Unless your images are simple images with a white background and clear black text or you want your text faster you should check this option Segment Mode o You can leave this as automatic or you can specify exactly what kind of images you intend to feed the app For example if you usually only select a single word for OCR you can select the Single option from the menu t
24. Log v TAG negate conversion successful else Log v TAG negate conversion unsuccessful PixelPacket pp m getBackgroundColor int bg pp getBlue thresh Log v TAG BG color return by getBackgroundColor is bg if bg lt 32757 thresh 60000 else thresh 10000 if m thresholdImage 32757 Log v TAG thresh conversion successful 15000 else Log v TAG thresh conversion unsuccessful if m negatelmage 0 Log v TAG negate conversion successful else Log v TAG negate conversion unsuccessful m m scalelmage m getWidth 100 m getHeight 100 mi setDensity 300 m setCompression CompressionType NoCompression 105 TOO LAZY TO TYPE m setFileName Constants CURRENT IMAGE PATH give new location if m wtiteImage mi Log v TAG Successfully wrote image to path save else Log v TAG Image save unsuccessful catch Exception e Log v TAG exception occured performing magick functions e toString Log v TAG In runnable thread after processing Calls functions to perform requited preprocessing and OCR B Override protected Void doInBackground Void params TODO Auto generated method stub afterProcess bitmap Source Log v TAG In runnable thread before processing performOCR UnsharpMask LEVEL ORIGINAL if ocrPref getBoolean processimage true performProcessing performOCR UnsharpMask LEVEL PROCESSED L
25. Text getApplicationContext That does not look like a namel 108 TOO LAZY TO TYPE Toast LENGTH_SHORT show0 else else 1 SharedPreferences Editor editor mPreferences edit editor putString userName1 value editor commit content value D alert setNegativeButton Cancel new DialogInterface OnClickListener public void onClick DialogInterface dialog int whichButton Canceled j D alert show content userName public void content final String user 1 AlertDialog Builder alert new AlertDialog Builder this alert setTitle Product Review alert setMessage Please enter your review feedback Set an EditText view to get user input final EditText input new EditText this alert setView input alert setPositiveButton Ok new Dialoglnterface OnClickListenet public void onClick DialogInterface dialog int whichButton String value input getText toString if value length gt 0 Log v TAG In value length gt 0 submit user value alert setNegativeButton Cancel new DialogInterface OnClickListenet 4 public void onClick DialogInterface dialog int whichButton 4 Canceled j alert show public void submit String user String msg new NetworkThread this user msg execute public void website View v t Uri uriUrl Uri parse http meenakshi ocr appspot com Intent launchBrowser
26. ageCaptureUri Uri fromFile file intent putExtra andtoid provider MediaStote EXTRA_OUTPUT mImageCaptureUni try intent putExtra return data true startActivityForResult intent PICK_FROM_CAMERA catch ActivityNotFoundException e e printStackTrace else 1 pick from file Intent intent new Intent intent setType image intent setAction Intent ACTION GET CONTENT startActivityForResult Intent createChooser intent Complete action using PICK FROM FILE gt final AlertDialog dialog builder create dialog setCanceledOnTouchOutside true button setOnClickListener new View OnClickListener Override public void onClick View v dialog show j D public void copyRTToClipBoard View v Recognized TextUses copyR T ToClipBoard recognized Text this 99 TOO LAZY TO TYPE public void googleRT View v RecognizedTextUses googleRT recognizedText this j public void share View v public void saveRTToFile View v t RecognizedTextUses share recognizedText this Log v TAG In save to file button call mPreferences getSharedPreferences MeenakshiOCRSharedPreferences Context MODE_PRIVATE try File root new File Environment getExternalStorageDirectory OCRNotes if Iroot exists root mkdirs int count mPreferences getInt textFileCounter 1 File gpxfile new File root count txt Fi
27. alse pg show Override protected void onProgressUpdate Integer progress 4 pg setProgress progtess 0 49 TOO LAZY TO TYPE Displays text to the user hides progress bar 7 Override protected void onPostExecute Void result Log v AsyncTask Entered onPostExecute act mImageView setImageBitmap afterProcess if act recognizedText length 0 1 act field setText act recognizedText act field setVisibility View VISIBLE pg setMessage Done pg dismiss Button act findViewByld R id btn_copyToClipBoatd setVisibility View VISIBLE Button act findViewByld R id btn_googlelt setVisibility View VISIBLE Button act findViewByld R id btn_saveToFile setVisibility View VISIBLE else pg setMessage Oops no text found pg setCanceledOnTouchOutside true Function that performs unsharp masking on the Bitmap object param src Bitmap object the bitmap image to perform the unsharp maskin on param knl kernal 2D array return processed Bitmap Performs OCR on the bitmap at path on SDCARD Also performs any orientation required z protected void performOCR 1 BitmapFactory Options options new BitmapFactory Options options inSampleSize 1 Bitmap bitmap BitmapFactory decodeFile Constants CURRENT IMAGE PATH options ExifInterface exif new ExifInterface Constants CURRENT IMAGE PATH baseApi setVatiable Tes
28. an to develop dedicated OCR systems each for special types of images They combine various optimization methods related to the special image such as business rules standard expression glossary or dictionary and rich information contained in color images to improve the recognition accuracy Such strategy to customize OCR technology is called Application Oriented or Customized widely used in the fields of Business card OCR Invoice OCR Screenshot OCR ID card OCR Driver license OCR or Auto plant OCR and so on However what most people require is general purpose OCR software This means that the user is not restricted to a specific type of image but the application will recognize text from almost any type of image This is what my app gives you OCR is a delicacy on PCs the technology itself has advanced leaps and bounds but the price of this technology is still out of the reach of many The good quality OCR programs on Windows cost an arm and a leg while the cheap er OCR programs are not very accurate However as polarizing as OCR may be on Windows at least one has a choice of either shelling out lots TOO LAZY TO TYPE of to get a quality OCR program or not On Android unfortunately there isnt as much of a choice OCR apps have not yet penetrated the Android ecosystem as well as one may think There are only a handful of OCR apps out there and OCR on Android is non perfect and is still in its infancy One cannot ex
29. ces getString his1 2 setText mPreferences getString his2 3 setText mPreferences getString his3 4 setText mPreferences getString his4 223222 8 final String items new String Copy to clipboard Google it Directly send SMS Share Delete ArtayAdapter lt String gt adapter new ArrayAdapter lt String gt this android R layout select_dialog_item items AlertDialog Builder builder new AlertDialog Builder this builder setTitle Select Action builder setAdapter adapter new DialogInterface OnClickListener Override 110 TOO LAZY TO TYPE public void onClick DialogInterface dialog int item pick from camera if item 0 copyRTToClipBoatd else if item 1 googleRT else if item 2 sendSMS else if item 3 share else delete s final AlertDialog dialog builder create dialog setCanceledOnTouchOutside true tv 0 setOnClickListener new View OnClickListener 4 Override public void onClick View v clicked 0 recognized Text String tv 0 getText if recognizedText equals amp amp recognizedText equals dialog show j tv 1 setOnClickListener new View OnClickListener 4 Override public void onClick View v clicked 1 recognized Text String tv 1 getText if recognizedText equals amp amp IrecognizedText equals dialog show tv 2
30. comm Final2Features fy crashfix 0 1 more 2012 12 23 FA Meenakshi M 1ca387a works okay on some images crashes on some images crop intent doesnt 2012 12 23 FJ Meenakshi M ocaases Executing image processing and ocr in AsyncTask successfully 2012 12 23 Meenakshi M 4sesces working fine without extending thread runnable 2012 12 23 BA Meenakshi M s 04e78 preprocessing phase added gaussian blur and increased dpi 2012 12 23 FA Meenakshi M 21 gives very in accurate ocr but gives some text nonetheless 2012 12 23 FA Meenakshi M 530716 Created folders on sdcard successfully and final cropped pic is stored 2012 12 22 BA Meenakshi M 2so0ese Basic selection from gallery click from camera and crop Works nicely 2012 12 22 67 TOO LAZY TO TYPE The Website Objectives Create a dedicated website for the app Ensure easy download of the app Add brief descriptions and detailed user manuals for the convenience of users Add a forum for discussions on the app Add a way for users to review the app and for new users to see those reviews on the website Codin What has been coded v Main page which includes o Download link o Brief description o Slideshow of screenshots o News and updates o 3 reviews 68 TOO LAZY TO TYPE o Quick links such as download user manual FAQ community forum Facebook page etc A Facebook plugin so users can Like the app and recomme
31. curacy The accuracy with respect to this application is how correctly the application recognizes the text Most applications had poor to average accuracy Only 3 applications were found to have good to excellent accuracy with a hit or miss chance but with other limitations My app achieves 95 accuracy with most images The operational environment specifications were taken at the lowest level possible lowest API level of Android that would support all the basic features needed in the application Simply stated this means that the application will run on a lot of devices Choosing a higher API level would have meant a richer more efficient feature set but that would reduce the possible user base by 40 to 50 The Operating System Android itself is available free of charge The product is operationally feasible Schedule Feasibility have worked on similar projects before both in the field of Al as well as Android applications Android games to be specific Taking past experience as well as expert advice into consideration the effort and schedule break up showed that the project was likely to be delivered on time 13 TOO LAZY TO TYPE Initial Demonstration A throwaway prototype was developed to demonstrate that the critical UsC cases primary scenarios and requirements were satisfied This prototype also tested the performance response time capacity accuracy and range of the application The main concerns that wer
32. e ORIENTATION NORMAL Log v TAG Orient exifOrientation int rotate 0 switch exifOrientation case Exiflnterface ORIENTATION_ROTATE_90 rotate 90 break case Exiflnterface ORIENTATION_ROTATE_180 rotate 180 break case Exiflnterface ORIENTATION_ROTATE_270 rotate 270 break j Log v TAG Rotation rotate if rotate 0 Setting pre rotate Matrix mtx new Matrix mtx preRotate rotate Rotating Bitmap bitmap Bitmap createBitmap bitmap 0 0 w h mtx false Convert to ARGB_8888 required by tess bitmap bitmap copy Bitmap Config ARGB_8888 true catch IOException e Log e TAG Couldn t correct orientation e toString Log v TAG Before baseApi TessBaseAPI baseApi new TessBaseAPI if ocrPref getString whitelist None equals None else baseApi setVariable TessBaseAPI VAR_CHAR_BLACKLIST BLACK_LIST_AUTOMATIC baseApi setVariable TessBaseAPI VAR_CHAR_WHITELIST WHITE LIST AUTOMATIC Log v TAG whitelist preferences returned None baseApi setVariable TessBaseAPI VAR_CHAR_WHITELIST ocrPref getString whitelist None Log v TAG whitelist preferences returned ocrPref getString whitelist None if locrPref getString psm None equals None 104 TOO LAZY TO TYPE baseApi setPageSegMode Integer parseInt ocrPref getString psm None Log v TAG PSM preferences re
33. e addressed are as follows Does the application start successfully Do all the buttons work Does the application successfully initiate the camera app Does the camera application successfully click and save the picture at the desired location Does the OCR process initialize correctly Does the application display any text Hou accurate is the text Hou long did the processing take Does the application work on a variety of pictures Does the application crash at any point The results of this throwaway prototype are summarized in the following table The screenshots of the prototype are displayed next 14 TOO LAZY TO TYPE Ul elements All function correctly Camera app initialization DW Successful sl poss No 15 TOO LAZY TO TYPE L O mi a gt a t WD Elements 16 TOO LAZY TO TYPE Elaboration Tasks Thorough research of concepts and technologies Based on research develop system design Identify modules components Develop evaluation criteria exit criteria Objectives Detailed design based on solid research Deliverables UML Diagrams demonstrating system design 17 TOO LAZY TO TYPE WBS and Components To formulate a work breakdown structure and take make buy decisions of custom commercial and open source components we first need to examine the Photo OCR Pipeline This will helo
34. e the corresponding file on SDCard if you had saved it Directly send an SMS Prompts you for a phone number sends the SMS directly and reports the status as a pop up All of this without opening the message app If you want to select a number from your list of contacts click on share and choose your messaging app This will ooen up your default SMS manager TOO LAZY TO TYPE 4 Help Information Screen Touch for details 14 TOO LAZY TO TYPE gt Quick Tutorial Displays the 5 step tutorial to OCR same as in this book What the buttons do o Displays the buttons on the Main and OCR screens and gives a brief description of what each of them do lips for better accuracy o Lists a few tricks that will optimize usage of this app and give you better results gt About o Lists the version number the developer and general information about the app gt Submit a review o Once youve played around with the app you can submit a review to let other users know how you liked the app o If youre submitting a review for the first time it will prompt you to enter an alias This can be your name your favourite word or anything you like as long as it consists of alohabets only Subsequent submissions of reviews will not open this dialog The name you entered the first time will be used for every review you submit after that he app will prompt you to enter a review feedback o he reviews are submitted to
35. ef getString whitelist None Log v TAG whitelist preferences returned ocrPref getString whitelist None if ocrPref getString psm None equals None baseApi setPageSegMode Integer parseInt ocrPref getString psm None Log v TAG PSM preferences returned ocrPref getString psm None Log v TAG PSM preferences returned None if level UnsharpMask LEVEL ORIGINAL t text original baseApi getUTF8Text meanConfidence_original baseApi meanConfidence Log v TAG OCRED TEXT text_original Log v TAG Mean Confidence meanConfidence_original j else if level UnsharpMask LEVEL PROCESSED t text_processed baseApi getUTF8Text meanConfidence_ptocessed baseApi meanConfidence Log v TAG OCRED TEXT text_processed Log v TAG Mean Confidence meanConfidence_processed 57 TOO LAZY TO TYPE void performProcessing try ImageInfo mi new Imagelnfo Constants CURRENT_IMAGE_PATH MagickImage m new MagickImage mi if m normalizelmage Log v TAG notmalize convetsion successful else Log v TAG normalize conversion unsuccessful Deskew d new Deskew MagickBitmap ToBitmap m double skew d GetSkewAngle Log v TAG After Deskew skew skew m m rotatelmage skew 57 2957795130823208767981 54814105 m setDepth 8 m m sharpenImage 10 8 if m negatelmage 0 Log v TAG negate conversion s
36. ent setType image List lt Resolvelnfo gt list getPackageManager queryIntentActivities intent 0 int size list size if size 0 Toast makeText this Can not find image crop app Toast LENGTH_SHORT show return else intent setData mImageCaptureUni intent putExtra scale true intent putExtra return data true if size 1 Intent i new Intent intent Resolvelnfo res list get 0 isetComponent new ComponentName tes activityInfo packageName res activityInfo name startActivityForResult i CROP_FROM_CAMERA else for Resolvelnfo tes list final CropOption co new CropOption co title getPackageManager getApplicationLabel res activityInfo applicationInfo co icon getPackageManager getApplicationIcon res activityInfo applicationInfo co appIntent new Intent intent co appIntent setComponent new ComponentName tes activityInfo packageName res activityInfo name cropOptions add co CropOptionAdapter adapter new CropOptionAdapter getA pplicationContext cropOptions AlertDialog Builder builder new AlertDialog Builder this builder setTitle Choose Crop App builder setAdapter adapter new Dialoglnterface OnClickListenet 4 Override public void onClick DialogInterface dialog int item startActivityForResult cropOptions get item appIntent CROP_FROM_CAMERA j builder setOnCancelListener new DialogInterface OnCancelListe
37. equence of characters param str string to search param seatchChars sequence of characters to look for return boolean value true if string contains any chatacters from sequence false otherwise 7 public static boolean containsAny String str String searchChars if searchChars null return false return containsAny stt searchChars toCharArray Tests Downloading 52 TOO LAZY TO TYPE Extract text 53 TOO LAZY TO TYPE 54 TOO LAZY TO TYPE Results Processing speed has improved drastically Leptonica s built in functions reduce the image quality drastically and hence cannot be used Another image library should be used instead Training Tesseract improved the accuracy quite drastically Ul seems very disconnected Accuracy is quite satisfactory All other improvements work correctly Application crashes with a lot of images Ceiling Analysis Summary Component Accuracy Overall System 97 0588 Pre processing 9 0588 OCR engine 100 55 TOO LAZY TO TYPE Advanced image processing and GUI Iteration 3 Objectives Use Image Magick for pre processing Use advanced processing techniques such as text dewarpo Add Settings and Preferences activity Design an attractive GUI Codin Chang s since last iteration Y Trained Tesseract just a bit more v Added image magick image
38. er TOO LAZY TO TYPE 9 steps to OCR Step Start the app Step 2 The OCR button Click it The OCR button again Click it TOO LAZY TO TYPE Step 4 Step 5 Select either of these and then select or click your picture The app will process your image Take from camera Select from gallery Processing Done Now touch any or all of these buttons to use your text The app will process your image TOO LAZY TO TYPE What can the app do The current version v1 0 of the app supports the following features Quick and easy image to text on the go 2 Allows users to perform OCR on new images taken using camera or images already saved on phone 3 When taking new images users can define a specific rectangular area to analyse 4 OCRed text can be copied to Android clipboard from where users can paste it in whichever app they want SMS text e mail document editor etc 5 OCRed text can be saved as atext file 6 OCRed text can be quickly Googled only feature that understandably requires an Internet connection OCRed text can be directly sent as SMS without having to open the Messaging app only available on recent history screen 8 OCRed text can be shared with any other app installed on your phone that accepts text like Facebook SMS Bluetooth Gmail Twitter Whatsapp Dropbox Google talk etc User can view OCRed text history 5 most recent IO
39. f this app submit a review etc TOO LAZY TO TYPE 2 OCR Screen Clipboard Search TOO LAZY TO TYPE OCR A tap opens a dialog where you choose whether you want to select an image from gallery or use the camera to click a new picture Once you ve selected your image you can then select and crop the piece of text youre interested in A tap on this icon will copy the OCRed text to your devices clipboard Google the text Copy To Clipboard Tapping this will open up your default web browser and Go google search the OCRed text for you 4 Save to SDCard Tapping on this will save the OCRed text to your sdcard in the folder OCRNotes The filename will be displayed as a pop up message and changes every time you click it lt number gt txt where number is the integer that increments with every save Share A tap on this uill open up a dialog from uhich you can select an app installed on your device to share the text with For example Twitter Facebook Whatsapp Dropbox Google Bluetooth Gmail Messaging etc TOO LAZY TO TYPE 3 History Screen Tapping any entry will open up a dialog from which you can select an action to perform with the text such as Copy to clipboard Share Google it These do exactly the same actions as on the OCR screen Two additional actions available only on the history screen are TOO LAZY TO TYPE 5 Delete Deletes the entry from recent history It does not delet
40. g extra features and functionalities to make this a wholesome harmonious app made the graphics myself from scratch using actual 3D models This took quite long initially but it made adding changes much easier Plus because had actually hand modeled each of my Ul elements they looked more real and attractive built a dedicated website for this app to form a complete package authored my black book and here we are In conclusion like to mention that enjoyed every moment of coding even though wasn t particularly fond of the occasional bug and error message enjoyed making the graphics for the application and enjoyed writing this book hope you enjoy reading the book using the app and perhaps for some of you hope this helps you in your own projects Synopsis MEENAKSHI MADAN TX Doel 53003 10004 December 2 2012 PROJECT SYNOPSIS FOR AN ANDROID APPLICATION TOO LAZY TO TYPE Name will be finalized later ABSTRACT MOTIVATION In todays fast oaced world people like things in shortcut quickest fastest easiest least effort path paradigm and typing out text is no exception A trend can be observed majorly in college students of clicking pictures of whatever they want to look at again These include pictures of book covers phone numbers paragraphs from text books notice boards or even a random piece of text they found interesting on a poster in the mall 6 10 students would prefer clicki
41. get EditText port android widget ImageButton toid widget Text View toid widget Toast public class OCRActivity extends Activity private Uri mImageCaptureUti 98 TOO LAZY TO TYPE private static final int PICK_FROM_CAMERA 1 private static final int CROP_FROM_CAMERA 2 private static final int PICK_FROM_FILE 3 private static final int SEND_SMS 4 private static final String TAG OCRActivity java protected TextView _field public String recognized Text private SharedPreferences mPreferences Override protected void onCreate Bundle savedInstanceState super onCreate savedInstanceState setContentView R layout activity oct field TextView findViewBylId R id recog Text _field setMovementMethod new ScrollingMovementMethod ImageButton button ImageButton find ViewByld R id btn_startOCR final String items new String Take from camera Select from gallery ArtayAdapter lt String gt adapter new ArrayAdapter lt String gt this android R layout select_dialog_item items AlertDialog Builder builder new AlertDialog Builder this builder setTitle Select Image builder setAdapter adapter new DialogInterface OnClickListener Override public void onClick Dialoglnterface dialog int item pick from camera if item 0 Intent intent new Intent MediaStore ACTION_IMAGE_CAPTURE File file new File Constants CURRENT_IMAGE_PATH mIm
42. ground return null 58 59 TOO LAZY TO TYPE Select Image Take from camera Select from gallery Saving screenshot is being saved 60 TOO LAZY TO TYPE Results New image processing library works beautifully although slightly slower Ul and layouts work well Accuracy quite good All other improvements work correctly Application doesnt crash like it did in the previous increments Ceiling Analysis Summary Component Accuracy Overall System 96 Pre processing 9 0588 OCR engine 100 61 TOO LAZY TO TYPE Final touches and wrap up Iteration 4 Objectives Add Help Screen Add recent history feature Add SMS and share feature Optimize code Add welcome splash screen Optimize Ul Add an option for the user to submit a review to the website Link the website and forum from the app Final touches and winding up for transition to next phase and release 62 TOO LAZY TO TYPE Codin Chang s since last increment v Created Help screen and Help Ul using WebView and html v Designed a custom launcher icon set v Designed a complete Ul v2 set v Created a new History screen for 5 most recent OCR text v Optimized code v Added a new SMS feature v Added a new share feature v Added a new welcome splash screen for first time installation No code snippet is shown for this iteration a
43. hat is displayed for this option and remember to crop only the word youre interested in Characters o No big harm will be done if you leave this as automatic but you can specify if your images contain only numbers only alohabets ZIE TOO LAZY TO TYPE Tips for optimal usage These are just some simple tricks and tips that will get you better accuracy and quicker results Avoid blurry images Avoid tiny font Use better lighting Don t use images that are too big Avoid cluttered backgrounds Leave some empty space around the text while cropping This app is not meant to recognize hand written text and or very cursive text Unless your image is black white with no noise and or you are pressed for time check the Pre Processing option under Settings This will increase the accuracy Although the app deskeus the image for you if you selected pre processing in Settings try to align the image nicely The application learns as you feed it more and more images TOO LAZY TO TYPE Getting help If you ever find yourself stuck on a feature of the app or if the app has had some sort of failure crash error help is just a few clicks away Help with functioning of the app o The Help Info screen contains plenty of information to helo you with the Ul and functionality of this app o Additionally you can always go on to the forum Main Screen gt Help Info gt Be a part of
44. inalzFeatures 19 days ago Meenakshi lt biESe1 Add History feature p FinalzFazturaa 20 days ago a Meenakshi Ma 287 Add share feature p FinalzFeaturaa 20 days ago Meenakshi zcacei add sms feature p FinalzFezturaa 20 days ago El MeenakshiMa zeizer to add a feature to remove the text from the image Didnt work imageaazick 20daysago H Meenakshi Ma 7465255 Fix android magick library Unsatisfied Itaration3 fy FinalzFaaturaa fy imagemagick 2013 01 20 H Meenakshi Ma bcSete2 Fix progressdialog bug by removing it entirely p FinalzFeatures 0 imagemagick 2013 01 18 H Meenakshi Ma 2 Newest Ul Background with transparent buttons p FinalzFazturaa fy imagemagick 2013 01 17 H Meenakshi Ma 2626261 Brand new Ul Dashboard and OCR Screen complete p FinalzFaaturaa fy imagemagick 2013 01 15 Meenakshi Ma s1zece Add new UI design template p FinalzFazturaa fy imagemagick 2013 01 13 Meenakshi Ma Add preferences activity p FinalzFeaturaa fy imagemagick 2013 01 10 BA Meenakshi Pre process to sharp black white text Not perfect acc FinalzFaaturaa Jy imagemagick 2013 01 03 Meenakshi bzedrz7 Add diagrams and a few pre processing changes p FinalzFeaturaa fy imagemagick 2012 12 31 El Meenakshi osaz222 Add ImageMagick library for better pre processing P fiuaiireaturem P imzgamagick 2012 12
45. is that all the newest revolutionary technologies can be introduced to Android by the various developers uho work on it That s uhy for Android open source is one of the most important advantages More devices The Android Ecosystem More users Source htto7 hickallott com 70 29 More Innovative iOS powered devices are released usually once or twice a year as opposed to dozens of Android devices being released all over the world every year The result of this is neu technologies and features being available to the phone users more often and therefore future releases of my application with enhanced feature sets will be possible TOO LAZY TO TYPE One iPhone launch year may not be enough Major Android devices launched in 6 months in the US during 2012 Source Piper Jaffray OEM press releases The following pie chart and table is based on the number of Android devices that have accessed Google Play Data collected during a 14 day period ending on February 4 2013 Ice Cream Sandwich Honeycomb Jelly Bean Eclair amp older Froyo Gingerbread Donut 0 2 TOO LAZY TO TYPE 2 Eclair 7 22 2 2 Froyo 8 8 1 23 Gingerbread 9 0 2 02 235 2 IO 45 4 2t OAI Honeycomb 12 03 Oe NOZ 40 3 Cream 15 290 40 4 Sandwich 4l Jelly Bean le 122 AD 7 Source The above s
46. ivity class startActivity intent public void goToHelp View view 1 Intent intent new Intent this HelpActivity class startActivity intent OCRActivityjava package meenakshi project meenakshioct im im im im im im im im im im im im im im im im im im im im im im im im im im im im im im im im im im im port and port and port and port and port and port and port and port and port and port and port and port and port and port and port and port and port and port and port and port and port and port and port and port and port and port java io File port java io FileOutputStream port java io FileWriter port java io IOException port java util Array List port java util List roid app Activity roid app AlertDialog toid app Pendinglntent port android content ActivityNotFoundException roid content BroadcastReceiver roid content ComponentName roid content Context roid content DialogInterface roid content Intent roid content IntentFilter roid content SharedPreferences roid content pm ResolveInfo roid graphics Bitmap roid net Uri roid os Bundle roid os Environment roid provider MediaStore toid telephony SmsManaget roid text ClipboardManager roid text method ScrollingMovementMethod roid util Log roid view Menu port android view Menultem port android view View roid widget Array Adapter roid wid
47. l else act recognizedText text processed pg dismiss if act recognizedText length 0 1 act field setText act recognizedText TableRow act find ViewByld R id tableRow3 setVisibility View VISIBLE TableRow act find ViewByld R id tableRow4 setVisibility View VISIBLE ImageView act find ViewById R id dbrobotarms setImageResource R drawable ocrscreen20 mPreferences act getSharedPreferences MeenakshiOCRSharedPreferences Context PRIVATE SharedPreferences Editor editor mPreferences edit for int i74 i gt 1 i editor putString his0 act recognizedText editor commit editor putString his i mPreferences getString his 1 1 else Toast makeText act Oops no text found Toast LENGTH_SHORT show Performs OCR on the bitmap at path on SDCARD Also performs any orientation required W 103 TOO LAZY TO TYPE protected void performOCR int level BitmapFactory Options options new BitmapFactoty Options options inSampleSize 1 Bitmap bitmap BitmapFactory decodeFile Constants CURRENT IMAGE PATH options Getting width amp height of the given image int w bitmap getWidth int h bitmap getHeight try ExifInterface exif new ExifInterface Constants CURRENT IMAGE PATH int exifOrientation exif getAttributelnt ExifInterface TAG ORIENTATION ExifInterfac
48. l t Log v help webview is null o_o webView loadUtl file android_asset UI buttons html imageDialog set View layout imageDialog create imageDialog show public void tutorial View v AlertDialog Builder imageDialog new AlertDialog Builder this LayoutInflater inflater LayoutInflater getSystemService LAYOUT_INFLATER_SERVICE View layout inflater inflate R layout about_layout iewGtoup findViewByld R id layout_toot P y WebView webView WebView layout findViewByld R id wvabout if webView null t Log v help webview is null o_o webView loadUtl file andtoid asset UI tutorial html imageDialog setView layout imageDialog create imageDialog show public void review View v t final SharedPreferences mPreferences getSharedPreferences MeenakshiOCRSharedPreferences Context MODE PRIVATE final String userName mPreferences getString userName1 1 if userName equals 1 i AlertDialog Builder alert new AlertDialog Builder this alert setTitle New User alert setMessage Please enter an alias Set an EditText view to get user input final EditText input new EditText this alert setView input alert setPositiveButton OK new Dialoglnterface OnClickListenet public void onClick DialogInterface dialog int whichButton 4 String value input getText toString if lvalue matches a zA Z value equals Toast make
49. l files Y used the Eclipse IDE along with the ADT plugin v Git was used for distributed revision control Y trained and used the Tesseract engine for OCR v image magick was used for image processing A process of trial and error was required on my part to develop a working combination of filters v designed the Graphical User Interface for the app using Blender 3D modelling and Gimp v The website was developed using Python as the backend language Y he front end pages were developed using html css and jinja2 v made the website graphics in blender just as did for the app 116 TOO LAZY TO TYPE Future enhancements and releases There is aluays scope for improvement in accuracy and performance Batch processing of images for example processing a few pages of a book and saving the file with page breaks Handling of various file formats for saving the text such as PDFs and Documents But really most of what could be done to enhance the app while maintaining harmony and staying true to its basic purpose has been done 117 TOO LAZY TO TYPE Android OCR app User Manual TOO LAZY TYPE User Manual Author Meenakshi Madan 119 Table of Contents Configuring your device to install 3rd party apps Downloading and installing the app 3 5 steps to CC LL oem bua iab 4 What can the app dO aaa GOO OO virer 6 What can click and what do the buttons do
50. l of these factors were analysed and studied A highly brief summary of the report and results are given below Technical Feasibility To develop such an application the following technical skills and tools are required Artificial Intelligence and Machine Learning Photo OCR Java Programming Language Android Software Development Kit Eclipse IDE optional but recommended Android Emulator and or Android device have worked on softwares that use artificial intelligence and machine learning in Python and Octave before this project have also studied the Java Programming Language extensively Transition is expected to be smooth All of the above technical requirements are fulfilled The project is technically feasible 11 TOO LAZY TO TYPE Economic Feasibility Considering that this is an under grad project ROI and profit in terms of money is not expected However must and did take into consideration whether developing the product itself was within budget The cost of a suitable workstation libraries test device or emulator and other components was found to be within budget The project is indeed economically feasible Since am distributing the app free of charge and no Internet data charges are mandatory the product is economically feasible for the end user Legal Feasibility No data is saved by the application without the explicit intention of the user Therefore data privacy and othe
51. leWriter writer new FileWriter gpxfile writer append recognizedText writer flush writer close Toast makeText this Saved to OCRNotes count txt Toast LENGTH_SHORT show Log v TAG gpxfile getAbsolutePath SharedPreferences Editor editor mPreferences edit editor putInt textFileCounter count editor commit catch IOException e t e printStackTrace Log v TAG e toString Override protected void onActivityResult int requestCode int resultCode Intent data if resultCode RESULT OK return switch requestCode case PICK_FROM_CAMERA doCrop break case FROM FILE mImageCaptureUri data getData doCrop break case CROP FROM CAMERA Bundle extras data getExtras if extras null Bitmap photo extras getParcelable data try FileOutputStream out new FileOutputStream Constants CURRENT_IMAGE_PATH photo compress Bitmap CompressFormat JPEG 100 out 100 TOO LAZY TO TYPE File file new File Constants CURRENT IMAGE PATH mImageCaptureUri Uri fromFile file catch Exception e e printStack Trace Log v TAG Oh noes couldn t save cropped file to path e toString new UnsharpMask this execute break private void doCrop final ArrayList lt CropOption gt cropOptions new ArrayList lt CropOption gt Intent intent new Intent com android camera action CROP int
52. ly useful uhen the user is on the go and may not have time to manually type out a piece of text You can nou use the copy and paste tools as well instead of reuriting everything to correct it TOO LAZY TO TYPE Existing System The technology that will provide the required features is called Photo OCR This section describes what OCR is and the current state of OCR technology on mobile phones What s text recognition Part of Machine Learning optical character recognition OCR and can be really useful when you ve got a paper document you want in digital editable form You need a scanner to create an image of the document first but then once you have that image you can run it through an OCR application that will read each character and attempt to recreate the original document as text In most cases it will never be perfect but with a high quality scan you can come pretty close This is even possible on your phone which is what propose to develop Since OCR technology has been more and more widely applied to paper intensive industry it is facing more complex images environment in the real world For example complicated backgrounds degraded images heavy noise paper skew picture distortion low resolution disturbed by grid amp lines text image consisting of special fonts symbols glossary words and etc All the factors affect OCR products stability in recognition accuracy In recent years the major OCR technology providers beg
53. nces getBoolean welcome true if firstTime 1 Log v TAG In first time if block SharedPreferences Editor editor mPreferences edit ditor putBoolean welcome false ditor putString lang eng ditor putString OCRTextMode default ditor putString DATA PATH getExternalFilesDir null getAbsolutePath ditor putString CURRENT IMAGE PATH getExternalFilesDir null getAbsolutePath cutrentoct jpg editor commit Constants initializeConstants this new CopyDataToSDAsync this execute AlertDialog Builder imageDialog new AlertDialog Builder this LayoutInflater inflater LayoutInflater getSystemService LAYOUT_INFLATER_SERVICE View layout inflater inflate R layout about_layout ViewGroup find ViewByld R id layout_root WebView webView WebView layout find ViewByld R id wvabout if webView null Log v help webview is null o_o j webView loadUrl file android_asset UI welcome html imageDialog setView layout imageDialog cteate imageDialog show Constants initializeConstants this public void goToOCR View view 1 Intent intent new Intent this OCRActivity class startActivity intent 97 TOO LAZY TO TYPE public void goToSettings View view Intent intent new Intent this SettingsActivity class startActivity intent public void goToHistory View view Intent intent new Intent this HistoryAct
54. nd it to their friends Y Reviews page which shows ALL the user reviews for this app v Forum website for interaction among users discussions about the app questions and queries etc v FAQ post to answer the frequently asked questions v Facebook page which users can Like to keep tabs on whats going on with the app and updates v Developer lools for fellow developers or students looking to learn 69 TOO LAZY TO TYPE Screenshots Too Lary To Type Py Home 1 Download Download Instant text from images Share save copy sms search MeenokshiOCR 7 xf Attractive sci fi interface Simple light fast Save time do more 2 2 Froyo or higher FREE and open source High accuracy Android OCR app uith features such as save copy to clipboard share google sms recent history etc Found interesting text on a poster book notice board Don t want to type it hunt for a scanner This is the app you need Feed it an image get INSTANT TEXT Click download top left to get the app Visit the links below for more information Quick Links What s New Reviews Download apk New Facebook page is up You can Payal fantabulous app now officially like this app and keep d User Manual pdf tabs on updates smruti like it FAQ ty Forum is now online Participate and be a part of the community Payal love the ui Community See what other users have to say Review
55. ner 4 Override public void onCancel DialogInterface dialog if mImageCaptureUri null 4 getContentResolver delete mImageCaptureUni null null 101 TOO LAZY TO TYPE mlImageCaptureUti null gt AlertDialog alert builder cteate alert show UnsharpMaskjava package meenakshi project meenakshiocr This class hands the OCR processing and unsharp masking for processing the image author Meenakshi Madan import java io IOException import magick CompressionType import magick lmagelnfo import magick MagickImage import magick PixelPacket import magick util MagickBitmap import android app ProgressDialog import android content Context import android content SharedPreferences import android graphics Bitmap import android graphics BitmapFactory import android graphics Matrix import android media ExifInterface import android os AsyncTask import android util Log import android view View import android widget ImageView import android widget TableRow import android widget Toast import com googlecode tesseract android TessBaseAPI public class UnsharpMask extends AsyncTask Void Integer Void 1 ProgressDialog pg Tag for logging purposes String TAG UnsharpMask To check if OCR needs to be performed again on the same image if the confidence value is very low boolean checkOnceForFurtherProcessing true
56. ng pictures instead of typing things out which is great if you have lots of physical memory on your phone and dont mind searching through thousands of images to find the one picture youre looking for But what if there was an app on your phone that let you click a picture just as you normally would and instead of simply storing the image the app let you select a region of interest in the image and have it instantly converted to plain text As a college student who has been strictly following the click pictures of everything you want to save for later policy this app would be immensely helpful for me in addition to a lot of other people And that is my motivation for developing this app as my TY project SCOPE OF SERVICES To begin with the app will convert printed text on images to plain text that you can save to a file copy to clipboard etc The basic outline is as follows e Start the app e Click on the Take a photo button e his opens up the camera When satisfied with the positioning and focus zoom the user can click the picture or cancel e Once the picture is clicked it is disolayed to the user e he user can then select a region of interest say a paragraph on a page in the image and click OK The app then begins processing the image and outputs a string of text on to the screen gt PREMIER TECHNOLOGIES AND REQUIREMENTS The app will run on Android smartphones The minimum requirement is API 10 but
57. og v TAG Processimage preferences returned true Log v TAG Processimage preferences returned false Log v AsyncTask Mein End of do In Background return null SettingsActivityjava package meenakshi project meenakshiocr import android os Bundle import android preference PreferenceActivity public class SettingsActivity extends PreferenceActivity Override protected void onCreate Bundle savedInstanceState super onCreate savedInstanceStato getPreferenceManager setSharedPreferencesName MainActivity PREFS_NAME addPreferencesFromResource R xml prefs 106 TOO LAZY TO TYPE HelpActivityjava package meenakshi project meenakshioct import android app Activity import android app AlertDialog import android content Context import android content DialogInterface import android content Intent import android content SharedPreferences import android net Uri import android os Bundle import android util Log import android view LayoutInflater import android view View import android view ViewGroup import android webkit Web View import android widget EditText import android widget Toast public class HelpActivity extends Activity static String TAG HelpActivity Override protected void onCreate Bundle savedInstanceState super onCreate savedInstanceState setContentView R layout activity help public void about View v
58. oglecod import com goog import com googlecod import com googlecod import com goog eptonica android AdaptiveMap eptonica android Binarize eptonica android Convert eptonica android Enhance eptonica android Pix eptonica android ReadFile eptonica android Rotate eptonica android Scale eptonica android Skew eptonica android WriteFile tesseract android TessBaseAPI public class UnsharpMask extends AsyncTask lt Void Integer Void gt ProgressDialog pg Tag for logging purposes String TAG UnsharpMask To check if OCR needs to be performed again on the same image if the confidence value is very low boolean checkOnceForFurtherProcessing true Number of times ocr has been performed in this transaction int tessRepeatCount 0 Maximum number of times that OCR can be performed on the image in this transaction int tessRepeatMAXCOUNT 5 Mean confidence as returned by tesseract on the recognized text int meanConfidence Object of OCRActivity to access variables such as DATA PATH and view elements private OCRActivity act public UnsharpMask OCRActivity act Bitmap bitmap Log v TAG Begin constructor this act act Override protected void onPreExecute Log v CopData AsyncTask Mein Entered onPreExecute pg new ProgressDialog act 0 pg setMessage Processing pg setMax 10 pg setlndeterminate f
59. ond level that is once the user has selected the image user may crop out a part of the image that he wants to perform OCR on Process Unless high customization is required it is aluays a good decision to avoid re inventing the wheel Further the time and cost of producing a custom component that implements the photo OCR pipeline is quite high and given the schedule and budget allotted to my project it would be wiser to use a 20 TOO LAZY TO TYPE partially imolemented component than creating one from scratch After research and testing of several OCR libraries and implementations of the photo OCR pipeline Tesseract was found to have the highest accuracy However the accuracy was found to be high only when it ran on a completely clean image with a white background and black text To make this work on an Android device some amount of pre processing would be required Thus at least two modules are required for the process component Pre processing module This component will consist of a sequence of image processing algorithms that the inout image will go through before being fed to the next module 2 OCR module will use a trainable OCR engine called Tesseract described below Tesseract OCR Architecture Google Input Gray or Color Image Region Polygons Adaptive Thresholding Binary Image Character Find Text Outlines Connected Lines and Component Words Analysis Recognize Recognize Word Word Pa
60. p 2 per pe 25 lt lt include gt gt include S Z SRA LN EN include _ 00 User 2 Google _ Copy to clipboard History Screen 35 TOO LAZY TO TYPE Class Diagram 36 TOO LAZY TO TYPE Gantt Chart HES lenuewies MOWEO EWSZZO 2 peuuejg uonisuei H lenuepjiasfi EWSOEO EWSZiZO 2 uonisuei Pt ttt tt W8etO ewezzo pauueld 341598 ajIdwoj 0 92 20 b 1er eusqem H dn dem WIOEO 8 BUUE 4 p MWIOEO EWZZZO 9 p uoneisy 2 Bbulssazoid abew eve T E WZO LO GL g UOREJS uon nisuo buisss oid a ew EWBWIO SI Iemoy uoneray 2 LL tt LL LJ b suue g Z UORPN SUOJ Bumie1 2082021 ZWSz zi p z uoneisy 2 H uojejexs 1seg ZWSZYZL ZW9WZh Z guue g uonersy 2 uo a a s oiseg ZWeZ ZL ZWSWZL z uonersy ad ooij ZWPWZL ZWPUZL L peuue g uone1oqe 3
61. pect one s phone to outdo one s computer in performing OCR In fact one can t expect one s phone to do anything more than basic OCR operations But now with my app you can Why Android Biggest Addressable Smartphone market Both the iOS and Android ecosystems are huge and filed with opportunity However an increasing amount of research indicates that the Android platform is larger and growing faster than iOS Most recently Nielson reported that Android has achieved an overall 68 4 market share versus 19 4 for iOS In addition the NPD Croup released a study stating Android had over 60 of the US activations in QI 2012 versus 29 for iOS According to Google 850 000 Android devices are activated every day Global mobile operating system share 2012 Other 12 2 ios 19 4 Android 68 4 Source htto venturebeat com 2013 0 28 anoroio caotureod almost 0 global smar tohone market share in 20I2 qople just under 20 TOO LAZY TO TYPE Open Source Another great advantage of Android over similar platforms is the fact that Android is open source Meaning that no industry player not even Google will be able to restrict its develooment or introduce any changes that would go against your interests Developers have full access to the phone s functionality like sending receiving texts SMS using camera or even handling phone calls And another probably one of the most important advantages of being open source
62. plication by working on the pre processing component This can be achieved by using different filters image processing techniques etc 6 subtracting pre processing accuracy from 100 see the performance gain would achieve by working on the OCR component Tesseract engine This can be achieved by training the Tesseract engine further using different sets of initialization parameters to the component using a different OCR library ete will then repeat steps 1 6 over several iterations until am satisfied with the accuracy of my application By performing the above sequence of steps will be able to determine which component needs to be worked on further to improve my app s performance This is an efficient and effective way of improving system performance as well as managing schedule cost and other resources Component Accuracy Overall System X Pre processing Y OCR engine 100 In the production phase section of this book go into the details of how implemented this method as well as the results they produced 24 TOO LAZY TO TYPE Visual Modelling Sequence Diagrams Main Screen A iene MainActivitus Activity tap on a screen icon open corresponding screen activity User Activity 25 TOO LAZY TO TYPE OCR Screen OCR User CC start OCR display chooser Camera select Camera start camera app return image clicked select
63. port os import jinja2 import urllib import urllib2 import json from google appengine ext import db jinja_environment jinja2 Environment loader jinja2 FileSystemLoader os path join os path dirname __file__ templates autoescape True class MainHandler webapp2 RequestHandler def get self teviews db GqlQuety Select from Reviewss order by created desc sel write reviews reviews def write self params template jinja_environment get_template home6 html self response out write template render params def post self teviews db GqlQuety Select from Reviewss order by created desc self write reviews reviews 112 TOO LAZY TO TYPE class ReviewsHandler webapp2 RequestHandler def get self reviews db GqlQuery Select from Reviewss order by created desc self write reviews reviews def write self params template jinja_environment get_template teviews2 html self response out write template render params def post self self response headers Content Type text plain content self request get content user self request get uset if content a Reviewss content content user user a put self response out write success else self response out write failure class DevHandler webapp2 RequestHandler def get self self write def write self params template jinja_environment get_template dev html self
64. r similar legal issues do not apply The only condition under which the legality of this application would come into question is if the application was used to extract text from confidential or legally protected documents The developer however has no control of how the user makes use of the application and hence is not responsible for it and is absolved of any liabilities arising therefore The product is legally feasible The product is open source and the code can be used and modified Operational Feasibility The product has high applicability among a variety of users Being lightweight accurate and easy to use a uide user base is expected A study of Photo OCR applications in the Android market uas performed If we uere to compare this application with other applications in the field of Photo OCR we would find that most applications are limited to a specific type of 12 TOO LAZY TO TYPE photo such as barcodes automobile number plates business cards telephone numbers names book covers etc In contrast this application is a general purpose OCR with which any type of photo can be used as input The study also revealed that while almost all OCR applications in the market needed an internet connection at some point of time to perform even the most basic OCR function this application is entirely self contained No access to internet is required for basic functions Another point that came up during the analysis was the ac
65. s about this app on Reviews Visit us on Facebook E ME m NEU mm 70 TOO LAZY TO TYPE facebook Search for pizces anc tings Meenakshi Madan You are posting commenting and Ming as Too Lazy To Type Change to M o Too Lazy To Type Timeline Too Lazy To Type 19 Hikes 2 telling about is sop Page High accuracy Ancroic OCR apo with festures sam 25 copy sare googie 576 recent history ex ADIR 7 status EX Photos video Event milestone 2 47 wm Uke Too Lazy To Type Write something WA VV is Too Lazy To Type ccstec Teir cover pnoto Februsry 23 Too Lazy To Type joined Facebook Too Lazy To Type Februsry28 w Welcome Visit http meenakshi ocr sppspot com for more information about this app Too Lazy To Type Februzry28 Uke Comment Share App Screenshots 23 photos 71 TOO LAZY TO TYPE Graphical User Interface The following are a few screenshots of the application at work in order of appearance Y Welcome screen only comes up on first use v Main Screen Dashboard v OCR Screen Y Chooser that pops up after pressing the OCR button v Crop Screen Y Progress dialog while the image is being processed Y The OCRed text is displayed v Share feature in action 3 screenshots v Recent History Screen the latest text is reflected immediately v Chooser that pop
66. s this is the final coding iteration and the entire code is displayed in a later section 63 TOO LAZY TO TYPE oo Lazy To Type OCR Be truly smart Clipboard Search 64 TOO LAZY TO TYPE Results All improvements work correctly Accuracy quite good Ready for transition to Deployment Phase Ceiling Analysis Summary Component Accuracy Overall System 94 7 36 Pre processing 97 0588 OCR engine 100 65 TOO LAZY TO TYPE Iteration Summary Author Commit Message Date Meenakshi pem add dum 6 days Meenakshi Ma 102482 add diagrams p Final2Features 11 days ago El MeenakshiMa seassa fix links in webview Prinses 12 days ago H Meenakshi eanzeze correct help screen typos p Final2Faatures 12 days ago Meenakshi Ma scssese add link to forum p Final2Features 15 days ago BA Meenakshi 16 Add link to website and Submit Review feature p FinalzFaaturaa 15 days ago Meenakshi Ma Only show pop up if entry in Recent History screen is not empty p Final2Features 18 days ago Meenakshi a9112b2 Remove 2 unused files to reduce apk size below the 25MB limit p FinalzFaaturaa 19 days ago Meenakshi 24 amp e Add help screen custom launcher icon set welcome splash screen a p Final2Features 19 days ago BA Meenakshi Ma 2 Add hint text under icons p F
67. s up upon clicking an entry on the History Screen Y Direct SMS feature Messenger app doesnt open the message goes directly and notifies the user of the state v Settings Preference Screen v Help Info Screen v About section on Help Screen v Tips section on Help Screen v Buttons section on Help screen 3 screenshots v 5 step tutorial on Help Screen 4 screenshots v Submit a review dialog 72 TOO LAZY TO TYPE TOO LAZY TO TYPE oo Lazy To Type Dashboard Settings History Help Info ec Saving screenshot Screenshot is being saved 74 TOO LAZY TO TYPE 00 Lazy To Type OCR 01 24710 75 TOO LAZY TO TYPE Select Image Take from camera Select from gallery TOO LAZY TO TYPE CANCEL CROP TOO LAZY TO TYPE Saving screenshot Screenshot is being saved TOO LAZY TO TYPE oo Lazy To Type OCR mindset Clipboard 79 TOO LAZY TO TYPE Share using Q Bluetooth Create pin Dropbox Facebook Share using Google Messaging Submit Link Translate w Twitter WhatsApp Share with Meenakshi Madan 80 TOO LAZY TO TYPE TOO LAZY TO TYPE Select Action Copy to clipboard Google it Directly send SMS Share Delete 82 TOO LAZY TO TYPE Send text as SMS Enter Phone Number of SMS receiver Cancel TOO LAZY TO TYPE age Clea Image Cleanur Filter
68. sBaseAPI VAR CHAR BLACKLIST amp 3 gt lt baseApi setVariable TessBaseAPLVAR CHAR WHITELIST 1234567890ABCDEFGHJKLMNPRSTVWXY Zabcdefghijklmnopqrstuvwxyz Log v TAG After setting variables baseApi init Constants DATA PATH Constants LANG TessBaseAPIL OEM CUBE ONLY Log v TAG After init and before setting bitmap Log v TAG After init and before getUTF8Text act recognized Text baseApi getUTF8Text meanConfidence baseApi meanConfidence Log v TAG OCRED TEXT act recognizedText Log v TAG Mean Confidence meanConfidence if baseApi null baseApi clear Log v TAG OCRED TEXT act recognizedText if Constants LANG equalsIgnoreCase eng 1 50 TOO LAZY TO TYPE act recognizedText act recognizedText replaceAll a zA Z0 9 0 gt lt Pl act recognized Text act recognizedText trim afterProcess bitmap Calls functions to perform required preprocessing and OCR i afterProcess bitmap Source publishProgress 1 publishProgress 4 Log v TAG After unsharp FileOutputStream out new FileOutputStream Constants CURRENT IMAGE PATH Log v TAG After saving file to sdcard File pic new File Constants CURRENT IMAGE PATH Pix pix ReadFile readFile pic pix AdaptiveMap backgroundNormMorph pix 16 3 200 pix Enhance unsharpMasking pix 3 0 7F
69. setOnClickListener new View OnClickListener 4 Override public void onClick View v clicked 2 recognized Text String tv 2 getText if IrecognizedText equals amp amp recognizedText equals dialog show tv 3 setOnClickListener new View OnClickListenet Override public void onClick View v clicked 3 recognized Text String tv 3 get Text if recognizedText equals amp amp IrecognizedText equals dialog show j tv 4 setOnClickListener new View OnClickListener 4 Override public void onClick View v clicked 4 recognized Text String tv 4 getText if IrecognizedText equals amp amp recognizedText equals dialog show j public void delete 111 TOO LAZY TO TYPE SharedPreferences Editor editor mPreferences edit for int i clicked i lt 3 i t tv i set Text tv i 1 get Text editor putString his i String tv i 1 getText tv 4 setText editor putString his4 editor commit public void copyRTToClipBoard t Recognized TextUses copyR T ToClipBoard recognizedText this public void googleR T public void share RecognizedTextUses googleRT recognizedText this RecognizedTextUses share recognizedText this public void sendSMS 1 RecognizedTextUses sendSMS recognizedText this main py import webapp2 import re im
70. ss 1 Pass 2 Character Outlines Organized Into Words 21 TOO LAZY TO TYPE The above diagram shows what functionalities the Tesseract engine provides Described below is the process will follow to train Tesseract Training Tesseract Google Tesseract Data Files User words Z Wordlist2dawg Word dawg Freq dawg Training page images mfTraining inttemp Tesseract pffmtable Tesseract Features A manual B cnTraining correction normproto Unicharset extractor Addition of s Box fas sag properties j LI Manual Data Entry Source for both httoy tesseract ocr googlecode com files TesseractOSCONpof Output This is a simple component that simply displays the text to the user Other functionalities Copy the text to the Android clipboard 2 Save the text to a file on the Android phone 3 Open Loogle search for the text 22 TOO LAZY TO TYPE Test Evaluation Criteria Once the smoke test is done then need an evaluation criteria for further tests assessments and the parts of the system that need to work on Not much can be further improved in terms of performance and accuracy for the input and output components and so only the process component is discussed here Ceiling analysis What parts of the pipeline to work on to improve overall system performance Estimating errors due to each process It is important to have a single real number e
71. t on the go v Lightweight application v Supported by highest possible percentage of Android phones v Reasonably high and consistent accuracy of OCR v Reasonably less response time v Support for a reasonable variety of font types and sizes v Attractive but easy to use interface v Self contained application requiring no internet and data connection charges TOO LAZY TO TYPE w w v v SN w S Basic help screen for detailed usage help Allows users to perform OCR on new images taken using camera or images already saved on phone When taking new images users can define a specific rectangular area to analyse OCRed text can be copied to Android clipboard from where users can paste it in whichever app they want SMS text e mail document editor etc OCRed text can be saved as a text file OCRed text can be quicky Googled only feature that understandably requires an Internet connection OCRed text can be shared with any other app installed on your ohone that accepts text like Facebook SMS Bluetooth Gmail Twitter Uhatsapp Dropbox Google talk etc User can view OCRed text history 5 most recent When taking new images users can on phones flash if applicable Recognizes line breaks Doesnt save any information on 3rd party systems so users data is completely private 10 TOO LAZY TO TYPE Feasibility Study TELOS refers to the five areas of feasibility Technical Economic Legal Operational and Scheduling Al
72. tatistical analysis shows that Gingerbread 2 3 3 is the most common version among Android users Thus decided that API level 10 would be the target API for the application TOO LAZY TO TYPE The Proposal solution Strategy The solution is to use concepts from Computer Vision AL to recognize text from images to perform this task Optical Character Recognition is a technology that allows a computer to create text strings out of scanned images or in our case an image that is captured with a users smart phone tablet The basic needs and flou of the application are e User starts app e User clicks button to start OCR e User holds phone over a piece of text and clicks the picture e App processes picture e lext is displayed to the user The app will turn it into copy able text you can then paste anywhere in your phone a document editor your note taking app Gmail SMS or anything else you could imagine To make the above possible the follouing input process output layout is required Input gt he ability to click a picture from within the app TOO LAZY TO TYPE Process gt he actual text recognition module Output gt he recognized text Additionally some pre processing might be required to clean up noisy images for better accuracy Minimal user interface requirements are demonstrated as follows Main Screen Camera App Output Screen Objectives Requirements features v Quick and easy image to tex
73. the community and ask questions Either or another fellow user of this app will then be able to help you with your issue Application crash o In the unlikely event of an application crash try running the app again The crash may have been caused by another application running or some external problem o You may have accidently deleted important files needed for this app to run Try uninstalling and re installing the app This will copy back all the important files and your app will work again o If the problem persists visit meenakshi ocr fofou appspot com Too Lazy To Type and post about your oroblem Be as descriptive as possible This will helo us solve your problem 20 TOO LAZY TO TYPE Before downloading the app make sure your device meets the requirements for using the app Minimum version required is 2 2 Froyo Sometimes the app will not work with certain images It will display a pop up in such an event he image is probably too big for your device to perform complex processing on or there may be another reason for this Try again with another image and it should work fine 21 TOO LAZY TO TYPE The website This app has a dedicated website for all things Too Lazy To Type Go ahead and type meenakshi ocr appspot com into your browser or use the button on your help info screen on the app Main screen gt Help Info gt Visit the official website On this website you will find links to download
74. the newly incorporated changes to confirm that they work as intended 2 Regression tests to make sure that they are compatible with the rest of the system and no unintended side effects are produced 3 System test against the exit criteria and requirements defined in the Elaboration Phase to check if the product is ready 40 TOO LAZY TO TYPE Basic skeleton of the app Iteration 1 Objectives Add option to select image from gallery instead of accepting only neu images from camera Add experimental pre processing to see if it improves accuracy Design a basic Ul Implement processing on a separate thread Codin Uhat was coded Y Pre processed the image before feeding it to Tesseract engine increased decreased made grey scale applied Gaussian blur applied unsharp mask filter applied contrast O O O O O 41 TOO LAZY TO TYPE o corrected orientation portrait landscape Y Moved all pre processing to Asynclask to avoid application crashes v Added option to select image from camera OR gallery v Added optional crop feature package meenakshi project meenakshiocr public class UnsharpMask extends AsyncTask lt Void Void Void 4 final static int KERNAL_WIDTH 3 final static int KERNAL_HEIGHT 3 int kernal_blur final static int DIV_BY_9 9 Bitmap bitmap_Soutce Bitmap afterProcess String TAG UnsharpMask private MainActivity mainActivit
75. turned ocrPref getString psm Log v TAG PSM preferences returned None baseApi setDebug true Log v TAG After setting variables baseApi init Constants DATA_PATH Constants LANG TessBaseAPI OEM_CUBE_ONLY Log v TAG After init and before setting bitmap baseApi setImage bitmap Log v TAG After init and before getUTF8Text if level UnsharpMask LEVEL ORIGINAL 1 text original baseApi getUTF8Text meanConfidence original baseApi meanConfidence Log v TAG OCRED TEXT text original Log v TAG Mean Confidence meanConfidence original j else if level UnsharpMask LEVEL PROCESSED U text_processed baseApi getUTF8Text meanConfidence_processed baseApi meanConfidence Log v TAG OCRED TEXT text_processed Log v TAG Mean Confidence meanConfidence_processed baseApi end if baseApi null baseApi clear void performProcessing try ImageInfo mi new Imagelnfo Constants CURRENT_IMAGE_PATH MagickImage m new MagickImage mi if m normalizelmage Log v TAG normalize conversion successful else Log v TAG normalize conversion unsuccessful Deskew d new Deskew MagickBitmap ToBitmap m double skew d GetSkewAngle Log v TAG After Deskew skew skew m m rotatelmage skew 57 2957795130823208767981 54814105 m setDepth 8 m m sharpenImage 10 8 if m negatelmage 0
76. uccessful else Log v TAG negate conversion unsuccessful PixelPacket pp m getBackgroundColor int bg pp getBlue thresh Log v TAG BG color return by getBackgroundColor is bg if bg lt 32757 thresh 60000 else thresh 10000 if m thresholdImage 32757 Log v TAG thresh conversion successful 15000 else Log v TAG thresh conversion unsuccessful if m negatelmage 0 Log v TAG negate conversion successful else Log v TAG negate conversion unsuccessful m m scalelmage m getWidth 100 m getHeight 100 mi setDensity 300 m setCompression CompressionT ype NoComptession m setFileName Constants CURRENT IMAGE PATH give new location if m wtiteImage mi Log v TAG Successfully wrote image to path save else Log v TAG Image save unsuccessful catch Exception e Log v TAG exception occured performing magick functions e toString Calls functions to perform required preprocessing and OCR oy Override protected Void doInBackground Void params Log v TAG In runnable thread before processing performOCR UnsharpMask LEVEL ORIGINAL publishProgress 1 if ocrPref getBoolean processimage true performProcessing performOCR UnsharpMask LEVEL PROCESSED Log v TAG Processimage preferences returned true Log v TAG Processimage preferences returned false publishProgress 10 Log v AsyncTask Mein End of do In Back
77. valuation metric for this learning system This metric in my project is character level accuracy Ihis metric measures the following given a test set image what is the fraction of the characters in the test set image that the application recognizes correctly steps follow to perform a ceiling analysis on my application is as follows First evaluate the accuracy of the overall system That is the accuracy of character recognition delivered after the image is processed through each of the modules do this by testing the application with a set of test images which call test set 2 Once that is done determine if the accuracy is good enough 80 and above or if need to improve some of my modules to produce better accuracy The 2 modules check are pre processing and OCR 3 then simulate what happens if have a pre processing component that works 100 correctly That means will manually edit the images to produce completely clean black white images and feed these images into the next stage which is the Tesseract engine then measure the evaluation metric to check what the overall accuracy is 23 TOO LAZY TO TYPE 4 The next step is to simulate 100 accuracy for both components This would obviously lead to 100 overall system accuracy and hence will not actually perform it 5 By subtracting overall System accuracy from pre processing accuracy see the performance gain or increase in accuracy of my ap
78. ves Common understanding between co ordinator and myself on the scope of my project Deliverables Project proposal synopsis Initial demonstration TOO LAZY TO TYPE The Need Problem Definition With the drastic increase in the use of digital gadgets such as personal computers smart phones and tablets most daily jobs are now performed digitally This makes everything easier faster and more efficient Given the option most people today would prefer doing things electronically rather than sitting down with a pen and paper In fact given the option people would prefer clicking a picture instead of typing things out manually It is now increasingly common for documents to be scanned so that they can be conveniently viewed and shared via electronic means However a scan is merely an image capture of the original document so it cannot be edited or searched through in any way This results in a decrease in efficiency since people now have to manually correct or search through multiole pages OCR solves this problem by making the document text searchable What such users need is an application that will run on their smart phones and quickly and accurately get them the text they want so that they can edit it paste it elsewhere Google it or make some other use of it Such an application would increase the efficiency and effectiveness of work The ability to instantly search through content is immensely useful This is especial
79. why anyone would want to use it so the idea didn t stick for long and soon was looking for other ideas After jumping over several ideas over the course of semester 5 and partially developing and ALMOST finalizing on a word game Sudoku app it finally hit me notice boards Posters Street signs Book names noticed how often I d just click pictures of text instead of writing or typing it down myself also noticed several others doing the same THAT is when realized how brilliant but also necessary making this app was Immediately went to test out my theory Was this even possible Would Android phones be able to handle the processing required Would I need to reinvent the wheel or was there a base that could use Within a couple of days had a prototype ready that answered a few of my questions went ahead and submitted a synopsis for it and began working on it At the time barely knew anything about Android devices Why would attempt building an Android app then hear you say Well the most obvious reason is that almost everyone know uses an Android powered device People love it And Android users also love downloading third party apps and customizing their device Chances were that l d find people willing to look around my app and possibly some genuine customers quickly began looking into the finer details of developing the application Once had the basic setup of OCR began thinking about accuracy Initiall
80. xifOrientation case ExifInterface ORIENTATION ROTATE 90 rotate 90 break case ORIENTATION 180 rotate 180 break case ExiflInterface ORIENTATION 270 totate 270 break j Log v TAG Rotation rotate if rotate 0 Setting pre rotate Matrix mtx new Matrix mtx preRotate rotate Rotating Bitmap bitmap Bitmap createBitmap bitmap 0 0 w h mtx false Convert to ARGB_8888 required by tess bitmap bitmap copy Bitmap Config ARGB_8888 true catch IOException e Log e TAG Couldn t correct orientation e toString j Log v TAG Before baseApi TessBaseAPI baseApi new TessBaseAPI baseApi setDebug true baseApi init mainActivity DATA PATH mainActivity lang baseApi setImage bitmap mainActivity recognizedText baseApi getUTF8Text baseApi end Log v TAG OCRED TEXT mainActivity recognizedText if mainActivity lang equalsIgnoreCase eng 1 mainActivity recognized Text mainActivity recognizedText replaceAll a zA Z0 9 mainActivity recognizedText mainActivity recognizedText trim Override protected void onPostExecute Void result Log v AsyncTask Mein Entered onPostExecute if mainActivity recognizedText length 0 mainActivity field setText mainActivity recognized Text mainActivity progressBar setVisibility View GONE
81. y public UnsharpMask MainActivity act Bitmap bitmap Log v TAG Begin constructor mainActivity act bitmap_Source bitmap private Bitmap processingBitmap Bitmap src kal Bitmap dest Bitmap createBitmap stc getWidth stc getHeight src getConfig int bmWidth src getWidth int bmHeight stc getHeight int bmWidth_MINUS_2 bmWidth 2 int bmHeight_MINUS_2 bmHeight 2 int bmWidth_OFFSET_1 1 int bmHeight_OFFSET_1 1 for int i bmWidth OFFSET 1 i lt bmWidth MINUS 2 i for int j bmHeight OFFSET 1 j lt bmHeight MINUS 2 j get the surround 7 7 pixel of current src i j into a matrix subSrc int subSrc new in KERNAL WIDTH KERNAL HEIGHT for int k 0 k lt KERNAL WIDTH k for int 1 0 1 lt KERNAL HEIGHT 1 4 subSrc k I src getPixcl i bmWidth OFFSET 14 5 j bmHeight OFFSET 1 4 long subSumA 0 long subSumR 0 long subSumG 0 long subSumB 0 for int k 0 lt KERNAL WIDTH k for int 0 1 lt KERNAL HEIGHT 1 subSumA long Color alpha subSrc k I long kal k 1 subSumR long Color red subSrc k I dong knl k I subSumG long Color green subSrc k I long knl k I 42 TOO LAZY TO TYPE subSumB long Color blue subStclk I long kal k 1 subSumA subSumA DIV_BY_9 subSumR subSumR DIV_BY_9 subSumG subSumG DIV_BY_9
82. y the accuracy was really bad about 30 After a lot of research discovered what kinds of image processing were required and how could implement them on my app This process took the longest and was the most frustrating period to go through It seemed hopeless because expected 100 accuracy and my app wasnt giving me that looked through a few other OCR apps to see what their accuracy was Some of them gave me hope because if someone else was able to do it could figure out a way too Another aspect worked on was training Tesseract which is the OCR engine used Initially did this the hard way as the developers mentioned in their documents This would take up days just to train a handful of fonts After a while discovered an article that used a neat trick to automate some of the steps involved in training the engine Once figured out how to use it training became easy and was able to train up to 30 fonts 32 being the maximum number of fonts that the engine can be trained with Ultimately settled on Imagemagick for the pre processing part of my app and then began the phase of trial and error for discovering what filters and what sequence of them would give me a nice clean image A humongous number of tries and samples later found a combination that worked for the app Things were beginning to fall into place was quite happy with the accuracy by this point Once finalized my processing module began addin
Download Pdf Manuals
Related Search
Related Contents
Répartiteur des consommations thermiques MONITOR 2.0 Whitehaus Collection WH1313-PSS Installation Guide Follow the link to all closing instructions マルチクリックス IRT30-112 User Manual en.cdr Manual - Kenwood Tannoy T303 Cell Phone User Manual Invacare® Typhoon II SERVICE MANUAL Top offres Habindose promovido elecciones a JUNTAS DE PERSONAL Copyright © All rights reserved.
Failed to retrieve file