├── README.markdown
├── camera-button@2x.png
├── close@2x.psd
├── final-graphics
├── Untitled-4.jpg
├── f-setting-1-active.png
├── f-setting-1-active@2x.png
├── f-setting-1.png
├── f-setting-1@2x.png
├── f-setting-2-active.png
├── f-setting-2-active@2x.png
├── f-setting-2.png
├── f-setting-2@2x.png
├── f-setting-3-active.png
├── f-setting-3-active@2x.png
├── f-setting-3.png
├── f-setting-3@2x.png
├── f-setting-4-active.png
├── f-setting-4-active@2x.png
├── f-setting-4.png
├── f-setting-4@2x.png
├── f-setting-indicator-active.png
├── f-setting-indicator-active@2x.png
├── f-setting-tray.png
└── f-setting-tray@2x.png
├── flash-off@2x.psd
├── flash-on@2x.psd
├── instaoverlay.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── mmackh.xcuserdatad
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
└── xcuserdata
│ └── mmackh.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints.xcbkptlist
│ └── xcschemes
│ ├── instaoverlay.xcscheme
│ └── xcschememanagement.plist
├── instaoverlay
├── Default-568h@2x.png
├── Default.png
├── Default@2x.png
├── MAAppDelegate.h
├── MAAppDelegate.m
├── MAImagePickerController
│ ├── MACaptureSession.h
│ ├── MACaptureSession.m
│ ├── MAConstants.h
│ ├── MAConstants.m
│ ├── MADrawRect.h
│ ├── MADrawRect.m
│ ├── MAImagePickerController.h
│ ├── MAImagePickerController.m
│ ├── MAImagePickerControllerAdjustViewController.h
│ ├── MAImagePickerControllerAdjustViewController.mm
│ ├── MAImagePickerFinalViewController.h
│ ├── MAImagePickerFinalViewController.mm
│ ├── MAOpenCV.h
│ ├── MAOpenCV.mm
│ ├── UIImage+fixOrientation.h
│ ├── UIImage+fixOrientation.m
│ ├── UIImageView+ContentFrame.h
│ └── UIImageView+ContentFrame.m
├── MAViewController.h
├── MAViewController.m
├── camera-bottom-bar.png
├── camera-bottom-bar@2x.png
├── camera-button-pressed.png
├── camera-button-pressed@2x.png
├── camera-button.png
├── camera-button@2x.png
├── camera-grid-1136@2x.png
├── camera-grid.png
├── camera-grid@2x.png
├── close-button.png
├── close-button@2x.png
├── confirm-button.png
├── confirm-button@2x.png
├── crop-button-icon.png
├── crop-button-icon@2x.png
├── en.lproj
│ ├── InfoPlist.strings
│ └── MAViewController.xib
├── enhance-button.png
├── enhance-button@2x.png
├── f-setting-1-active.png
├── f-setting-1-active@2x.png
├── f-setting-1.png
├── f-setting-1@2x.png
├── f-setting-2-active.png
├── f-setting-2-active@2x.png
├── f-setting-2.png
├── f-setting-2@2x.png
├── f-setting-3-active.png
├── f-setting-3-active@2x.png
├── f-setting-3.png
├── f-setting-3@2x.png
├── f-setting-4-active.png
├── f-setting-4-active@2x.png
├── f-setting-4.png
├── f-setting-4@2x.png
├── f-setting-indicator-active.png
├── f-setting-indicator-active@2x.png
├── f-setting-rotate.png
├── f-setting-rotate@2x.png
├── f-setting-tray.png
├── f-setting-tray@2x.png
├── flash-off-button.png
├── flash-off-button@2x.png
├── flash-on-button.png
├── flash-on-button@2x.png
├── instaoverlay-Info.plist
├── instaoverlay-Prefix.pch
├── main.m
├── toolbar-icon-crop.png
└── toolbar-icon-crop@2x.png
├── opencv2.framework
├── Headers
├── Resources
├── Versions
│ ├── A
│ │ ├── Headers
│ │ │ ├── calib3d
│ │ │ │ └── calib3d.hpp
│ │ │ ├── contrib
│ │ │ │ ├── contrib.hpp
│ │ │ │ ├── detection_based_tracker.hpp
│ │ │ │ ├── hybridtracker.hpp
│ │ │ │ ├── openfabmap.hpp
│ │ │ │ └── retina.hpp
│ │ │ ├── core
│ │ │ │ ├── core.hpp
│ │ │ │ ├── core_c.h
│ │ │ │ ├── cuda_devptrs.hpp
│ │ │ │ ├── devmem2d.hpp
│ │ │ │ ├── eigen.hpp
│ │ │ │ ├── gpumat.hpp
│ │ │ │ ├── internal.hpp
│ │ │ │ ├── mat.hpp
│ │ │ │ ├── opengl_interop.hpp
│ │ │ │ ├── opengl_interop_deprecated.hpp
│ │ │ │ ├── operations.hpp
│ │ │ │ ├── types_c.h
│ │ │ │ ├── version.hpp
│ │ │ │ └── wimage.hpp
│ │ │ ├── features2d
│ │ │ │ └── features2d.hpp
│ │ │ ├── flann
│ │ │ │ ├── all_indices.h
│ │ │ │ ├── allocator.h
│ │ │ │ ├── any.h
│ │ │ │ ├── autotuned_index.h
│ │ │ │ ├── composite_index.h
│ │ │ │ ├── config.h
│ │ │ │ ├── defines.h
│ │ │ │ ├── dist.h
│ │ │ │ ├── dummy.h
│ │ │ │ ├── dynamic_bitset.h
│ │ │ │ ├── flann.hpp
│ │ │ │ ├── flann_base.hpp
│ │ │ │ ├── general.h
│ │ │ │ ├── ground_truth.h
│ │ │ │ ├── hdf5.h
│ │ │ │ ├── heap.h
│ │ │ │ ├── hierarchical_clustering_index.h
│ │ │ │ ├── index_testing.h
│ │ │ │ ├── kdtree_index.h
│ │ │ │ ├── kdtree_single_index.h
│ │ │ │ ├── kmeans_index.h
│ │ │ │ ├── linear_index.h
│ │ │ │ ├── logger.h
│ │ │ │ ├── lsh_index.h
│ │ │ │ ├── lsh_table.h
│ │ │ │ ├── matrix.h
│ │ │ │ ├── miniflann.hpp
│ │ │ │ ├── nn_index.h
│ │ │ │ ├── object_factory.h
│ │ │ │ ├── params.h
│ │ │ │ ├── random.h
│ │ │ │ ├── result_set.h
│ │ │ │ ├── sampling.h
│ │ │ │ ├── saving.h
│ │ │ │ ├── simplex_downhill.h
│ │ │ │ └── timer.h
│ │ │ ├── highgui
│ │ │ │ ├── cap_ios.h
│ │ │ │ ├── highgui.hpp
│ │ │ │ └── highgui_c.h
│ │ │ ├── imgproc
│ │ │ │ ├── imgproc.hpp
│ │ │ │ ├── imgproc_c.h
│ │ │ │ └── types_c.h
│ │ │ ├── legacy
│ │ │ │ ├── blobtrack.hpp
│ │ │ │ ├── compat.hpp
│ │ │ │ ├── legacy.hpp
│ │ │ │ └── streams.hpp
│ │ │ ├── ml
│ │ │ │ └── ml.hpp
│ │ │ ├── nonfree
│ │ │ │ ├── features2d.hpp
│ │ │ │ └── nonfree.hpp
│ │ │ ├── objdetect
│ │ │ │ └── objdetect.hpp
│ │ │ ├── opencv.hpp
│ │ │ ├── opencv_modules.hpp
│ │ │ ├── photo
│ │ │ │ ├── photo.hpp
│ │ │ │ └── photo_c.h
│ │ │ ├── stitching
│ │ │ │ ├── detail
│ │ │ │ │ ├── autocalib.hpp
│ │ │ │ │ ├── blenders.hpp
│ │ │ │ │ ├── camera.hpp
│ │ │ │ │ ├── exposure_compensate.hpp
│ │ │ │ │ ├── matchers.hpp
│ │ │ │ │ ├── motion_estimators.hpp
│ │ │ │ │ ├── seam_finders.hpp
│ │ │ │ │ ├── util.hpp
│ │ │ │ │ ├── util_inl.hpp
│ │ │ │ │ ├── warpers.hpp
│ │ │ │ │ └── warpers_inl.hpp
│ │ │ │ ├── stitcher.hpp
│ │ │ │ └── warpers.hpp
│ │ │ ├── video
│ │ │ │ ├── background_segm.hpp
│ │ │ │ ├── tracking.hpp
│ │ │ │ └── video.hpp
│ │ │ ├── videostab
│ │ │ │ ├── deblurring.hpp
│ │ │ │ ├── fast_marching.hpp
│ │ │ │ ├── fast_marching_inl.hpp
│ │ │ │ ├── frame_source.hpp
│ │ │ │ ├── global_motion.hpp
│ │ │ │ ├── inpainting.hpp
│ │ │ │ ├── log.hpp
│ │ │ │ ├── motion_stabilizing.hpp
│ │ │ │ ├── optical_flow.hpp
│ │ │ │ ├── stabilizer.hpp
│ │ │ │ └── videostab.hpp
│ │ │ └── world
│ │ │ │ └── world.hpp
│ │ ├── Resources
│ │ │ └── Info.plist
│ │ └── opencv2
│ └── Current
└── opencv2
├── screen1.PNG
├── screen2.PNG
└── screen3.PNG
/README.markdown:
--------------------------------------------------------------------------------
1 | # WARNING - CONSIDER THIS CODEBASE DEPRECATED. TAKE A LOOK AT: [IPDFCameraViewController](https://github.com/mmackh/IPDFCameraViewController)
2 |
3 | ## MAImagePickerController aka. InstaOverlay
4 |
5 | MAImagePickerController is a critical component of the InstaPDF (http://instapdf.me) for iPhone app. I've started to code in Objective C a couple of months ago, so please
6 | offer your insights into making the component better.
7 |
8 | Credits:
9 | - Maximilian Mackh (@mmackh) - Creator & Maintainer
10 | - Utkarsh Sinha (@aishack) - Excellent Tutorials
11 | - Jason Job (@musicalgeometry) - Excellent Tutorial
12 | - Karl Phillip Buhr (@karlphillip) - Excellent Square Detection Code
13 | - OpenCV (http://opencv.org/);
14 |
15 | Be sure to checkout the ToDo!
16 |
17 | ## ToDo
18 |
19 | 1. ~~Improve Paper (Edge) Detection~~
20 | 2. Fix rotation of UIImages chosen from the Library
21 | 3. Store the rotations in the final view
22 | 4. ~~Improve API~~
23 |
24 |
25 | ## Screenshots
26 |
27 | 
28 |
29 | 
30 |
31 | 
32 |
33 | ## Using it in your project
34 |
35 | 1. Add all the necessary files inside MAImagePicker to your Project
36 | 2. #import "MAImagePickerController.h" in your ViewController's header (.h) file & declare that it can be delegated by MAImagePickerControllerDelegate
37 | 3. IMPORTANT: This project uses the OpenCV framework. Download the newest version here: 'http://opencv.org/'
38 | 4. Double check all the necessary frameworks: 'CoreImage.framework', 'opencv2.framework', 'QuartzCore.framework', 'ImageIO.framework', 'CoreMedia.framework', 'AVFoundation.framework', MediaPlayer.framework
39 | 5. The API is rather simple, use it like this:
40 |
41 | ```objective-c
42 | - (IBAction)initButton:(id)sender
43 | {
44 | MAImagePickerController *imagePicker = [[MAImagePickerController alloc] init];
45 |
46 | [imagePicker setDelegate:self];
47 | [imagePicker setSourceType:MAImagePickerControllerSourceTypeCamera];
48 |
49 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:imagePicker];
50 |
51 | [self presentViewController:navigationController animated:YES completion:nil];
52 | }
53 |
54 | - (void)imagePickerDidCancel
55 | {
56 | [self dismissViewControllerAnimated:YES completion:nil];
57 | }
58 |
59 | - (void)imagePickerDidChooseImageWithPath:(NSString *)path
60 | {
61 | [self dismissViewControllerAnimated:YES completion:nil];
62 |
63 | if ([[NSFileManager defaultManager] fileExistsAtPath:path])
64 | {
65 | NSLog(@"File Found at %@", path);
66 |
67 | }
68 | else
69 | {
70 | NSLog(@"No File Found at %@", path);
71 | }
72 |
73 | [[NSFileManager defaultManager] removeItemAtPath:path error:nil];
74 | }
75 | ```
76 |
77 | # License
78 | Copyright (c) 2012-2013 Maximilian Mackh
79 |
80 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
81 |
82 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
83 |
84 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
85 |
--------------------------------------------------------------------------------
/camera-button@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/camera-button@2x.png
--------------------------------------------------------------------------------
/close@2x.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/close@2x.psd
--------------------------------------------------------------------------------
/final-graphics/Untitled-4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/Untitled-4.jpg
--------------------------------------------------------------------------------
/final-graphics/f-setting-1-active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-1-active.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-1-active@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-1-active@2x.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-1.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-1@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-1@2x.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-2-active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-2-active.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-2-active@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-2-active@2x.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-2.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-2@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-2@2x.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-3-active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-3-active.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-3-active@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-3-active@2x.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-3.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-3@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-3@2x.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-4-active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-4-active.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-4-active@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-4-active@2x.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-4.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-4@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-4@2x.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-indicator-active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-indicator-active.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-indicator-active@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-indicator-active@2x.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-tray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-tray.png
--------------------------------------------------------------------------------
/final-graphics/f-setting-tray@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/final-graphics/f-setting-tray@2x.png
--------------------------------------------------------------------------------
/flash-off@2x.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/flash-off@2x.psd
--------------------------------------------------------------------------------
/flash-on@2x.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/flash-on@2x.psd
--------------------------------------------------------------------------------
/instaoverlay.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/instaoverlay.xcodeproj/project.xcworkspace/xcuserdata/mmackh.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay.xcodeproj/project.xcworkspace/xcuserdata/mmackh.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/instaoverlay.xcodeproj/project.xcworkspace/xcuserdata/mmackh.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/instaoverlay.xcodeproj/xcuserdata/mmackh.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/instaoverlay.xcodeproj/xcuserdata/mmackh.xcuserdatad/xcschemes/instaoverlay.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/instaoverlay.xcodeproj/xcuserdata/mmackh.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | instaoverlay.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 2237CA101647E85000B77E0E
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/instaoverlay/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/Default-568h@2x.png
--------------------------------------------------------------------------------
/instaoverlay/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/Default.png
--------------------------------------------------------------------------------
/instaoverlay/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/Default@2x.png
--------------------------------------------------------------------------------
/instaoverlay/MAAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAAppDelegate.h
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/5/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class MAViewController;
12 |
13 | @interface MAAppDelegate : UIResponder
14 |
15 | @property (strong, nonatomic) UIWindow *window;
16 |
17 | @property (strong, nonatomic) MAViewController *viewController;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/instaoverlay/MAAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // MAAppDelegate.m
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/5/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import "MAAppDelegate.h"
10 |
11 | #import "MAViewController.h"
12 |
13 | @implementation MAAppDelegate
14 |
15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
16 | {
17 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
18 | // Override point for customization after application launch.
19 | self.viewController = [[MAViewController alloc] initWithNibName:@"MAViewController" bundle:nil];
20 | self.window.rootViewController = self.viewController;
21 | [self.window makeKeyAndVisible];
22 | return YES;
23 | }
24 |
25 | - (void)applicationWillResignActive:(UIApplication *)application
26 | {
27 | // 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.
28 | // 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.
29 | }
30 |
31 | - (void)applicationDidEnterBackground:(UIApplication *)application
32 | {
33 | // 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.
34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
35 | }
36 |
37 | - (void)applicationWillEnterForeground:(UIApplication *)application
38 | {
39 | // 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.
40 | }
41 |
42 | - (void)applicationDidBecomeActive:(UIApplication *)application
43 | {
44 | // 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.
45 | }
46 |
47 | - (void)applicationWillTerminate:(UIApplication *)application
48 | {
49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/MACaptureSession.h:
--------------------------------------------------------------------------------
1 | //
2 | // MACaptureSession.h
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/5/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "MAConstants.h"
12 |
13 | @interface MACaptureSession : NSObject
14 | {
15 | BOOL flashOn;
16 | }
17 |
18 | @property (strong, nonatomic) AVCaptureVideoPreviewLayer *previewLayer;
19 | @property (strong, nonatomic) AVCaptureSession *captureSession;
20 | @property (strong, nonatomic) AVCaptureStillImageOutput *stillImageOutput;
21 | @property (strong, nonatomic) UIImage *stillImage;
22 |
23 | - (void)addVideoPreviewLayer;
24 | - (void)addStillImageOutput;
25 | - (void)captureStillImage;
26 | - (void)addVideoInputFromCamera;
27 |
28 | - (void)setFlashOn:(BOOL)boolWantsFlash;
29 |
30 | @end
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/MACaptureSession.m:
--------------------------------------------------------------------------------
1 | //
2 | // MACaptureSession.m
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/5/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import "MACaptureSession.h"
10 | #import
11 |
12 | @implementation MACaptureSession
13 |
14 | @synthesize captureSession = _captureSession;
15 | @synthesize previewLayer = _previewLayer;
16 | @synthesize stillImageOutput = _stillImageOutput;
17 | @synthesize stillImage = _stillImage;
18 |
19 | - (id)init
20 | {
21 | if ((self = [super init]))
22 | {
23 | [self setCaptureSession:[[AVCaptureSession alloc] init]];
24 | }
25 | return self;
26 | }
27 |
28 | - (void)addVideoPreviewLayer
29 | {
30 | [self setPreviewLayer:[[AVCaptureVideoPreviewLayer alloc] initWithSession:[self captureSession]]];
31 | [_previewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
32 |
33 | }
34 |
35 | - (void)addVideoInputFromCamera
36 | {
37 | AVCaptureDevice *backCamera;
38 |
39 | NSArray *devices = [AVCaptureDevice devices];
40 |
41 | for (AVCaptureDevice *device in devices)
42 | {
43 | if ([device hasMediaType:AVMediaTypeVideo])
44 | {
45 | if ([device position] == AVCaptureDevicePositionBack)
46 | {
47 | backCamera = device;
48 | [self toggleFlash];
49 | }
50 | }
51 | }
52 |
53 | NSError *error = nil;
54 |
55 | AVCaptureDeviceInput *backFacingCameraDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:backCamera error:&error];
56 |
57 | if (!error)
58 | {
59 | if ([_captureSession canAddInput:backFacingCameraDeviceInput])
60 | {
61 | [_captureSession addInput:backFacingCameraDeviceInput];
62 | }
63 | }
64 | }
65 |
66 | - (void)setFlashOn:(BOOL)boolWantsFlash
67 | {
68 | flashOn = boolWantsFlash;
69 | [self toggleFlash];
70 | }
71 |
72 | - (void)toggleFlash
73 | {
74 | NSArray *devices = [AVCaptureDevice devices];
75 |
76 | for (AVCaptureDevice *device in devices)
77 | {
78 | if (device.flashAvailable) {
79 | if (flashOn)
80 | {
81 | [device lockForConfiguration:nil];
82 | device.flashMode = AVCaptureFlashModeOn;
83 | [device unlockForConfiguration];
84 | }
85 | else
86 | {
87 | [device lockForConfiguration:nil];
88 | device.flashMode = AVCaptureFlashModeOff;
89 | [device unlockForConfiguration];
90 | }
91 | }
92 | }
93 | }
94 |
95 | - (void)addStillImageOutput
96 | {
97 | [self setStillImageOutput:[[AVCaptureStillImageOutput alloc] init]];
98 | NSDictionary *outputSettings = [[NSDictionary alloc] initWithObjectsAndKeys:AVVideoCodecJPEG,AVVideoCodecKey,nil];
99 | [[self stillImageOutput] setOutputSettings:outputSettings];
100 |
101 | AVCaptureConnection *videoConnection = nil;
102 |
103 | for (AVCaptureConnection *connection in [_stillImageOutput connections])
104 | {
105 | for (AVCaptureInputPort *port in [connection inputPorts])
106 | {
107 | if ([[port mediaType] isEqual:AVMediaTypeVideo] )
108 | {
109 | videoConnection = connection;
110 | break;
111 | }
112 | }
113 | if (videoConnection)
114 | {
115 | break;
116 | }
117 | }
118 | [_captureSession setSessionPreset:AVCaptureSessionPresetPhoto];
119 | [_captureSession addOutput:[self stillImageOutput]];
120 | }
121 |
122 | - (void)captureStillImage
123 | {
124 | AVCaptureConnection *videoConnection = nil;
125 | for (AVCaptureConnection *connection in [[self stillImageOutput] connections])
126 | {
127 | for (AVCaptureInputPort *port in [connection inputPorts])
128 | {
129 | if ([[port mediaType] isEqual:AVMediaTypeVideo])
130 | {
131 | videoConnection = connection;
132 | break;
133 | }
134 | }
135 |
136 | if (videoConnection)
137 | {
138 | break;
139 | }
140 | }
141 |
142 | [_stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection
143 | completionHandler:
144 | ^(CMSampleBufferRef imageSampleBuffer, NSError *error) {
145 |
146 | if (imageSampleBuffer)
147 | {
148 | CFDictionaryRef exifAttachments = CMGetAttachment(imageSampleBuffer, kCGImagePropertyExifDictionary, NULL);
149 | if (exifAttachments)
150 | {
151 | //NSLog(@"attachements: %@", exifAttachments);
152 | } else
153 | {
154 | //NSLog(@"no attachments");
155 | }
156 | NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
157 | UIImage *image = [[UIImage alloc] initWithData:imageData];
158 | [self setStillImage:image];
159 |
160 | [[NSNotificationCenter defaultCenter] postNotificationName:kImageCapturedSuccessfully object:nil];
161 | }
162 | }];
163 | }
164 |
165 | - (void)dealloc {
166 |
167 | [[self captureSession] stopRunning];
168 |
169 | _previewLayer = nil;
170 | _captureSession = nil;
171 | _stillImageOutput = nil;
172 | _stillImage = nil;
173 | }
174 |
175 | @end
176 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/MAConstants.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAConstants.h
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/6/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #define kImageCapturedSuccessfully @"imageCapturedSuccessfully"
12 | #define kCameraToolBarHeight 54
13 | #define kCameraFlashDefaultsKey @"MAImagePickerControllerFlashIsOn"
14 | #define kCropButtonSize 200
15 | #define kActivityIndicatorSize 100
16 |
17 | @interface MAConstants : NSObject
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/MAConstants.m:
--------------------------------------------------------------------------------
1 | //
2 | // MAConstants.m
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/6/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import "MAConstants.h"
10 |
11 | @implementation MAConstants
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/MADrawRect.h:
--------------------------------------------------------------------------------
1 | //
2 | // MADrawRect.h
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/6/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MAConstants.h"
11 |
12 | // cd
13 | // d ------------- c
14 | // | |
15 | // | |
16 | // da | | bc
17 | // | |
18 | // | |
19 | // | |
20 | // a ------------- b
21 | // ab
22 | //
23 | // a = 1, b = 2, c = 3, d = 4
24 |
25 | @interface MADrawRect : UIView
26 | {
27 | CGPoint touchOffset;
28 | CGPoint a;
29 | CGPoint b;
30 | CGPoint c;
31 | CGPoint d;
32 |
33 | BOOL frameMoved;
34 | }
35 |
36 | @property (strong, nonatomic) UIButton *pointD;
37 | @property (strong, nonatomic) UIButton *pointC;
38 | @property (strong, nonatomic) UIButton *pointB;
39 | @property (strong, nonatomic) UIButton *pointA;
40 |
41 | - (BOOL)frameEdited;
42 | - (void)resetFrame;
43 | - (CGPoint)coordinatesForPoint: (int)point withScaleFactor: (CGFloat)scaleFactor;
44 |
45 | - (void)bottomLeftCornerToCGPoint: (CGPoint)point;
46 | - (void)bottomRightCornerToCGPoint: (CGPoint)point;
47 | - (void)topRightCornerToCGPoint: (CGPoint)point;
48 | - (void)topLeftCornerToCGPoint: (CGPoint)point;
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/MAImagePickerController.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAImagePickerController.h
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/5/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MACaptureSession.h"
11 | #import "MAConstants.h"
12 | #import
13 |
14 | typedef NS_ENUM(NSInteger, MAImagePickerControllerSourceType)
15 | {
16 | MAImagePickerControllerSourceTypeCamera,
17 | MAImagePickerControllerSourceTypePhotoLibrary
18 | };
19 |
20 | @protocol MAImagePickerControllerDelegate
21 |
22 | @required
23 | - (void)imagePickerDidCancel;
24 | - (void)imagePickerDidChooseImageWithPath:(NSString *)path;
25 |
26 | @end
27 |
28 | @interface MAImagePickerController : UIViewController
29 | {
30 | BOOL flashIsOn;
31 | BOOL imagePickerDismissed;
32 | }
33 |
34 | @property (nonatomic,assign) id delegate;
35 |
36 | @property (strong, nonatomic) MACaptureSession *captureManager;
37 | @property (strong, nonatomic) UIToolbar *cameraToolbar;
38 | @property (strong, nonatomic) UIBarButtonItem *flashButton;
39 | @property (strong, nonatomic) UIBarButtonItem *pictureButton;
40 | @property (strong, nonatomic) UIView *cameraPictureTakenFlash;
41 |
42 | @property (strong ,nonatomic) UIImagePickerController *invokeCamera;
43 |
44 | @property MAImagePickerControllerSourceType *sourceType;
45 |
46 | @property (strong, nonatomic) MPVolumeView *volumeView;
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/MAImagePickerControllerAdjustViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAImagePickerControllerAdjustViewController.h
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/5/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | //Dedected Points
10 |
11 | #import
12 |
13 | #import "MAConstants.h"
14 | #import "MADrawRect.h"
15 |
16 | #import
17 | #import
18 |
19 | @interface MAImagePickerControllerAdjustViewController : UIViewController
20 | {
21 | BOOL isGray;
22 | }
23 |
24 | @property (strong, nonatomic) UIImageView *sourceImageView;
25 | @property (strong, nonatomic) UIToolbar *adjustToolBar;
26 | @property (strong, nonatomic) UIImage *sourceImage;
27 | @property (strong, nonatomic) UIImage *adjustedImage;
28 | @property (strong, nonatomic) MADrawRect *adjustRect;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/MAImagePickerFinalViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAImagePickerFinalViewController.h
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/10/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MAConstants.h"
11 |
12 | @interface MAImagePickerFinalViewController : UIViewController
13 | {
14 | int currentlySelected;
15 | UIImageOrientation sourceImageOrientation;
16 | }
17 |
18 | @property BOOL imageFrameEdited;
19 |
20 | @property (strong, nonatomic) UIImage *sourceImage;
21 | @property (strong, nonatomic) UIImage *adjustedImage;
22 |
23 | @property (strong, nonatomic) UIButton *firstSettingIcon;
24 | @property (strong, nonatomic) UIButton *secondSettingIcon;
25 | @property (strong, nonatomic) UIButton *thirdSettingIcon;
26 | @property (strong, nonatomic) UIButton *fourthSettingIcon;
27 |
28 | @property (strong, nonatomic) UIBarButtonItem *rotateButton;
29 |
30 | @property (strong, nonatomic) UIImageView *activityIndicator;
31 | @property (strong, nonatomic) UIActivityIndicatorView *progressIndicator;
32 |
33 | @property (strong, nonatomic) UIImageView *finalImageView;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/MAOpenCV.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAOpenCV.h
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/10/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface MAOpenCV : NSObject
12 |
13 | + (UIImage *)UIImageFromCVMat:(cv::Mat)cvMat;
14 |
15 | + (cv::Mat)cvMatFromAdjustedUIImage:(UIImage *)image;
16 | + (cv::Mat)cvMatFromUIImage:(UIImage *)image;
17 | + (cv::Mat)cvMatGrayFromUIImage:(UIImage *)image;
18 | + (cv::Mat)cvMatGrayFromAdjustedUIImage:(UIImage *)image;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/MAOpenCV.mm:
--------------------------------------------------------------------------------
1 | //
2 | // MAOpenCV.m
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/10/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import "MAOpenCV.h"
10 |
11 | @implementation MAOpenCV
12 |
13 | + (UIImage *)UIImageFromCVMat:(cv::Mat)cvMat
14 | {
15 | NSData *data = [NSData dataWithBytes:cvMat.data length:cvMat.elemSize() * cvMat.total()];
16 |
17 | CGColorSpaceRef colorSpace;
18 |
19 | if (cvMat.elemSize() == 1) {
20 | colorSpace = CGColorSpaceCreateDeviceGray();
21 | } else {
22 | colorSpace = CGColorSpaceCreateDeviceRGB();
23 | }
24 |
25 | CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);
26 |
27 | CGImageRef imageRef = CGImageCreate(cvMat.cols, // Width
28 | cvMat.rows, // Height
29 | 8, // Bits per component
30 | 8 * cvMat.elemSize(), // Bits per pixel
31 | cvMat.step[0], // Bytes per row
32 | colorSpace, // Colorspace
33 | kCGImageAlphaNone | kCGBitmapByteOrderDefault, // Bitmap info flags
34 | provider, // CGDataProviderRef
35 | NULL, // Decode
36 | false, // Should interpolate
37 | kCGRenderingIntentDefault); // Intent
38 |
39 | UIImage *image = [[UIImage alloc] initWithCGImage:imageRef];
40 | CGImageRelease(imageRef);
41 | CGDataProviderRelease(provider);
42 | CGColorSpaceRelease(colorSpace);
43 |
44 | return image;
45 | }
46 |
47 | + (cv::Mat)cvMatFromUIImage:(UIImage *)image
48 | {
49 | CGColorSpaceRef colorSpace = CGImageGetColorSpace(image.CGImage);
50 | CGFloat cols = image.size.height;
51 | CGFloat rows = image.size.width;
52 |
53 | cv::Mat cvMat(rows, cols, CV_8UC4); // 8 bits per component, 4 channels
54 |
55 | CGContextRef contextRef = CGBitmapContextCreate(cvMat.data, // Pointer to backing data
56 | cols, // Width of bitmap
57 | rows, // Height of bitmap
58 | 8, // Bits per component
59 | cvMat.step[0], // Bytes per row
60 | colorSpace, // Colorspace
61 | kCGImageAlphaNoneSkipLast |
62 | kCGBitmapByteOrderDefault);
63 |
64 | CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), image.CGImage);
65 | CGContextRelease(contextRef);
66 |
67 |
68 | cv::Mat cvMatTest;
69 | cv::transpose(cvMat, cvMatTest);
70 |
71 | cvMat.release();
72 |
73 | cv::flip(cvMatTest, cvMatTest, 1);
74 | return cvMatTest;
75 | }
76 |
77 | + (cv::Mat)cvMatFromAdjustedUIImage:(UIImage *)image
78 | {
79 | CGColorSpaceRef colorSpace = CGImageGetColorSpace(image.CGImage);
80 | CGFloat cols = image.size.width;
81 | CGFloat rows = image.size.height;
82 |
83 | cv::Mat cvMat(rows, cols, CV_8UC4); // 8 bits per component, 4 channels
84 |
85 | CGContextRef contextRef = CGBitmapContextCreate(cvMat.data, // Pointer to backing data
86 | cols, // Width of bitmap
87 | rows, // Height of bitmap
88 | 8, // Bits per component
89 | cvMat.step[0], // Bytes per row
90 | colorSpace, // Colorspace
91 | kCGImageAlphaNoneSkipLast |
92 | kCGBitmapByteOrderDefault);
93 |
94 | CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), image.CGImage);
95 | CGContextRelease(contextRef);
96 | return cvMat;
97 | }
98 |
99 | + (cv::Mat)cvMatGrayFromUIImage:(UIImage *)image
100 | {
101 | cv::Mat cvMat = [self cvMatFromUIImage:image];
102 | cv::Mat grayMat;
103 | if ( cvMat.channels() == 1 ) {
104 | grayMat = cvMat;
105 | }
106 | else {
107 | grayMat = cv :: Mat( cvMat.rows,cvMat.cols, CV_8UC1 );
108 | cv::cvtColor( cvMat, grayMat, CV_BGR2GRAY );
109 | }
110 | return grayMat;
111 | }
112 |
113 | + (cv::Mat)cvMatGrayFromAdjustedUIImage:(UIImage *)image
114 | {
115 | cv::Mat cvMat = [self cvMatFromAdjustedUIImage:image];
116 | cv::Mat grayMat;
117 | if ( cvMat.channels() == 1 ) {
118 | grayMat = cvMat;
119 | }
120 | else {
121 | grayMat = cv :: Mat( cvMat.rows,cvMat.cols, CV_8UC1 );
122 | cv::cvtColor( cvMat, grayMat, CV_BGR2GRAY );
123 | }
124 | return grayMat;
125 | }
126 |
127 | @end
128 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/UIImage+fixOrientation.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+fixOrientation.h
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/11/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIImage (fixOrientation)
12 |
13 | - (UIImage *)fixOrientation;
14 |
15 | @end
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/UIImage+fixOrientation.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+fixOrientation.m
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/11/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import "UIImage+fixOrientation.h"
10 |
11 | @implementation UIImage (fixOrientation)
12 |
13 | - (UIImage *)fixOrientation
14 | {
15 | UIImage *src = [[UIImage alloc] initWithCGImage: self.CGImage
16 | scale: 1.0
17 | orientation: UIImageOrientationRight];
18 |
19 | return src;
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/UIImageView+ContentFrame.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImageView+ContentFrame.h
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/6/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIImageView (UIImageView_ContentFrame)
12 |
13 | -(CGRect)contentFrame;
14 | - (CGFloat) contentScale;
15 | - (CGSize) contentSize;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/instaoverlay/MAImagePickerController/UIImageView+ContentFrame.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIImageView+ContentFrame.m
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/6/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 | // Credit: http://stackoverflow.com/questions/4711615/how-to-get-the-displayed-image-frame-from-uiimageview
9 |
10 | #import "UIImageView+ContentFrame.h"
11 |
12 | @implementation UIImageView (UIImageView_ContentFrame)
13 |
14 | - (CGRect) contentFrame
15 | {
16 | CGSize imageSize = self.image.size;
17 | CGFloat imageScale = fminf(CGRectGetWidth(self.bounds)/imageSize.width, CGRectGetHeight(self.bounds)/imageSize.height);
18 | CGSize scaledImageSize = CGSizeMake(imageSize.width*imageScale, imageSize.height*imageScale);
19 | CGRect imageFrame = CGRectMake(0.5f*(CGRectGetWidth(self.bounds)-scaledImageSize.width), 0.5f*(CGRectGetHeight(self.bounds)-scaledImageSize.height), scaledImageSize.width, scaledImageSize.height);
20 | return imageFrame;
21 | }
22 |
23 | - (CGSize) contentSize
24 | {
25 | CGSize imageSize = self.image.size;
26 | CGFloat imageScale = fminf(CGRectGetWidth(self.bounds)/imageSize.width, CGRectGetHeight(self.bounds)/imageSize.height);
27 | CGSize finalSize = CGSizeMake(imageSize.width*imageScale, imageSize.height*imageScale);
28 |
29 | return finalSize;
30 | }
31 |
32 | - (CGFloat) contentScale
33 | {
34 | CGSize imageSize = self.image.size;
35 | CGFloat imageScale = fminf(CGRectGetWidth(self.bounds)/imageSize.width, CGRectGetHeight(self.bounds)/imageSize.height);
36 | return imageScale;
37 | }
38 |
39 | @end
--------------------------------------------------------------------------------
/instaoverlay/MAViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAViewController.h
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/5/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "MAImagePickerController.h"
12 |
13 | @interface MAViewController : UIViewController
14 |
15 | - (IBAction)initButton:(id)sender;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/instaoverlay/MAViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // MAViewController.m
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/5/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import "MAViewController.h"
10 |
11 | @interface MAViewController ()
12 |
13 | @end
14 |
15 | @implementation MAViewController
16 |
17 | - (void)viewDidLoad
18 | {
19 | [super viewDidLoad];
20 | // Do any additional setup after loading the view, typically from a nib.
21 | }
22 |
23 | - (void)didReceiveMemoryWarning
24 | {
25 | [super didReceiveMemoryWarning];
26 | // Dispose of any resources that can be recreated.
27 | }
28 |
29 | - (IBAction)initButton:(id)sender
30 | {
31 | MAImagePickerController *imagePicker = [[MAImagePickerController alloc] init];
32 |
33 | [imagePicker setDelegate:self];
34 | [imagePicker setSourceType:MAImagePickerControllerSourceTypeCamera];
35 |
36 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:imagePicker];
37 |
38 | [self presentViewController:navigationController animated:YES completion:nil];
39 | }
40 |
41 | - (void)imagePickerDidCancel
42 | {
43 | [self dismissViewControllerAnimated:YES completion:nil];
44 | }
45 |
46 | - (void)imagePickerDidChooseImageWithPath:(NSString *)path
47 | {
48 | [self dismissViewControllerAnimated:YES completion:nil];
49 |
50 | if ([[NSFileManager defaultManager] fileExistsAtPath:path])
51 | {
52 | NSLog(@"File Found at %@", path);
53 |
54 | }
55 | else
56 | {
57 | NSLog(@"No File Found at %@", path);
58 | }
59 |
60 | [[NSFileManager defaultManager] removeItemAtPath:path error:nil];
61 | }
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/instaoverlay/camera-bottom-bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/camera-bottom-bar.png
--------------------------------------------------------------------------------
/instaoverlay/camera-bottom-bar@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/camera-bottom-bar@2x.png
--------------------------------------------------------------------------------
/instaoverlay/camera-button-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/camera-button-pressed.png
--------------------------------------------------------------------------------
/instaoverlay/camera-button-pressed@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/camera-button-pressed@2x.png
--------------------------------------------------------------------------------
/instaoverlay/camera-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/camera-button.png
--------------------------------------------------------------------------------
/instaoverlay/camera-button@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/camera-button@2x.png
--------------------------------------------------------------------------------
/instaoverlay/camera-grid-1136@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/camera-grid-1136@2x.png
--------------------------------------------------------------------------------
/instaoverlay/camera-grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/camera-grid.png
--------------------------------------------------------------------------------
/instaoverlay/camera-grid@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/camera-grid@2x.png
--------------------------------------------------------------------------------
/instaoverlay/close-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/close-button.png
--------------------------------------------------------------------------------
/instaoverlay/close-button@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/close-button@2x.png
--------------------------------------------------------------------------------
/instaoverlay/confirm-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/confirm-button.png
--------------------------------------------------------------------------------
/instaoverlay/confirm-button@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/confirm-button@2x.png
--------------------------------------------------------------------------------
/instaoverlay/crop-button-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/crop-button-icon.png
--------------------------------------------------------------------------------
/instaoverlay/crop-button-icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/crop-button-icon@2x.png
--------------------------------------------------------------------------------
/instaoverlay/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/instaoverlay/enhance-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/enhance-button.png
--------------------------------------------------------------------------------
/instaoverlay/enhance-button@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/enhance-button@2x.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-1-active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-1-active.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-1-active@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-1-active@2x.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-1.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-1@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-1@2x.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-2-active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-2-active.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-2-active@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-2-active@2x.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-2.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-2@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-2@2x.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-3-active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-3-active.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-3-active@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-3-active@2x.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-3.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-3@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-3@2x.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-4-active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-4-active.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-4-active@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-4-active@2x.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-4.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-4@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-4@2x.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-indicator-active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-indicator-active.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-indicator-active@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-indicator-active@2x.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-rotate.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-rotate@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-rotate@2x.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-tray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-tray.png
--------------------------------------------------------------------------------
/instaoverlay/f-setting-tray@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/f-setting-tray@2x.png
--------------------------------------------------------------------------------
/instaoverlay/flash-off-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/flash-off-button.png
--------------------------------------------------------------------------------
/instaoverlay/flash-off-button@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/flash-off-button@2x.png
--------------------------------------------------------------------------------
/instaoverlay/flash-on-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/flash-on-button.png
--------------------------------------------------------------------------------
/instaoverlay/flash-on-button@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/flash-on-button@2x.png
--------------------------------------------------------------------------------
/instaoverlay/instaoverlay-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | com.mackhag.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UIStatusBarHidden
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/instaoverlay/instaoverlay-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'instaoverlay' target in the 'instaoverlay' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_4_0
8 | #warning "This project uses features only available in iOS SDK 4.0 and later."
9 | #endif
10 |
11 | #ifdef __cplusplus
12 | #import
13 | #endif
14 |
15 | #ifdef __OBJC__
16 | #import
17 | #import
18 | #endif
--------------------------------------------------------------------------------
/instaoverlay/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // instaoverlay
4 | //
5 | // Created by Maximilian Mackh on 11/5/12.
6 | // Copyright (c) 2012 mackh ag. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "MAAppDelegate.h"
12 |
13 | int main(int argc, char *argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([MAAppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/instaoverlay/toolbar-icon-crop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/toolbar-icon-crop.png
--------------------------------------------------------------------------------
/instaoverlay/toolbar-icon-crop@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mmackh/MAImagePickerController-of-InstaPDF/6d2217455014118b87ec926c3c0a8597e3ad5797/instaoverlay/toolbar-icon-crop@2x.png
--------------------------------------------------------------------------------
/opencv2.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/A/Headers
--------------------------------------------------------------------------------
/opencv2.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/A/Resources
--------------------------------------------------------------------------------
/opencv2.framework/Versions/A/Headers/contrib/detection_based_tracker.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #if defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(ANDROID)
4 |
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | class DetectionBasedTracker
11 | {
12 | public:
13 | struct Parameters
14 | {
15 | int minObjectSize;
16 | int maxObjectSize;
17 | double scaleFactor;
18 | int maxTrackLifetime;
19 | int minNeighbors;
20 | int minDetectionPeriod; //the minimal time between run of the big object detector (on the whole frame) in ms (1000 mean 1 sec), default=0
21 |
22 | Parameters();
23 | };
24 |
25 | DetectionBasedTracker(const std::string& cascadeFilename, const Parameters& params);
26 | virtual ~DetectionBasedTracker();
27 |
28 | virtual bool run();
29 | virtual void stop();
30 | virtual void resetTracking();
31 |
32 | virtual void process(const cv::Mat& imageGray);
33 |
34 | bool setParameters(const Parameters& params);
35 | const Parameters& getParameters();
36 |
37 |
38 | typedef std::pair Object;
39 | virtual void getObjects(std::vector& result) const;
40 | virtual void getObjects(std::vector