Repository: pablosproject/iPhone-OCR-Tesseract-and-OpenCV
Branch: master
Commit: 99bc1aee4098
Files: 24
Total size: 67.9 KB
Directory structure:
gitextract_j44k4z48/
├── .gitignore
├── Podfile
├── README.md
├── TestOCR.xcodeproj/
│ └── project.pbxproj
└── infojobOCR/
├── AppDelegate.h
├── AppDelegate.m
├── ImageProcessingImplementation.h
├── ImageProcessingImplementation.mm
├── ImageProcessingProtocol.h
├── ImageProcessor.cpp
├── ImageProcessor.h
├── TestOCR-Info.plist
├── TestOCR-Prefix.pch
├── UIImage+OpenCV.h
├── UIImage+OpenCV.mm
├── UIImage+operation.h
├── UIImage+operation.m
├── ViewController.h
├── ViewController.m
├── en.lproj/
│ ├── InfoPlist.strings
│ └── MainStoryboard.storyboard
├── main.m
└── tessdata/
├── eng.traineddata
└── spa.traineddata
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Xcode
build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
#CocoaPods
Pods
================================================
FILE: Podfile
================================================
platform :ios
pod 'OpenCV'
pod 'Tesseract'
================================================
FILE: README.md
================================================
iPhone-OCR-Tesseract-and-OpenCV
===============================
[](https://gitter.im/pablosproject/iPhone-OCR-Tesseract-and-OpenCV?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
This is a sample project created by me (@PablosPoject) and @_AJ_R for academic purpose.
It use the OpenCV framework and tutorial made by BloodAxe(https://github.com/BloodAxe) and some other utilities class made by Aptogo (https://github.com/aptogo).
It also uses the Tesseract OCR engine to read the text processed with openCV.
I also build a simple user interface that permit to take a photo or choose one from library, and also permit to apply to the image every single step in the image processing, or to apply directly all the processing.
I hope that these can be useful for someone!
Enjoy!
#Usage
Download the project and use [CocoaPods](http://cocoapods.org/) to install required libraries, by running `pod install`.
Contact Me
===============================
pablosproject@gmail.com
@PablosProject
Release under GPL
[](https://bitdeli.com/free "Bitdeli Badge")
================================================
FILE: TestOCR.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
0C4F6D0829C540F3B7E86E23 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6442C35B3A894F23BF9DB1A8 /* libPods.a */; };
0E0ECC151583681400116FAE /* UIImage+operation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E0ECC141583681400116FAE /* UIImage+operation.m */; };
0E20426B15824F34009D88F2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E20426A15824F34009D88F2 /* UIKit.framework */; };
0E20426D15824F34009D88F2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E20426C15824F34009D88F2 /* Foundation.framework */; };
0E20426F15824F34009D88F2 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E20426E15824F34009D88F2 /* CoreGraphics.framework */; };
0E20427515824F35009D88F2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0E20427315824F35009D88F2 /* InfoPlist.strings */; };
0E20427715824F35009D88F2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E20427615824F35009D88F2 /* main.m */; };
0E20427B15824F35009D88F2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E20427A15824F35009D88F2 /* AppDelegate.m */; };
0E20427E15824F35009D88F2 /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0E20427C15824F35009D88F2 /* MainStoryboard.storyboard */; };
0E20428115824F35009D88F2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E20428015824F35009D88F2 /* ViewController.m */; };
0E20429015824FF5009D88F2 /* ImageProcessingImplementation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0E20428D15824FF5009D88F2 /* ImageProcessingImplementation.mm */; };
0E20429115824FF5009D88F2 /* ImageProcessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0E20428E15824FF5009D88F2 /* ImageProcessor.cpp */; };
0E20429815825303009D88F2 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E20429715825303009D88F2 /* AVFoundation.framework */; };
0E20429A15825308009D88F2 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E20429915825308009D88F2 /* ImageIO.framework */; };
0E20429C15825316009D88F2 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E20429B15825316009D88F2 /* libz.dylib */; };
0E20429E1582531F009D88F2 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E20429D1582531F009D88F2 /* CoreVideo.framework */; };
0E2042A015825324009D88F2 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E20429F15825324009D88F2 /* CoreMedia.framework */; };
0E2042A715825613009D88F2 /* UIImage+OpenCV.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0E2042A615825612009D88F2 /* UIImage+OpenCV.mm */; };
0E74049215825A5E006AE2B4 /* tessdata in Resources */ = {isa = PBXBuildFile; fileRef = 0E74049115825A5E006AE2B4 /* tessdata */; };
482C9DB517B138770080E8D8 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 482C9DB417B138770080E8D8 /* Default-568h@2x.png */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
0997D6262A934A0E9CDE4161 /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = SOURCE_ROOT; };
0E0ECC131583681400116FAE /* UIImage+operation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+operation.h"; sourceTree = "<group>"; };
0E0ECC141583681400116FAE /* UIImage+operation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+operation.m"; sourceTree = "<group>"; };
0E20426615824F34009D88F2 /* TestOCR.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestOCR.app; sourceTree = BUILT_PRODUCTS_DIR; };
0E20426A15824F34009D88F2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
0E20426C15824F34009D88F2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
0E20426E15824F34009D88F2 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
0E20427215824F35009D88F2 /* TestOCR-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TestOCR-Info.plist"; sourceTree = "<group>"; };
0E20427415824F35009D88F2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
0E20427615824F35009D88F2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
0E20427815824F35009D88F2 /* TestOCR-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TestOCR-Prefix.pch"; sourceTree = "<group>"; };
0E20427915824F35009D88F2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
0E20427A15824F35009D88F2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
0E20427D15824F35009D88F2 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = "<group>"; };
0E20427F15824F35009D88F2 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
0E20428015824F35009D88F2 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
0E20428B15824FF5009D88F2 /* ImageProcessingProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageProcessingProtocol.h; sourceTree = "<group>"; };
0E20428C15824FF5009D88F2 /* ImageProcessingImplementation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageProcessingImplementation.h; sourceTree = "<group>"; };
0E20428D15824FF5009D88F2 /* ImageProcessingImplementation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ImageProcessingImplementation.mm; sourceTree = "<group>"; };
0E20428E15824FF5009D88F2 /* ImageProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageProcessor.cpp; sourceTree = "<group>"; };
0E20428F15824FF5009D88F2 /* ImageProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageProcessor.h; sourceTree = "<group>"; };
0E20429715825303009D88F2 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
0E20429915825308009D88F2 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
0E20429B15825316009D88F2 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
0E20429D1582531F009D88F2 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
0E20429F15825324009D88F2 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
0E2042A515825612009D88F2 /* UIImage+OpenCV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+OpenCV.h"; sourceTree = "<group>"; };
0E2042A615825612009D88F2 /* UIImage+OpenCV.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIImage+OpenCV.mm"; sourceTree = "<group>"; };
0E74049115825A5E006AE2B4 /* tessdata */ = {isa = PBXFileReference; lastKnownFileType = folder; path = tessdata; sourceTree = "<group>"; };
482C9DB417B138770080E8D8 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
6442C35B3A894F23BF9DB1A8 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
0E20426315824F34009D88F2 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0E2042A015825324009D88F2 /* CoreMedia.framework in Frameworks */,
0E20429E1582531F009D88F2 /* CoreVideo.framework in Frameworks */,
0E20429C15825316009D88F2 /* libz.dylib in Frameworks */,
0E20429A15825308009D88F2 /* ImageIO.framework in Frameworks */,
0E20429815825303009D88F2 /* AVFoundation.framework in Frameworks */,
0E20426B15824F34009D88F2 /* UIKit.framework in Frameworks */,
0E20426D15824F34009D88F2 /* Foundation.framework in Frameworks */,
0E20426F15824F34009D88F2 /* CoreGraphics.framework in Frameworks */,
0C4F6D0829C540F3B7E86E23 /* libPods.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0E20425B15824F34009D88F2 = {
isa = PBXGroup;
children = (
482C9DB417B138770080E8D8 /* Default-568h@2x.png */,
0E20427015824F35009D88F2 /* TestOCR */,
0E20426915824F34009D88F2 /* Frameworks */,
0E20426715824F34009D88F2 /* Products */,
0997D6262A934A0E9CDE4161 /* Pods.xcconfig */,
);
sourceTree = "<group>";
};
0E20426715824F34009D88F2 /* Products */ = {
isa = PBXGroup;
children = (
0E20426615824F34009D88F2 /* TestOCR.app */,
);
name = Products;
sourceTree = "<group>";
};
0E20426915824F34009D88F2 /* Frameworks */ = {
isa = PBXGroup;
children = (
0E20429F15825324009D88F2 /* CoreMedia.framework */,
0E20429D1582531F009D88F2 /* CoreVideo.framework */,
0E20429B15825316009D88F2 /* libz.dylib */,
0E20429915825308009D88F2 /* ImageIO.framework */,
0E20429715825303009D88F2 /* AVFoundation.framework */,
0E20426A15824F34009D88F2 /* UIKit.framework */,
0E20426C15824F34009D88F2 /* Foundation.framework */,
0E20426E15824F34009D88F2 /* CoreGraphics.framework */,
6442C35B3A894F23BF9DB1A8 /* libPods.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
0E20427015824F35009D88F2 /* TestOCR */ = {
isa = PBXGroup;
children = (
0E74049115825A5E006AE2B4 /* tessdata */,
0E20427915824F35009D88F2 /* AppDelegate.h */,
0E20427A15824F35009D88F2 /* AppDelegate.m */,
0E20427C15824F35009D88F2 /* MainStoryboard.storyboard */,
0E20427F15824F35009D88F2 /* ViewController.h */,
0E20428015824F35009D88F2 /* ViewController.m */,
0E20428B15824FF5009D88F2 /* ImageProcessingProtocol.h */,
0E20428C15824FF5009D88F2 /* ImageProcessingImplementation.h */,
0E20428D15824FF5009D88F2 /* ImageProcessingImplementation.mm */,
0E20428E15824FF5009D88F2 /* ImageProcessor.cpp */,
0E20428F15824FF5009D88F2 /* ImageProcessor.h */,
0E2042A515825612009D88F2 /* UIImage+OpenCV.h */,
0E2042A615825612009D88F2 /* UIImage+OpenCV.mm */,
0E0ECC131583681400116FAE /* UIImage+operation.h */,
0E0ECC141583681400116FAE /* UIImage+operation.m */,
0E20427115824F35009D88F2 /* Supporting Files */,
);
name = TestOCR;
path = infojobOCR;
sourceTree = "<group>";
};
0E20427115824F35009D88F2 /* Supporting Files */ = {
isa = PBXGroup;
children = (
0E20427215824F35009D88F2 /* TestOCR-Info.plist */,
0E20427315824F35009D88F2 /* InfoPlist.strings */,
0E20427615824F35009D88F2 /* main.m */,
0E20427815824F35009D88F2 /* TestOCR-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
0E20426515824F34009D88F2 /* TestOCR */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0E20428415824F35009D88F2 /* Build configuration list for PBXNativeTarget "TestOCR" */;
buildPhases = (
B676B766E76B4C5F9460B0DD /* Check Pods Manifest.lock */,
0E20426215824F34009D88F2 /* Sources */,
0E20426315824F34009D88F2 /* Frameworks */,
0E20426415824F34009D88F2 /* Resources */,
5D4D7A6961374D8AB26D855E /* Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
);
name = TestOCR;
productName = infojobOCR;
productReference = 0E20426615824F34009D88F2 /* TestOCR.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
0E20425D15824F34009D88F2 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0430;
ORGANIZATIONNAME = 26775;
};
buildConfigurationList = 0E20426015824F34009D88F2 /* Build configuration list for PBXProject "TestOCR" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 0E20425B15824F34009D88F2;
productRefGroup = 0E20426715824F34009D88F2 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
0E20426515824F34009D88F2 /* TestOCR */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
0E20426415824F34009D88F2 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0E20427515824F35009D88F2 /* InfoPlist.strings in Resources */,
0E20427E15824F35009D88F2 /* MainStoryboard.storyboard in Resources */,
0E74049215825A5E006AE2B4 /* tessdata in Resources */,
482C9DB517B138770080E8D8 /* Default-568h@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
5D4D7A6961374D8AB26D855E /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n";
};
B676B766E76B4C5F9460B0DD /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
0E20426215824F34009D88F2 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0E20427715824F35009D88F2 /* main.m in Sources */,
0E20427B15824F35009D88F2 /* AppDelegate.m in Sources */,
0E20428115824F35009D88F2 /* ViewController.m in Sources */,
0E20429015824FF5009D88F2 /* ImageProcessingImplementation.mm in Sources */,
0E20429115824FF5009D88F2 /* ImageProcessor.cpp in Sources */,
0E2042A715825613009D88F2 /* UIImage+OpenCV.mm in Sources */,
0E0ECC151583681400116FAE /* UIImage+operation.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
0E20427315824F35009D88F2 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
0E20427415824F35009D88F2 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
0E20427C15824F35009D88F2 /* MainStoryboard.storyboard */ = {
isa = PBXVariantGroup;
children = (
0E20427D15824F35009D88F2 /* en */,
);
name = MainStoryboard.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
0E20428215824F35009D88F2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
SDKROOT = iphoneos;
};
name = Debug;
};
0E20428315824F35009D88F2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
0E20428515824F35009D88F2 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0997D6262A934A0E9CDE4161 /* Pods.xcconfig */;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "infojobOCR/TestOCR-Prefix.pch";
INFOPLIST_FILE = "infojobOCR/TestOCR-Info.plist";
LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_NAME = TestOCR;
WRAPPER_EXTENSION = app;
};
name = Debug;
};
0E20428615824F35009D88F2 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0997D6262A934A0E9CDE4161 /* Pods.xcconfig */;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "infojobOCR/TestOCR-Prefix.pch";
INFOPLIST_FILE = "infojobOCR/TestOCR-Info.plist";
LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_NAME = TestOCR;
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
0E20426015824F34009D88F2 /* Build configuration list for PBXProject "TestOCR" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0E20428215824F35009D88F2 /* Debug */,
0E20428315824F35009D88F2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0E20428415824F35009D88F2 /* Build configuration list for PBXNativeTarget "TestOCR" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0E20428515824F35009D88F2 /* Debug */,
0E20428615824F35009D88F2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0E20425D15824F34009D88F2 /* Project object */;
}
================================================
FILE: infojobOCR/AppDelegate.h
================================================
//
// AppDelegate.h
// infojobOCR
//
// Created by Paolo Tagliani on 08/06/12.
// Copyright (c) 2012 26775. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
================================================
FILE: infojobOCR/AppDelegate.m
================================================
//
// AppDelegate.m
// infojobOCR
//
// Created by Paolo Tagliani on 08/06/12.
// Copyright (c) 2012 26775. All rights reserved.
//
#import "AppDelegate.h"
@implementation AppDelegate
@synthesize window = _window;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
================================================
FILE: infojobOCR/ImageProcessingImplementation.h
================================================
//
// ImageProcessingImplementation.h
// InfojobOCR
//
// Created by Paolo Tagliani on 10/05/12.
// Copyright (c) 2012 26775. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ImageProcessingProtocol.h"
@interface ImageProcessingImplementation : NSObject<ImageProcessingProtocol>
- (UIImage*) processImage:(UIImage*) src;
- (NSString*) OCRImage:(UIImage*)src;
- (NSString*) pathToLangugeFIle;
- (UIImage*) processRotation:(UIImage*)src;
- (UIImage*) processHistogram:(UIImage*)src;
- (UIImage*) processFilter:(UIImage*)src;
- (UIImage*) processBinarize:(UIImage*)src;
@end
================================================
FILE: infojobOCR/ImageProcessingImplementation.mm
================================================
//
// ImageProcessingImplementation.m
// InfojobOCR
//
// Created by Paolo Tagliani on 10/05/12.
// Copyright (c) 2012 26775. All rights reserved.
//
#import "ImageProcessingImplementation.h"
#import "ImageProcessor.h"
#import "UIImage+OpenCV.h"
@implementation ImageProcessingImplementation
- (NSString*) pathToLangugeFIle{
// Set up the tessdata path. This is included in the application bundle
// but is copied to the Documents directory on the first run.
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentPath = ([documentPaths count] > 0) ? [documentPaths objectAtIndex:0] : nil;
NSString *dataPath = [documentPath stringByAppendingPathComponent:@"tessdata"];
NSFileManager *fileManager = [NSFileManager defaultManager];
// If the expected store doesn't exist, copy the default store.
if (![fileManager fileExistsAtPath:dataPath]) {
// get the path to the app bundle (with the tessdata dir)
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
NSString *tessdataPath = [bundlePath stringByAppendingPathComponent:@"tessdata"];
if (tessdataPath) {
[fileManager copyItemAtPath:tessdataPath toPath:dataPath error:NULL];
}
}
setenv("TESSDATA_PREFIX", [[documentPath stringByAppendingString:@"/"] UTF8String], 1);
return dataPath;
}
- (UIImage*) processImage:(UIImage*) src{
/**
* PRE-PROCESSING OF THE IMAGE
**/
ImageProcessor processor;
UIImage * processed= [UIImage imageWithCVMat:processor.processImage([src CVGrayscaleMat], src.size.height)];
return processed;
}
- (NSString*) OCRImage:(UIImage*)src{
// init the tesseract engine.
tesseract::TessBaseAPI *tesseract = new tesseract::TessBaseAPI();
tesseract->Init([[self pathToLangugeFIle] cStringUsingEncoding:NSUTF8StringEncoding], "eng");
//Pass the UIIMage to cvmat and pass the sequence of pixel to tesseract
cv::Mat toOCR=[src CVGrayscaleMat];
NSLog(@"%d", toOCR.channels());
tesseract->SetImage((uchar*)toOCR.data, toOCR.size().width, toOCR.size().height
, toOCR.channels(), toOCR.step1());
tesseract->Recognize(NULL);
char* utf8Text = tesseract->GetUTF8Text();
return [NSString stringWithUTF8String:utf8Text];
}
- (UIImage*) processRotation:(UIImage*)src{
ImageProcessor processor;
cv::Mat source=[src CVGrayscaleMat];
processor.correctRotation(source, source, src.size.height);
UIImage *rotated=[UIImage imageWithCVMat:source];
return rotated;
}
- (UIImage*) processHistogram:(UIImage*)src{
ImageProcessor processor;
cv::Mat source=[src CVGrayscaleMat];
cv::Mat output=processor.equalize(source);
UIImage *equalized=[UIImage imageWithCVMat:output];
return equalized;
}
- (UIImage*) processFilter:(UIImage*)src{
ImageProcessor processor;
cv::Mat source=[src CVGrayscaleMat];
cv::Mat output=processor.filterMedianSmoot(source);
UIImage *filtered=[UIImage imageWithCVMat:output];
return filtered;
}
- (UIImage*) processBinarize:(UIImage*)src{
ImageProcessor processor;
cv::Mat source=[src CVGrayscaleMat];
cv::Mat output=processor.binarize(source);
UIImage *binarized=[UIImage imageWithCVMat:output];
return binarized;
}
@end
================================================
FILE: infojobOCR/ImageProcessingProtocol.h
================================================
//
// ImageProcessingProtocol.h
// InfojobOCR
//
// Created by Paolo Tagliani on 10/05/12.
// Copyright (c) 2012 26775. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol ImageProcessingProtocol <NSObject>
- (UIImage*) processImage:(UIImage*) src;
- (NSString*) OCRImage:(UIImage*)src;
- (UIImage*) processRotation:(UIImage*)src;
- (UIImage*) processHistogram:(UIImage*)src;
- (UIImage*) processFilter:(UIImage*)src;
- (UIImage*) processBinarize:(UIImage*)src;
@end
================================================
FILE: infojobOCR/ImageProcessor.cpp
================================================
//
// ImageProcessor.cpp
// InfojobOCR
//
// Created by Paolo Tagliani on 06/06/12.
// Copyright (c) 2012 26775. All rights reserved.
//
#include <iostream>
#include "ImageProcessor.h"
cv::Mat ImageProcessor::processImage(cv::Mat source, float height){
//Rotacion
if (correctRotation(source, source, height)<0) printf("Error in rotation correction");
// cv::Mat equalized=equalize(source);
cv::Mat median_filtered=filterMedianSmoot(source);
cv::Mat result=binarize(median_filtered);
return result;
}
cv::Mat ImageProcessor::filterMedianSmoot(const cv::Mat &source){
cv::Mat results;
cv::medianBlur(source, results, 3);
return results;
}
cv::Mat ImageProcessor::filterGaussian(const cv::Mat&source){
cv::Mat results;
cv::GaussianBlur(source, results, cvSize(3, 3), 0);
return results;
}
cv::Mat ImageProcessor::equalize(const cv::Mat&source){
cv::Mat results;
cv::equalizeHist(source, results);
return results;
}
cv::Mat ImageProcessor::binarize(const cv::Mat&source){
cv::Mat results;
int blockDim=MIN( source.size().height/4, source.size().width/4);
if(blockDim % 2 != 1) blockDim++; //block has to be odd
printf("%s : %d","Block dimension", blockDim);
cv::adaptiveThreshold(source, results, 255, cv::ADAPTIVE_THRESH_MEAN_C,
cv::THRESH_BINARY,blockDim, 0);
return results;
}
int ImageProcessor::correctRotation(cv::Mat &image, cv::Mat &output, float height)
{
//calcular el tamaño optimo de la imagen
//Ha de ser lo suficicnetemte grande como para que de detecten bien las líneas
//si tomamos de que la imagen ha de ser de 1296 de alto se calcula
float prop=0;
prop = height/image.cols;
//std::cout<<image.cols<<std::endl;
int cols = image.cols*prop;
int rows = image.rows*prop;
std::vector<cv::Vec4i> lines;
cv::Mat resized(cols,rows,CV_8UC1,0);
cv::Mat dst(cols,rows,CV_8UC1,255);
cv::Mat original = image.clone();;
cv::Mat kernel(1,2,CV_8UC1,0);
cv::Mat kernel2(3,3,CV_8UC1,0);
cv::Size si(0,0);
// cv::Mat trans(cols, rows, CV_8UC1,0);
// cv::transpose(image,trans);
// cv::flip(trans,trans,1);
// cv::resize(trans, resized, si, prop,prop);
cv::threshold(image, image, 100, 255, CV_THRESH_BINARY);
//cv::Canny(image,image,0,100);
//cv::erode(image, image, kernel,cv::Point(0,1), 10);
cv::morphologyEx(image, image, cv::MORPH_OPEN, kernel2, cv::Point(1,1), 15);
//cv::dilate(image, image, kernel,cv::Point(0,1), 2);
cv::Canny(image,image,0,100);
//lineas de hough
//cv::HoughLinesP(image, lines, 1, CV_PI/180, 50, 50, 10 );
cv::HoughLinesP(image, lines, 1, CV_PI/180, 80, 30, 10 );
double media=0;
double ang=0;
int num=0;
cuadrante c[4];
for (int i =0; i < 4;i++)
{
c[i].media = 0;
c[i].contador = 0;
}
for( size_t i = 0; i < lines.size(); i++ )
{
cv::Vec4i l = lines[i];
cv::line( dst, cv::Point(l[0], l[1]), cv::Point(l[2], l[3]), cv::Scalar(0,0,0), 3, CV_AA);
//ang =atan2(l[3]-l[1],l[0]-l[2]);
ang =atan2(l[1]-l[3],l[0]-l[2]);
//if (ang >= 0 && ang <=CV_PI / 2)
if (ang >= 0 && ang <=CV_PI / 3)
{
c[0].media += ang;
c[0].contador++;
//}else if (ang >CV_PI/2 && ang <= CV_PI)
}else if (ang >(2*CV_PI)/3 && ang <= CV_PI)
{
c[1].media += ang;
c[1].contador++;
//}else if (ang < 0 && ang > -1*CV_PI/2)
}else if (ang > -1*CV_PI && ang < -2*CV_PI/3)
{
c[2].media += ang;
c[2].contador++;
}else if (ang > CV_PI/3 && ang < 0)
{
c[3].media += ang;
c[3].contador++;
}
}
int biggest = 0;
int bi=0;
double rot =0;
double aux;
for (int i =0; i < 4;i++)
{
if (c[i].contador > bi)
{
biggest = i;
bi = c[i].contador;
}
//std::cout<<"El cudrante "<<i<<" tiene "<<c[i].contador<<" elementos y media "<<180*(c[i].media/c[i].contador)/CV_PI<<std::endl;
}
//std::cout<< "el que mas tiene es "<<biggest<<" con "<<180*(c[biggest].media/c[biggest].contador)/CV_PI<<std::endl;
aux = (180*(c[biggest].media/c[biggest].contador)/CV_PI);
aux = (aux<0)?-1*aux:aux;
if (biggest == 1 || biggest == 2)
{
rot = 180 - aux;
}else{
rot = aux;
}
if (!(biggest == 0 || biggest == 2))
{
rot = rot *-1;
}
if (rot<-3 || rot > 3)
{
//std::cout<<"he rotado la image "<<rot<<std::endl;
image = rotateImage(original, rot);
}else{
image = original; //no se rota
}
output = image.clone();
// /*cv::namedWindow( "Ori+Thres", CV_WINDOW_NORMAL );// Create a window for display.
// cv::imshow( "Ori+Thres", original); // Show our image inside it.
// cv::namedWindow( "Detected Lines", CV_WINDOW_NORMAL );// Create a window for display.
// cv::imshow( "Detected Lines", dst); // Show our image inside it.
// cv::namedWindow( "Final rotated", CV_WINDOW_NORMAL );// Create a window for display.
// cv::imshow( "Final rotated", output); */ // Show our image inside it.
// cv::waitKey();
return 0;
}
cv::Mat ImageProcessor::rotateImage(const cv::Mat& source, double angle)
{
cv::Point2f src_center(source.cols/2.0F, source.rows/2.0F);
cv::Mat rot_mat = cv::getRotationMatrix2D(src_center, angle, 1.0);
cv::Mat dst;
cv::warpAffine(source, dst, rot_mat, source.size());
return dst;
}
================================================
FILE: infojobOCR/ImageProcessor.h
================================================
//
// ImageProcessor.h
// InfojobOCR
//
// Created by Paolo Tagliani on 06/06/12.
// Copyright (c) 2012 26775. All rights reserved.
//
#ifndef InfojobOCR_ImageProcessor_h
#define InfojobOCR_ImageProcessor_h
class ImageProcessor {
typedef struct{
int contador;
double media;
}cuadrante;
public:
/*
To test the implementation I perform a canny on a black white image
*/
cv::Mat processImage(cv::Mat source, float height);
/*
Filter the image with a median filter to redue the salt&pepper noise,
then apply the smooth operator to reduce noise.
*/
cv::Mat filterMedianSmoot(const cv::Mat &source);
/*
Filter with a gaussian
*/
cv::Mat filterGaussian(const cv::Mat&source);
/*
Histogram equalization on 1 channel image
*/
cv::Mat equalize(const cv::Mat&source);
/*
Binarization made using a mobile median treshold,
adapted using the image dimension
*/
cv::Mat binarize(const cv::Mat&source);
/*
Detect if an image is rotated and correct to the proper orientation
of the text
*/
int correctRotation (cv::Mat &image, cv::Mat &output, float height);
/*
Implements the rotation of the image according to the angle passed
as parameter
*/
cv::Mat rotateImage(const cv::Mat& source, double angle);
};
#endif
================================================
FILE: infojobOCR/TestOCR-Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.pablosproject.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>MainStoryboard</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
================================================
FILE: infojobOCR/TestOCR-Prefix.pch
================================================
//
// Prefix header for all source files of the 'infojobOCR' target in the 'infojobOCR' project
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __cplusplus
#import <OpenCV/opencv2/opencv.hpp>
#include "baseapi.h"
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
================================================
FILE: infojobOCR/UIImage+OpenCV.h
================================================
//
// UIImage+OpenCV.h
// OpenCVClient
//
// Created by Robin Summerhill on 02/09/2011.
// Copyright 2011 Aptogo Limited. All rights reserved.
//
// Permission is given to use this source code file without charge in any
// project, commercial or otherwise, entirely at your risk, with the condition
// that any redistribution (in part or whole) of source code must retain
// this copyright and permission notice. Attribution in compiled projects is
// appreciated but not required.
//
#import <UIKit/UIKit.h>
@interface UIImage (UIImage_OpenCV)
+(UIImage *)imageWithCVMat:(const cv::Mat&)cvMat;
-(id)initWithCVMat:(const cv::Mat&)cvMat;
@property(nonatomic, readonly) cv::Mat CVMat;
@property(nonatomic, readonly) cv::Mat CVGrayscaleMat;
@end
================================================
FILE: infojobOCR/UIImage+OpenCV.mm
================================================
//
// UIImage+OpenCV.mm
// OpenCVClient
//
// Created by Robin Summerhill on 02/09/2011.
// Copyright 2011 Aptogo Limited. All rights reserved.
//
// Permission is given to use this source code file without charge in any
// project, commercial or otherwise, entirely at your risk, with the condition
// that any redistribution (in part or whole) of source code must retain
// this copyright and permission notice. Attribution in compiled projects is
// appreciated but not required.
//
#import "UIImage+OpenCV.h"
static void ProviderReleaseDataNOP(void *info, const void *data, size_t size)
{
// Do not release memory
return;
}
@implementation UIImage (UIImage_OpenCV)
-(cv::Mat)CVMat
{
CGColorSpaceRef colorSpace = CGImageGetColorSpace(self.CGImage);
CGFloat cols = self.size.width;
CGFloat rows = self.size.height;
cv::Mat cvMat(rows, cols, CV_8UC4); // 8 bits per component, 4 channels
CGContextRef contextRef = CGBitmapContextCreate(cvMat.data, // Pointer to backing data
cols, // Width of bitmap
rows, // Height of bitmap
8, // Bits per component
cvMat.step[0], // Bytes per row
colorSpace, // Colorspace
kCGImageAlphaNoneSkipLast |
kCGBitmapByteOrderDefault); // Bitmap info flags
CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), self.CGImage);
CGContextRelease(contextRef);
return cvMat;
}
-(cv::Mat)CVGrayscaleMat
{
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
CGFloat cols = self.size.width;
CGFloat rows = self.size.height;
cv::Mat cvMat = cv::Mat(rows, cols, CV_8UC1); // 8 bits per component, 1 channel
CGContextRef contextRef = CGBitmapContextCreate(cvMat.data, // Pointer to backing data
cols, // Width of bitmap
rows, // Height of bitmap
8, // Bits per component
cvMat.step[0], // Bytes per row
colorSpace, // Colorspace
kCGImageAlphaNone |
kCGBitmapByteOrderDefault); // Bitmap info flags
CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), self.CGImage);
CGContextRelease(contextRef);
CGColorSpaceRelease(colorSpace);
return cvMat;
}
+ (UIImage *)imageWithCVMat:(const cv::Mat&)cvMat
{
return [[UIImage alloc] initWithCVMat:cvMat];
}
- (id)initWithCVMat:(const cv::Mat&)cvMat
{
NSData *data = [NSData dataWithBytes:cvMat.data length:cvMat.elemSize() * cvMat.total()];
CGColorSpaceRef colorSpace;
if (cvMat.elemSize() == 1)
{
colorSpace = CGColorSpaceCreateDeviceGray();
}
else
{
colorSpace = CGColorSpaceCreateDeviceRGB();
}
CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge_retained CFDataRef)data);
CGImageRef imageRef = CGImageCreate(cvMat.cols, // Width
cvMat.rows, // Height
8, // Bits per component
8 * cvMat.elemSize(), // Bits per pixel
cvMat.step[0], // Bytes per row
colorSpace, // Colorspace
kCGImageAlphaNone | kCGBitmapByteOrderDefault, // Bitmap info flags
provider, // CGDataProviderRef
NULL, // Decode
false, // Should interpolate
kCGRenderingIntentDefault); // Intent
self = [self initWithCGImage:imageRef];
CGImageRelease(imageRef);
CGDataProviderRelease(provider);
CGColorSpaceRelease(colorSpace);
return self;
}
@end
================================================
FILE: infojobOCR/UIImage+operation.h
================================================
//
// UIImage+operation.h
// infojobOCR
//
// Created by Paolo Tagliani on 09/06/12.
// Copyright (c) 2012 26775. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (UKImage)
-(UIImage*)rotate:(UIImageOrientation)orient;
@end
================================================
FILE: infojobOCR/UIImage+operation.m
================================================
#include "UIImage+operation.h"
static CGRect swapWidthAndHeight(CGRect rect)
{
CGFloat swap = rect.size.width;
rect.size.width = rect.size.height;
rect.size.height = swap;
return rect;
}
@implementation UIImage (UKImage)
-(UIImage*)rotate:(UIImageOrientation)orient
{
CGRect bnds = CGRectZero;
UIImage* copy = nil;
CGContextRef ctxt = nil;
CGImageRef imag = self.CGImage;
CGRect rect = CGRectZero;
CGAffineTransform tran = CGAffineTransformIdentity;
rect.size.width = CGImageGetWidth(imag);
rect.size.height = CGImageGetHeight(imag);
bnds = rect;
switch (orient)
{
case UIImageOrientationUp:
// would get you an exact copy of the original
assert(false);
return nil;
case UIImageOrientationUpMirrored:
tran = CGAffineTransformMakeTranslation(rect.size.width, 0.0);
tran = CGAffineTransformScale(tran, -1.0, 1.0);
break;
case UIImageOrientationDown:
tran = CGAffineTransformMakeTranslation(rect.size.width,
rect.size.height);
tran = CGAffineTransformRotate(tran, M_PI);
break;
case UIImageOrientationDownMirrored:
tran = CGAffineTransformMakeTranslation(0.0, rect.size.height);
tran = CGAffineTransformScale(tran, 1.0, -1.0);
break;
case UIImageOrientationLeft:
bnds = swapWidthAndHeight(bnds);
tran = CGAffineTransformMakeTranslation(0.0, rect.size.width);
tran = CGAffineTransformRotate(tran, 3.0 * M_PI / 2.0);
break;
case UIImageOrientationLeftMirrored:
bnds = swapWidthAndHeight(bnds);
tran = CGAffineTransformMakeTranslation(rect.size.height,
rect.size.width);
tran = CGAffineTransformScale(tran, -1.0, 1.0);
tran = CGAffineTransformRotate(tran, 3.0 * M_PI / 2.0);
break;
case UIImageOrientationRight:
bnds = swapWidthAndHeight(bnds);
tran = CGAffineTransformMakeTranslation(rect.size.height, 0.0);
tran = CGAffineTransformRotate(tran, M_PI / 2.0);
break;
case UIImageOrientationRightMirrored:
bnds = swapWidthAndHeight(bnds);
tran = CGAffineTransformMakeScale(-1.0, 1.0);
tran = CGAffineTransformRotate(tran, M_PI / 2.0);
break;
default:
// orientation value supplied is invalid
assert(false);
return nil;
}
UIGraphicsBeginImageContext(bnds.size);
ctxt = UIGraphicsGetCurrentContext();
switch (orient)
{
case UIImageOrientationLeft:
case UIImageOrientationLeftMirrored:
case UIImageOrientationRight:
case UIImageOrientationRightMirrored:
CGContextScaleCTM(ctxt, -1.0, 1.0);
CGContextTranslateCTM(ctxt, -rect.size.height, 0.0);
break;
default:
CGContextScaleCTM(ctxt, 1.0, -1.0);
CGContextTranslateCTM(ctxt, 0.0, -rect.size.height);
break;
}
CGContextConcatCTM(ctxt, tran);
CGContextDrawImage(UIGraphicsGetCurrentContext(), rect, imag);
copy = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return copy;
}
@end
================================================
FILE: infojobOCR/ViewController.h
================================================
//
// ViewController.h
// infojobOCR
//
// Created by Paolo Tagliani on 08/06/12.
// Copyright (c) 2012 26775. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ImageProcessingProtocol.h"
@interface ViewController : UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIActionSheetDelegate>{
UIImagePickerController *mediaPicker;
UIImage *takenImage;
UIImage *processedImage;
}
@property (strong, nonatomic) IBOutlet UIButton *process;
@property (strong, nonatomic) IBOutlet UIImageView *resultView;
@property (strong, nonatomic) id <ImageProcessingProtocol> imageProcessor;
@property (strong, nonatomic) IBOutlet UIButton *read;
@property (strong,nonatomic) UIImage *takenImage;
@property (strong,nonatomic) UIImage *processedImage;
@property (strong, nonatomic) IBOutlet UIButton *rotateButton;
@property (strong, nonatomic) IBOutlet UIButton *Histogrambutton;
@property (strong, nonatomic) IBOutlet UIButton *FilterButton;
@property (strong, nonatomic) IBOutlet UIButton *BinarizeButton;
@property (strong, nonatomic) IBOutlet UIButton *originalButton;
- (IBAction)TakePhoto:(id)sender;
- (IBAction)Pre:(id)sender;
- (IBAction)OCR:(id)sender;
- (IBAction)PreRotation:(id)sender;
- (IBAction)PreHistogram:(id)sender;
- (IBAction)PreFilter:(id)sender;
- (IBAction)PreBinarize:(id)sender;
- (IBAction)returnOriginal:(id)sender;
- (IBAction)ChooseMedia:(id)sender;
- (UIView*)CreateOverlay;
@end
================================================
FILE: infojobOCR/ViewController.m
================================================
//
// ViewController.m
// infojobOCR
//
// Created by Paolo Tagliani on 08/06/12.
// Copyright (c) 2012 26775. All rights reserved.
//
#import "ViewController.h"
#import "ImageProcessingImplementation.h"
#import "UIImage+operation.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize takenImage;
@synthesize process;
@synthesize resultView;
@synthesize imageProcessor;
@synthesize read;
@synthesize processedImage;
@synthesize rotateButton;
@synthesize Histogrambutton;
@synthesize FilterButton;
@synthesize BinarizeButton;
@synthesize originalButton;
- (void)viewDidLoad
{
[super viewDidLoad];
imageProcessor= [[ImageProcessingImplementation alloc] init];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[self setResultView:nil];
[self setProcess:nil];
[self setRead:nil];
[self setRotateButton:nil];
[self setRotateButton:nil];
[self setHistogrambutton:nil];
[self setFilterButton:nil];
[self setBinarizeButton:nil];
[self setOriginalButton:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationPortrait) return YES;
else return NO;
}
- (IBAction)Pre:(id)sender {
NSLog(@"Dimension taken image: %f x %f",takenImage.size.width, takenImage.size.height);
self.processedImage=[imageProcessor processImage:[self takenImage]];
self.resultView.image=[self processedImage];
NSLog(@"Dimension processed image: %f x %f",takenImage.size.width, takenImage.size.height);
}
- (IBAction)OCR:(id)sender {
NSString *readed=[imageProcessor OCRImage:[self processedImage]];
[[[UIAlertView alloc] initWithTitle:@""
message:[NSString stringWithFormat:@"Recognized:\n%@", readed]
delegate:nil
cancelButtonTitle:nil
otherButtonTitles:@"OK", nil] show];
}
- (IBAction)PreRotation:(id)sender {
self.processedImage=[imageProcessor processRotation:[self processedImage]];
self.resultView.image=[self processedImage];
}
- (IBAction)PreHistogram:(id)sender {
self.processedImage=[imageProcessor processHistogram:[self processedImage]];
self.resultView.image=[self processedImage];
}
- (IBAction)PreFilter:(id)sender {
self.processedImage=[imageProcessor processFilter:[self processedImage]];
self.resultView.image=[self processedImage];
}
- (IBAction)PreBinarize:(id)sender {
self.processedImage=[imageProcessor processBinarize:[self processedImage]];
self.resultView.image=[self processedImage];
}
- (IBAction)returnOriginal:(id)sender {
self.processedImage=[self takenImage ];
self.resultView.image= [self takenImage];
}
- (IBAction)TakePhoto:(id)sender {
mediaPicker = [[UIImagePickerController alloc] init];
mediaPicker.delegate=self;
mediaPicker.allowsEditing = YES;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:
@"Take a photo or choose existing, and use the control to center the announce"
delegate: self cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Take photo", @"Choose Existing", nil];
[actionSheet showInView:self.view];
} else {
mediaPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:mediaPicker animated:YES];
}
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if(buttonIndex != actionSheet.cancelButtonIndex)
{
if (buttonIndex == 0) {
mediaPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
} else if (buttonIndex == 1) {
mediaPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
[self presentModalViewController:mediaPicker animated:YES];
}
else [self dismissModalViewControllerAnimated:YES];
}
- (UIView*)CreateOverlay{
UIView *overlay= [[UIView alloc]
initWithFrame:CGRectMake
(0, 0, self.view.frame.size.width, self.view.frame.size.height*0.10)];//width equal and height 15%
overlay.backgroundColor=[UIColor blackColor];
overlay.alpha=0.5;
return overlay;
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
[picker dismissModalViewControllerAnimated:YES];
//I take the coordinate of the cropping
CGRect croppedRect=[[info objectForKey:UIImagePickerControllerCropRect] CGRectValue];
UIImage *original=[info objectForKey:UIImagePickerControllerOriginalImage];
UIImage *rotatedCorrectly;
if (original.imageOrientation!=UIImageOrientationUp)
rotatedCorrectly=[original rotate:original.imageOrientation];
else rotatedCorrectly=original;
CGImageRef ref= CGImageCreateWithImageInRect(rotatedCorrectly.CGImage, croppedRect);
self.takenImage= [UIImage imageWithCGImage:ref];
self.resultView.image=[self takenImage];
self.processedImage=[self takenImage ];
process.hidden=NO;
BinarizeButton.hidden=NO;
Histogrambutton.hidden=NO;
FilterButton.hidden=NO;
rotateButton.hidden=NO;
self.read.hidden=NO;
originalButton.hidden=NO;
}
@end
================================================
FILE: infojobOCR/en.lproj/InfoPlist.strings
================================================
/* Localized versions of Info.plist keys */
================================================
FILE: infojobOCR/en.lproj/MainStoryboard.storyboard
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.1" toolsVersion="2182" systemVersion="11E53" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="2">
<dependencies>
<deployment defaultVersion="1296" identifier="iOS"/>
<development defaultVersion="4200" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1181"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="5">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="4" sceneMemberID="firstResponder"/>
<viewController id="2" customClass="ViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="3">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" id="DJn-mc-mc5">
<rect key="frame" x="20" y="25" width="280" height="280"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="l1R-Db-Ryn">
<rect key="frame" x="20" y="313" width="105" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="Take photo">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="TakePhoto:" destination="2" eventType="touchUpInside" id="xrr-Ez-pzd"/>
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="FPW-yi-NCT">
<rect key="frame" x="187" y="313" width="113" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="Pre-Process">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="Pre:" destination="2" eventType="touchUpInside" id="HnU-ff-Qmb"/>
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="ZVF-Md-wld">
<rect key="frame" x="20" y="403" width="79" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="Read it">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="OCR:" destination="2" eventType="touchUpInside" id="3Lm-Fw-hyr"/>
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="d03-9w-TzN">
<rect key="frame" x="121" y="358" width="86" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.09637465328" blue="0.060997664930000001" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="Rotation">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="PreRotation:" destination="2" eventType="touchUpInside" id="WzA-VJ-z0c"/>
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="H8p-31-1rq">
<rect key="frame" x="215" y="358" width="99" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.09637465328" blue="0.060997664930000001" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="Histogram">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="PreHistogram:" destination="2" eventType="touchUpInside" id="eG1-7c-gAj"/>
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="qxT-rY-ft4">
<rect key="frame" x="135" y="397" width="72" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.09637465328" blue="0.060997664930000001" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="Filter">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="PreFilter:" destination="2" eventType="touchUpInside" id="YJa-Nv-7af"/>
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="dCv-38-UEb">
<rect key="frame" x="223" y="397" width="83" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.09637465328" blue="0.060997664930000001" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="Binarize">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="PreBinarize:" destination="2" eventType="touchUpInside" id="WQS-ny-sh4"/>
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="qOv-tc-3iQ">
<rect key="frame" x="23" y="358" width="81" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="Original">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="returnOriginal:" destination="2" eventType="touchUpInside" id="pd0-wK-hvr"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<connections>
<outlet property="BinarizeButton" destination="dCv-38-UEb" id="WBB-SG-vWy"/>
<outlet property="FilterButton" destination="qxT-rY-ft4" id="q2v-fJ-v0A"/>
<outlet property="Histogrambutton" destination="H8p-31-1rq" id="Cin-GV-ju7"/>
<outlet property="originalButton" destination="qOv-tc-3iQ" id="pw5-6T-qMX"/>
<outlet property="process" destination="FPW-yi-NCT" id="HBt-yk-RDl"/>
<outlet property="read" destination="ZVF-Md-wld" id="rws-zp-ZZL"/>
<outlet property="resultView" destination="DJn-mc-mc5" id="yb8-Ls-uAK"/>
<outlet property="rotateButton" destination="d03-9w-TzN" id="mFL-p3-0b5"/>
</connections>
</viewController>
</objects>
<point key="canvasLocation" x="-221" y="-3"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document>
================================================
FILE: infojobOCR/main.m
================================================
//
// main.m
// infojobOCR
//
// Created by Paolo Tagliani on 08/06/12.
// Copyright (c) 2012 26775. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
gitextract_j44k4z48/
├── .gitignore
├── Podfile
├── README.md
├── TestOCR.xcodeproj/
│ └── project.pbxproj
└── infojobOCR/
├── AppDelegate.h
├── AppDelegate.m
├── ImageProcessingImplementation.h
├── ImageProcessingImplementation.mm
├── ImageProcessingProtocol.h
├── ImageProcessor.cpp
├── ImageProcessor.h
├── TestOCR-Info.plist
├── TestOCR-Prefix.pch
├── UIImage+OpenCV.h
├── UIImage+OpenCV.mm
├── UIImage+operation.h
├── UIImage+operation.m
├── ViewController.h
├── ViewController.m
├── en.lproj/
│ ├── InfoPlist.strings
│ └── MainStoryboard.storyboard
├── main.m
└── tessdata/
├── eng.traineddata
└── spa.traineddata
SYMBOL INDEX (1 symbols across 1 files)
FILE: infojobOCR/ImageProcessor.h
function class (line 12) | class ImageProcessor {
Condensed preview — 24 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (75K chars).
[
{
"path": ".gitignore",
"chars": 219,
"preview": "# Xcode\nbuild/*\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!defaul"
},
{
"path": "Podfile",
"chars": 43,
"preview": "platform :ios\npod 'OpenCV'\npod 'Tesseract'\n"
},
{
"path": "README.md",
"chars": 1320,
"preview": "iPhone-OCR-Tesseract-and-OpenCV\n===============================\n\n[![Join the chat at https://gitter.im/pablosproject/iPh"
},
{
"path": "TestOCR.xcodeproj/project.pbxproj",
"chars": 20257,
"preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
},
{
"path": "infojobOCR/AppDelegate.h",
"chars": 278,
"preview": "//\n// AppDelegate.h\n// infojobOCR\n//\n// Created by Paolo Tagliani on 08/06/12.\n// Copyright (c) 2012 26775. All righ"
},
{
"path": "infojobOCR/AppDelegate.m",
"chars": 2039,
"preview": "//\n// AppDelegate.m\n// infojobOCR\n//\n// Created by Paolo Tagliani on 08/06/12.\n// Copyright (c) 2012 26775. All righ"
},
{
"path": "infojobOCR/ImageProcessingImplementation.h",
"chars": 602,
"preview": "//\n// ImageProcessingImplementation.h\n// InfojobOCR\n//\n// Created by Paolo Tagliani on 10/05/12.\n// Copyright (c) 20"
},
{
"path": "infojobOCR/ImageProcessingImplementation.mm",
"chars": 3478,
"preview": "//\n// ImageProcessingImplementation.m\n// InfojobOCR\n//\n// Created by Paolo Tagliani on 10/05/12.\n// Copyright (c) 20"
},
{
"path": "infojobOCR/ImageProcessingProtocol.h",
"chars": 488,
"preview": "//\n// ImageProcessingProtocol.h\n// InfojobOCR\n//\n// Created by Paolo Tagliani on 10/05/12.\n// Copyright (c) 2012 267"
},
{
"path": "infojobOCR/ImageProcessor.cpp",
"chars": 5401,
"preview": "//\n// ImageProcessor.cpp\n// InfojobOCR\n//\n// Created by Paolo Tagliani on 06/06/12.\n// Copyright (c) 2012 26775. All"
},
{
"path": "infojobOCR/ImageProcessor.h",
"chars": 1425,
"preview": "//\n// ImageProcessor.h\n// InfojobOCR\n//\n// Created by Paolo Tagliani on 06/06/12.\n// Copyright (c) 2012 26775. All r"
},
{
"path": "infojobOCR/TestOCR-Info.plist",
"chars": 1240,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "infojobOCR/TestOCR-Prefix.pch",
"chars": 408,
"preview": "//\n// Prefix header for all source files of the 'infojobOCR' target in the 'infojobOCR' project\n//\n\n#import <Availabilit"
},
{
"path": "infojobOCR/UIImage+OpenCV.h",
"chars": 757,
"preview": "//\n// UIImage+OpenCV.h\n// OpenCVClient\n//\n// Created by Robin Summerhill on 02/09/2011.\n// Copyright 2011 Aptogo Lim"
},
{
"path": "infojobOCR/UIImage+OpenCV.mm",
"chars": 4967,
"preview": "//\n// UIImage+OpenCV.mm\n// OpenCVClient\n//\n// Created by Robin Summerhill on 02/09/2011.\n// Copyright 2011 Aptogo Li"
},
{
"path": "infojobOCR/UIImage+operation.h",
"chars": 252,
"preview": "//\n// UIImage+operation.h\n// infojobOCR\n//\n// Created by Paolo Tagliani on 09/06/12.\n// Copyright (c) 2012 26775. Al"
},
{
"path": "infojobOCR/UIImage+operation.m",
"chars": 3643,
"preview": "\n\n#include \"UIImage+operation.h\"\n\nstatic CGRect swapWidthAndHeight(CGRect rect)\n{\n CGFloat swap = rect.size.width;\n "
},
{
"path": "infojobOCR/ViewController.h",
"chars": 1456,
"preview": "//\n// ViewController.h\n// infojobOCR\n//\n// Created by Paolo Tagliani on 08/06/12.\n// Copyright (c) 2012 26775. All r"
},
{
"path": "infojobOCR/ViewController.m",
"chars": 5979,
"preview": "//\n// ViewController.m\n// infojobOCR\n//\n// Created by Paolo Tagliani on 08/06/12.\n// Copyright (c) 2012 26775. All r"
},
{
"path": "infojobOCR/en.lproj/InfoPlist.strings",
"chars": 45,
"preview": "/* Localized versions of Info.plist keys */\n\n"
},
{
"path": "infojobOCR/en.lproj/MainStoryboard.storyboard",
"chars": 14917,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard"
},
{
"path": "infojobOCR/main.m",
"chars": 337,
"preview": "//\n// main.m\n// infojobOCR\n//\n// Created by Paolo Tagliani on 08/06/12.\n// Copyright (c) 2012 26775. All rights rese"
}
]
// ... and 2 more files (download for full content)
About this extraction
This page contains the full source code of the pablosproject/iPhone-OCR-Tesseract-and-OpenCV GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 24 files (67.9 KB), approximately 19.0k tokens, and a symbol index with 1 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.