├── LICENSE
├── README.md
├── iosGrabcut.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcuserdata
│ └── vk.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ ├── iosGrabcut.xcscheme
│ └── xcschememanagement.plist
├── iosGrabcut
├── AppDelegate.h
├── AppDelegate.m
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Base.lproj
│ └── LaunchScreen.storyboard
├── Bridge2OpenCV.h
├── Bridge2OpenCV.mm
├── CloverGrabCut.cpp
├── CloverGrabCut.h
├── CutoutImage.cpp
├── CutoutImage.h
├── CutoutImagePacking.cpp
├── CutoutImagePacking.h
├── DrawView.h
├── DrawView.m
├── DrawViewModel.h
├── DrawViewModel.m
├── ImageEditView.h
├── ImageEditView.m
├── Info.plist
├── KTOneFingerRotationGestureRecognizer.h
├── KTOneFingerRotationGestureRecognizer.m
├── RotateCutImageViewController.h
├── RotateCutImageViewController.m
├── UIImage+IF.h
├── UIImage+IF.m
├── ViewController.h
├── ViewController.m
└── main.m
├── iosGrabcutTests
├── Info.plist
└── iosGrabcutTests.m
├── iosGrabcutUITests
├── Info.plist
└── iosGrabcutUITests.m
└── opencv2.framework
├── Headers
├── Resources
├── Versions
├── A
│ ├── Headers
│ │ ├── calib3d
│ │ │ └── calib3d.hpp
│ │ ├── contrib
│ │ │ ├── contrib.hpp
│ │ │ ├── detection_based_tracker.hpp
│ │ │ ├── hybridtracker.hpp
│ │ │ ├── openfabmap.hpp
│ │ │ └── retina.hpp
│ │ ├── core
│ │ │ ├── affine.hpp
│ │ │ ├── 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
│ │ │ └── ios.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
│ │ │ ├── gpu.hpp
│ │ │ ├── nonfree.hpp
│ │ │ └── ocl.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
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 BoJiang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # iosGrabcut
2 | ios的抠图工具并存储图像
3 |
--------------------------------------------------------------------------------
/iosGrabcut.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/iosGrabcut.xcodeproj/xcuserdata/vk.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/iosGrabcut.xcodeproj/xcuserdata/vk.xcuserdatad/xcschemes/iosGrabcut.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
43 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
61 |
62 |
63 |
64 |
74 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
95 |
101 |
102 |
103 |
104 |
106 |
107 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/iosGrabcut.xcodeproj/xcuserdata/vk.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | iosGrabcut.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 54AD2A631BC4EB78006EC905
16 |
17 | primary
18 |
19 |
20 | 54AD2A7C1BC4EB78006EC905
21 |
22 | primary
23 |
24 |
25 | 54AD2A871BC4EB78006EC905
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/iosGrabcut/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // iosGrabcut
4 | //
5 | // Created by vk on 15/10/7.
6 | // Copyright © 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/iosGrabcut/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // iosGrabcut
4 | //
5 | // Created by vk on 15/10/7.
6 | // Copyright © 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 | #import "ViewController.h"
11 |
12 | @interface AppDelegate ()
13 |
14 | @end
15 |
16 | @implementation AppDelegate
17 |
18 |
19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
20 | // Override point for customization after application launch.
21 | ViewController *vc = [[ViewController alloc]init];
22 | UINavigationController *uinc = [[UINavigationController alloc] initWithRootViewController:vc];
23 | self.window = [[UIWindow alloc]initWithFrame:[ UIScreen mainScreen ].bounds];
24 | self.window.rootViewController = uinc;
25 | [self.window makeKeyAndVisible];
26 | return YES;
27 | }
28 |
29 | - (void)applicationWillResignActive:(UIApplication *)application {
30 | // 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.
31 | // 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.
32 | }
33 |
34 | - (void)applicationDidEnterBackground:(UIApplication *)application {
35 | // 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.
36 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
37 | }
38 |
39 | - (void)applicationWillEnterForeground:(UIApplication *)application {
40 | // 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.
41 | }
42 |
43 | - (void)applicationDidBecomeActive:(UIApplication *)application {
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 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
49 | }
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/iosGrabcut/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/iosGrabcut/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/iosGrabcut/Bridge2OpenCV.h:
--------------------------------------------------------------------------------
1 | //
2 | // bridge2OpenCV.h
3 | // cutImageIOS
4 | //
5 | // Created by vk on 15/8/24.
6 | // Copyright (c) 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @protocol Bridge2OpenCVDelegate
13 | -(void) resultImageReady:(UIImage *) sendImage;
14 | @end
15 |
16 | @interface Bridge2OpenCV : NSObject
17 | -(id) init;
18 | -(id) initWithImage:(UIImage *)setImage;
19 | -(void) setCalculateImage:(UIImage *)setImage andWindowSize:(CGSize) winSize;
20 | -(void) setDrawPoint:(NSMutableArray*)selectPoint andLineWidth:(int)lineWidth;
21 | -(void) setCreatPoint:(NSMutableArray*)selectPoint andLineWidth:(int)lineWidth;
22 | -(void) setDeletePoint:(NSMutableArray*)selectPoint andLineWidth:(int)lineWidth;
23 | -(UIImage *) getCutResult;
24 | -(NSMutableArray *) getMutableCutResult;
25 | -(void) resetAllMask;
26 | -(void) redoPoint;
27 | -(void) undoPoint;
28 |
29 | @property (nonatomic,weak) id delegate;
30 |
31 | @end
32 |
33 |
--------------------------------------------------------------------------------
/iosGrabcut/CloverGrabCut.h:
--------------------------------------------------------------------------------
1 | //
2 | // CloverGrabCut.h
3 | // opencv_test
4 | //
5 | // Created by vk on 15/9/6.
6 | // Copyright (c) 2015年 clover. All rights reserved.
7 | //
8 |
9 | #ifndef __opencv_test__CloverGrabCut__
10 | #define __opencv_test__CloverGrabCut__
11 |
12 | #include
13 | #include
14 | class CloverGrabCut
15 | {
16 | public:
17 | CloverGrabCut();
18 | ~CloverGrabCut();
19 | void setImage(cv::Mat imgMat);
20 | void processGrabCut(std::vector maskPoint, int lineWidth, cv::Mat &resultMaskMat, cv::Mat &resultColorMat);
21 |
22 | private:
23 | cv::Mat getFGByMask(cv::Mat mask);
24 | cv::Rect getMaskRct( cv::Mat maskMat );
25 | cv::Mat filterMaskAndMergeMat(cv::Mat srcMat, cv::Mat matStore, cv::Mat filterRuleMat);
26 | bool diffRect(cv::Rect r1, cv::Rect r2);
27 | //void showBit( cv::Mat gray, cv::Mat & out );
28 | cv::Mat mergeMat( cv::Mat mergeMat, cv::Mat mergeToMat, cv::Rect mergeRect );
29 | cv::Mat pointArray2MatWithLineWidth( std::vector selectPoint, int lineWidth, cv::Size matSize );
30 | void grabcutByMergeToMatAndMskMat(const cv::Mat mergeToMat ,const cv::Mat msk, cv::Mat & resultMaskMat, cv::Mat &resultColorMat);
31 | cv::Mat getBinMaskByMask(cv::Mat mask);
32 |
33 | void scaleImg( const cv::Mat srcMat, float scaleLevel, cv::Mat & dstMat);
34 |
35 | void deleteBlackIsland(const cv::Mat srcBitMat ,cv::Mat &dstBitMat);
36 | void filterImageForEdgeBlur(const cv::Mat imFrame,cv::Mat & outFrame);
37 | void filterImage(const cv::Mat imFrame,cv::Mat & outFrame);
38 | void checkGcut(cv::Mat & srcMat);
39 | private:
40 | cv::Mat _srcImgMat;
41 | cv::Mat _maskStoreMat;
42 |
43 | };
44 | #endif /* defined(__opencv_test__CloverGrabCut__) */
45 |
--------------------------------------------------------------------------------
/iosGrabcut/CutoutImage.h:
--------------------------------------------------------------------------------
1 | //
2 | // CutoutImage.h
3 | // opencv_test
4 | //
5 | // Created by vk on 15/8/11.
6 | // Copyright (c) 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #ifndef __opencv_test__CutoutImage__
10 | #define __opencv_test__CutoutImage__
11 |
12 | #include
13 | #include
14 | #include "CloverGrabCut.h"
15 |
16 | class CutoutImage{
17 | public:
18 | CutoutImage();
19 | ~CutoutImage();
20 | void processImageCreatMaskByGrabcut(std::vector mouseSlideRegionDiscrete , const cv::Mat srcMat, cv::Mat &dstMat , int lineWidth);
21 | void processImageCreatMask(std::vector mouseSlideRegionDiscrete , const cv::Mat srcMat, cv::Mat &dstMat , int lineWidth, int expandWidth ); //最后一个参数用于将生成的矩形向外扩展一些
22 | void processImageAddMask(std::vector mouseSlideRegionDiscrete , const cv::Mat srcMat, cv::Mat &dstMat , int lineWidth, const cv::Mat colorMatForShow ); //最后一个参数用于将生成的矩形向外扩展一些
23 | void processImageDeleteMask(std::vector mouseSlideRegionDiscrete , cv::Mat &seedStoreMat,const cv::Mat srcMat, cv::Mat &dstMat , int lineWidth );//seedmat将被修改,因为删除了部分内容
24 | void colorDispResultWithFullSeedMat( const cv::Mat picMat, const cv::Mat seedMat ); //需要这个函数用于外部debug
25 | void rotateMat (const cv::Mat srcMat ,cv::Mat &dstMat,const cv::Mat colorMat);
26 | cv::Mat getMergeResult();
27 | void edgeBlur( const cv::Mat colorMat, const cv::Mat maskMat, int parameter, cv::Mat &dstMat ); //边缘模糊与融合算法
28 |
29 | void getTestMat(cv::Mat &testMat,cv::Mat &testMat2);
30 | void setColorImg(cv::Mat colorImg);
31 | cv::Mat scaleFCMI2InputColorImageSize( const cv::Mat srcImg );
32 |
33 | public:
34 | cv::Mat classCutMat;
35 | cv::Mat classMergeMat;
36 | cv::Size inputColorImageSize;
37 |
38 | private:
39 | std::vector mouseSlideRegion; //鼠标按下滑动区域
40 | //删除mark需要的函数
41 | void deleteMatCreat(std::vector inPoint,cv::Size matSize, int lineWide ,cv::Mat &dstMat);
42 | void deleteMask(const cv::Mat deleteMat,cv::Mat &seedMat);
43 | //建立mark需要的函数
44 | bool regionGrowClover( const cv::Mat srcMat ,cv::Mat &dstMat, int initSeedx, int initSeedy, int threshold);
45 | bool regionGrowClover( const cv::Mat srcMat, const cv::Mat seedStoreMat ,cv::Mat &dstMat, int initSeedx, int initSeedy, int threshold);
46 | void drawLineAndMakePointSet(std::vector inPoint,cv::Size matSize,int lineWide,std::vector &pointSet);
47 | void mergeProcess(const cv::Mat srcImg,cv::Mat &dstImg);
48 | void filterImage(const cv::Mat imFrame,cv::Mat & outFrame);
49 | void filterImageForEdgeBlur(const cv::Mat imFrame,cv::Mat & outFrame);
50 | void rectRegionGrow( std::vector seedVector, cv::Point rectMatOrg, const cv::Mat srcMat, const cv::Mat seedStoreMat , cv::Mat &dstMat);
51 | void storeSeed(cv::Mat &storeSeedMat,cv::Mat currentSeedMat,cv::Point cseedMatAnchorPoint);
52 | void colorDispResult(const cv::Mat picMat, cv::Mat cutPicBitMat, cv::Point cutPicAnchorPoint , cv::Mat &mergeColorMat);
53 | void line2PointSet(const cv::Mat lineMat,std::vector &pointSet);
54 | void deleteBlackIsland(const cv::Mat srcBitMat ,cv::Mat &dstBitMat);
55 | void makeWhite2Black( const cv::Mat srcMat, cv::Mat &dstMat);
56 | void smoothContours(const cv::Mat srcMat ,const cv::Mat cutMat, int parameter, cv::Mat &dstMat ,cv::Mat &smoothMask);
57 | void smoothContoursAlphard(const cv::Mat srcMat ,const cv::Mat cutMat, int parameter, cv::Mat &dstMat); //暂不用
58 | void smoothContoursAngles( const std::vector> contoursIn, std::vector> &contoursOut ); //赞不用
59 | void filterImageEdgeAndBlurMerge ( const cv::Mat colorMat, const cv::Mat bitMat , cv::Mat &dstMat ); //暂不用
60 | void translucentEdge( const cv::Mat srcMat , const cv::Mat smoothMask, const cv::Mat liteMask, cv::Mat &dstMat );
61 | void cutImageByRect(const cv::Mat srcMat, cv::Rect cutRect,cv::Mat &dst);
62 |
63 | void point2LineMat( const cv::Mat drawMat, std::vector inPoint, int lineWide, cv::Mat &dstMat );//将输入的点转换为线,画在给定的画布MAT上
64 | float angleBetween(const cv::Point v1, const cv::Point v2);
65 |
66 | CloverGrabCut *_cloverGrabCut;
67 | cv::Mat cutMat1;
68 | cv::Mat cutMat2;
69 | };
70 | #endif /* defined(__opencv_test__CutoutImage__) */
71 |
--------------------------------------------------------------------------------
/iosGrabcut/CutoutImagePacking.h:
--------------------------------------------------------------------------------
1 | //
2 | // CutoutImagePacking.h
3 | // opencv_test
4 | //
5 | // Created by vk on 15/8/25.
6 | // Copyright (c) 2015年 leisheng526. All rights reserved.
7 | //
8 |
9 | #ifndef __opencv_test__CutoutImagePacking__
10 | #define __opencv_test__CutoutImagePacking__
11 |
12 | #include
13 | #include
14 | #include "CutoutImage.h"
15 |
16 | class CutoutImagePacking{
17 | public:
18 | CutoutImagePacking();
19 | ~CutoutImagePacking();
20 | void setColorImage(cv::Mat srcImg, int maxSeedMatNum); //设置要计算的彩色图
21 | void setMaskColor(cv::Scalar maskColor); //设置输出观测mask的颜色
22 |
23 | void drawMask( std::vector selectPoint, int lineWidth, cv::Mat & drawResult ); //直接添加mask不带任何分割算法
24 | void creatMask( std::vector selectPoint, int lineWidth, cv::Mat & drawResult ); //设置需要区域分割的点,输出计算后的融合结果
25 | void deleteMask( std::vector selectPoint, int lineWidth, cv::Mat & drawResult ); //在mask中删除添加选择点,输出计算后的融合结果
26 | void redo( cv::Mat & dstMat );
27 | void undo( cv::Mat & dtsMat );
28 | void resetMask( cv::Mat &dstMat ); //回复原始状态
29 |
30 | cv::Mat getCurrentBitMask(); //输出当前的结果的mask 输出的是8uc1的灰度图,255 有 mask 0 无mask
31 | cv::Mat getCurrenrColorMergeImg(); //输出当前的融合结果
32 | cv::Mat getFinalBitCutMask();
33 | cv::Mat getFinalColorMergeImg();
34 | //Debug接口
35 | cv::Mat getDebugMat();
36 | cv::Mat getDebugMat2();
37 |
38 | private:
39 | CutoutImage *cutoutImage;
40 | cv::Mat srcColorImg;
41 | cv::Mat srcGrayImg;
42 | std::vector seedMatVector;
43 | cv::Mat seedStoreMat;
44 | int selectSeedMat;
45 | int maxSelectSeedMat;
46 | cv::Scalar maskColor;
47 | cv::Mat getM1;
48 | cv::Mat getM2;
49 |
50 | };
51 |
52 |
53 | #endif /* defined(__opencv_test__CutoutImagePacking__) */
54 |
--------------------------------------------------------------------------------
/iosGrabcut/DrawView.h:
--------------------------------------------------------------------------------
1 | //
2 | // ImageShowView.h
3 | // cutImageIOS
4 | //
5 | // Created by vk on 15/8/31.
6 | // Copyright (c) 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol DrawViewDelegate
12 |
13 | -(void) setPointArray:(NSMutableArray *) pointArray andLineWide:(float) linaWidth;
14 |
15 | @end
16 |
17 |
18 | @interface DrawView: UIView
19 | -(id) initWithFrame:(CGRect)frame andIsCutImage:(BOOL)isCutImage;
20 | -(void) setPhotoImage:(UIImage *)setImage;
21 | -(void) setMove:(BOOL) isMove;
22 | -(void) redo;
23 | -(void) undo;
24 | -(void) resetDraw;
25 | //-(void) setLineScale:(float) scale;
26 | /**
27 | * 设置的线宽和颜色
28 | */
29 | @property (assign, nonatomic) CGFloat lineWidth;
30 | @property (strong, nonatomic) UIColor *lineColor;
31 | @property (nonatomic, assign) float lineScale;
32 | @property (nonatomic, weak) id delegate;
33 | @end
34 |
--------------------------------------------------------------------------------
/iosGrabcut/DrawViewModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // DrawViewModel.h
3 | // cutImageIOS
4 | //
5 | // Created by vk on 15/8/31.
6 | // Copyright (c) 2015年 Clover. All rights reserved.
7 | //
8 | #import
9 | #import
10 |
11 | @interface DrawViewModel : NSObject
12 |
13 | + (id)viewModelWithColor:(UIColor *)color Path:(UIBezierPath *)path Width:(CGFloat)width;
14 |
15 | @property (strong, nonatomic) UIColor *color;
16 |
17 | @property (strong, nonatomic) UIBezierPath *path;
18 |
19 | @property (assign, nonatomic) CGFloat width;
20 |
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/iosGrabcut/DrawViewModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // DrawViewModel.m
3 | // cutImageIOS
4 | //
5 | // Created by vk on 15/8/31.
6 | // Copyright (c) 2015年 Clover. All rights reserved.
7 | //
8 | #import "DrawViewModel.h"
9 |
10 | @implementation DrawViewModel
11 |
12 | + (id)viewModelWithColor:(UIColor *)color Path:(UIBezierPath *)path Width:(CGFloat)width
13 | {
14 | DrawViewModel *drawViewModel = [[DrawViewModel alloc] init];
15 |
16 | drawViewModel.color = color;
17 | drawViewModel.path = path;
18 | drawViewModel.width = width;
19 |
20 |
21 |
22 | return drawViewModel;
23 | }
24 | @end
--------------------------------------------------------------------------------
/iosGrabcut/ImageEditView.h:
--------------------------------------------------------------------------------
1 | //
2 | // ImageEditView.h
3 | // cutImageIOS
4 | //
5 | // Created by vk on 15/9/1.
6 | // Copyright (c) 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "DrawView.h"
11 | #import "Bridge2OpenCV.h"
12 |
13 | @interface ImageEditView : UIView
14 |
15 | -(id)initWithFrame:(CGRect)frame;
16 | -(void)setPicture:(UIImage *)setImage;
17 | -(void) setMove:(BOOL) isMove;
18 | -(void) redo;
19 | -(void) undo;
20 | -(void) setLineScale:(float) scale;
21 | -(void) resetAllMask;
22 | -(UIImage *)getReusltImage;
23 |
24 |
25 |
26 | @property (nonatomic) BOOL isMove; //移动时最好禁用其他操作
27 | @property (nonatomic) BOOL isDraw; //YES是直接画mark NO是添加生长点
28 | @property (nonatomic) BOOL isDelete; //YES则调用删除点,NO是再判断上面的Draw
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/iosGrabcut/ImageEditView.m:
--------------------------------------------------------------------------------
1 | //
2 | // ImageEditView.m
3 | // cutImageIOS
4 | //
5 | // Created by vk on 15/9/1.
6 | // Copyright (c) 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #import "ImageEditView.h"
10 | #import "UIImage+IF.h"
11 |
12 | @interface ImageEditView()
13 | /**
14 | * 画图用View
15 | */
16 | @property(nonatomic, strong) DrawView *drawView;
17 | /**
18 | * 显示图片用View
19 | */
20 | @property(nonatomic, strong) UIImageView *pictureImage;
21 | /**
22 | * 算法模块
23 | */
24 | @property (nonatomic, strong) Bridge2OpenCV *b2opcv;
25 | /**
26 | 线程queue
27 | */
28 | @property (nonatomic, strong) dispatch_queue_t imageProcessQueue;
29 |
30 | @end
31 |
32 | @implementation ImageEditView
33 |
34 | -(id)initWithFrame:(CGRect)frame
35 | {
36 | if(self = [super initWithFrame:frame])
37 | {
38 | self.drawView = [[DrawView alloc]initWithFrame:frame andIsCutImage:YES];
39 | self.pictureImage = [[UIImageView alloc]initWithFrame:frame];
40 |
41 | self.pictureImage.backgroundColor = [UIColor blackColor];
42 | self.drawView.backgroundColor = [UIColor clearColor];
43 |
44 | self.b2opcv = [[Bridge2OpenCV alloc]init];
45 | self.b2opcv.delegate = self;
46 | self.drawView.delegate = self;
47 |
48 | UIImage *imageInit = [UIImage imageWithColor:self.pictureImage.backgroundColor andRect:CGRectMake(0, 0, self.pictureImage.frame.size.width, self.pictureImage.frame.size.width)];
49 | [self.b2opcv setCalculateImage:imageInit andWindowSize:self.frame.size];
50 |
51 | self.isMove = NO;
52 | self.isDraw = NO; //默认是添加
53 | self.isDelete = NO;
54 |
55 | self.imageProcessQueue = dispatch_queue_create("com.clover.cutImageIOS", NULL);
56 |
57 | [self addSubview:self.pictureImage];
58 | [self addSubview:self.drawView];
59 | }
60 | return self;
61 | }
62 |
63 | -(void)setPicture:(UIImage *)setImage
64 | {
65 | //NSLog(@"view sW = %f",self.frame.size.width);
66 | //NSLog(@"view sH = %f",self.frame.size.height);
67 | [self.b2opcv setCalculateImage:setImage andWindowSize:self.frame.size];
68 | [self.drawView setPhotoImage:setImage];
69 | self.pictureImage.image = setImage;
70 | }
71 |
72 | -(void) setMove:(BOOL) isMove
73 | {
74 | [self.drawView setMove:isMove];
75 | }
76 |
77 | -(void) redo
78 | {
79 | [self.b2opcv redoPoint];
80 | // [self.drawView redo];
81 | }
82 |
83 | -(void) undo
84 | {
85 | [self.b2opcv undoPoint];
86 | // [self.drawView undo];
87 | }
88 |
89 | -(void) setLineScale:(float) scale
90 | {
91 | //[self.drawView setLineScale:scale];
92 | self.drawView.lineScale = 1/scale;
93 | }
94 |
95 | -(void) resetAllMask
96 | {
97 | [self.b2opcv resetAllMask];
98 | // [self.drawView resetDraw];
99 | }
100 |
101 | -(void) resultImageReady:(UIImage *)sendImage
102 | {
103 | dispatch_async(dispatch_get_main_queue(), ^{
104 | self.pictureImage.image = sendImage;
105 | });
106 | }
107 |
108 | -(UIImage *)getReusltImage
109 | {
110 | UIImage * resultImg = [self.b2opcv getCutResult];
111 | return resultImg;
112 | }
113 |
114 |
115 | -(void) setPointArray:(NSMutableArray *) pointArray andLineWide:(float) linaWidth;
116 | {
117 | //dispatch_async(dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{
118 | dispatch_async(self.imageProcessQueue, ^{
119 | if(self.isDelete){
120 | [self.b2opcv setDeletePoint:pointArray andLineWidth:linaWidth*2];
121 | }
122 | else{
123 | if (self.isDraw) {
124 | [self.b2opcv setDrawPoint:pointArray andLineWidth:linaWidth*2];
125 | }
126 | else{
127 | [self.b2opcv setCreatPoint:pointArray andLineWidth:linaWidth*2];
128 | }
129 | }
130 | });
131 | }
132 |
133 | /*
134 | // Only override drawRect: if you perform custom drawing.
135 | // An empty implementation adversely affects performance during animation.
136 | - (void)drawRect:(CGRect)rect {
137 | // Drawing code
138 | }
139 | */
140 |
141 | @end
142 |
--------------------------------------------------------------------------------
/iosGrabcut/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/iosGrabcut/KTOneFingerRotationGestureRecognizer.h:
--------------------------------------------------------------------------------
1 | //
2 | // KTOneFingerRotationGestureRecognizer.h
3 | //
4 | // Created by Kirby Turner on 4/22/11.
5 | // Copyright 2011 White Peak Software Inc. All rights reserved.
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 | //
26 |
27 | #import
28 |
29 |
30 | @interface KTOneFingerRotationGestureRecognizer : UIGestureRecognizer
31 | {
32 |
33 | }
34 |
35 | @property (nonatomic, assign) CGFloat rotation;
36 | /**
37 | The rotation of the gesture in radians since its last change.
38 | */
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/iosGrabcut/KTOneFingerRotationGestureRecognizer.m:
--------------------------------------------------------------------------------
1 | //
2 | // KTOneFingerRotationGestureRecognizer.m
3 | //
4 | // Created by Kirby Turner on 4/22/11.
5 | // Copyright 2011 White Peak Software Inc. All rights reserved.
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 | //
26 |
27 | #import "KTOneFingerRotationGestureRecognizer.h"
28 | #import
29 |
30 | @interface KTOneFingerRotationGestureRecognizer()
31 | @end
32 |
33 | @implementation KTOneFingerRotationGestureRecognizer
34 |
35 | //@synthesize rotation = rotation_;
36 | //@synthesize rotation = rotation_;
37 |
38 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
39 | {
40 | // Fail when more than 1 finger detected.
41 | if ([[event touchesForGestureRecognizer:self] count] > 1) {
42 | [self setState:UIGestureRecognizerStateFailed];
43 | }
44 | }
45 |
46 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
47 | {
48 | if ([self state] == UIGestureRecognizerStatePossible) {
49 | [self setState:UIGestureRecognizerStateBegan];
50 | } else {
51 | [self setState:UIGestureRecognizerStateChanged];
52 | }
53 |
54 | // We can look at any touch object since we know we
55 | // have only 1. If there were more than 1 then
56 | // touchesBegan:withEvent: would have failed the recognizer.
57 | UITouch *touch = [touches anyObject];
58 |
59 | // To rotate with one finger, we simulate a second finger.
60 | // The second figure is on the opposite side of the virtual
61 | // circle that represents the rotation gesture.
62 |
63 | UIView *view = [self view];
64 | CGPoint center = CGPointMake(CGRectGetMidX([view bounds]), CGRectGetMidY([view bounds]));
65 | CGPoint currentTouchPoint = [touch locationInView:view];
66 | CGPoint previousTouchPoint = [touch previousLocationInView:view];
67 |
68 | CGFloat angleInRadians = atan2f(currentTouchPoint.y - center.y, currentTouchPoint.x - center.x) - atan2f(previousTouchPoint.y - center.y, previousTouchPoint.x - center.x);
69 |
70 | self.rotation = angleInRadians;
71 | //[self setRotation:angleInRadians];
72 | }
73 |
74 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
75 | {
76 | // Perform final check to make sure a tap was not misinterpreted.
77 | if ([self state] == UIGestureRecognizerStateChanged) {
78 | [self setState:UIGestureRecognizerStateEnded];
79 | } else {
80 | [self setState:UIGestureRecognizerStateFailed];
81 | }
82 | }
83 |
84 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
85 | {
86 | [self setState:UIGestureRecognizerStateFailed];
87 | }
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/iosGrabcut/RotateCutImageViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // RotateCutImageViewController.h
3 | // cutImageIOS
4 | //
5 | // Created by vk on 15/9/9.
6 | // Copyright (c) 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface RotateCutImageViewController : UIViewController
12 |
13 | -(void) setImageRect:(CGRect) setRect andImage:(UIImage *)setImage;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/iosGrabcut/UIImage+IF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+IF.h
3 | // InstaFilters
4 | //
5 | // Created by Di Wu on 2/29/12.
6 | // Copyright (c) 2012 twitter:@diwup. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIImage (IF)
12 |
13 | - (UIImage *)cropImageWithBounds:(CGRect)bounds;
14 | - (UIImage *)imageRotatedByDegrees:(CGFloat)degrees;
15 | - (UIImage *)resizedImage:(CGSize)newSize interpolationQuality:(CGInterpolationQuality)quality;
16 | - (UIImage *)resizedImage:(CGSize)newSize
17 | transform:(CGAffineTransform)transform
18 | drawTransposed:(BOOL)transpose
19 | interpolationQuality:(CGInterpolationQuality)quality;
20 | - (CGAffineTransform)transformForOrientation:(CGSize)newSize;
21 |
22 | + (UIImage *)imageWithColor:(UIColor *)color andRect:(CGRect)setRect;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/iosGrabcut/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // iosGrabcut
4 | //
5 | // Created by vk on 15/10/7.
6 | // Copyright © 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/iosGrabcut/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // iosGrabcut
4 | //
5 | // Created by vk on 15/10/7.
6 | // Copyright © 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/iosGrabcutTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/iosGrabcutTests/iosGrabcutTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // iosGrabcutTests.m
3 | // iosGrabcutTests
4 | //
5 | // Created by vk on 15/10/7.
6 | // Copyright © 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface iosGrabcutTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation iosGrabcutTests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 | // Put setup code here. This method is called before the invocation of each test method in the class.
20 | }
21 |
22 | - (void)tearDown {
23 | // Put teardown code here. This method is called after the invocation of each test method in the class.
24 | [super tearDown];
25 | }
26 |
27 | - (void)testExample {
28 | // This is an example of a functional test case.
29 | // Use XCTAssert and related functions to verify your tests produce the correct results.
30 | }
31 |
32 | - (void)testPerformanceExample {
33 | // This is an example of a performance test case.
34 | [self measureBlock:^{
35 | // Put the code you want to measure the time of here.
36 | }];
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/iosGrabcutUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/iosGrabcutUITests/iosGrabcutUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // iosGrabcutUITests.m
3 | // iosGrabcutUITests
4 | //
5 | // Created by vk on 15/10/7.
6 | // Copyright © 2015年 Clover. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface iosGrabcutUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation iosGrabcutUITests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 |
22 | // In UI tests it is usually best to stop immediately when a failure occurs.
23 | self.continueAfterFailure = NO;
24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
25 | [[[XCUIApplication alloc] init] launch];
26 |
27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
28 | }
29 |
30 | - (void)tearDown {
31 | // Put teardown code here. This method is called after the invocation of each test method in the class.
32 | [super tearDown];
33 | }
34 |
35 | - (void)testExample {
36 | // Use recording to get started writing UI tests.
37 | // Use XCTAssert and related functions to verify your tests produce the correct results.
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/opencv2.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/opencv2.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/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