lxy 1 year ago
parent
commit
77749dc694

+ 3 - 3
Example/LenzCameraNativeModuleForRN.xcodeproj/project.pbxproj

@@ -229,7 +229,7 @@
 				ORGANIZATIONNAME = "76930516@qq.com";
 				TargetAttributes = {
 					6003F589195388D20070C39A = {
-						DevelopmentTeam = 67B22KAY34;
+						DevelopmentTeam = DM78Y577MV;
 					};
 					6003F5AD195388D20070C39A = {
 						TestTargetID = 6003F589195388D20070C39A;
@@ -460,7 +460,7 @@
 			baseConfigurationReference = 81A8808FD3706FAD151017C8 /* Pods-LenzCameraNativeModuleForRN_Example.debug.xcconfig */;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				DEVELOPMENT_TEAM = 67B22KAY34;
+				DEVELOPMENT_TEAM = DM78Y577MV;
 				ENABLE_BITCODE = NO;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "LenzCameraNativeModuleForRN/LenzCameraNativeModuleForRN-Prefix.pch";
@@ -480,7 +480,7 @@
 			baseConfigurationReference = 47F785DCE1254FC6EEB075B7 /* Pods-LenzCameraNativeModuleForRN_Example.release.xcconfig */;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				DEVELOPMENT_TEAM = 67B22KAY34;
+				DEVELOPMENT_TEAM = DM78Y577MV;
 				ENABLE_BITCODE = NO;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "LenzCameraNativeModuleForRN/LenzCameraNativeModuleForRN-Prefix.pch";

+ 7 - 0
Example/LenzCameraNativeModuleForRN.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:">
+   </FileRef>
+</Workspace>

+ 8 - 0
Example/LenzCameraNativeModuleForRN.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IDEDidComputeMac32BitWarning</key>
+	<true/>
+</dict>
+</plist>

+ 1 - 0
Example/Pods/Headers/Private/LenzSDK/YYAnimatedImageView+YYDisplayLayer.h

@@ -0,0 +1 @@
+../../../../../LenzCameraNativeModuleForRN/Classes/inner/UI/UIView+tool/YYAnimatedImageView+YYDisplayLayer.h

+ 71 - 30
LenzCameraNativeModuleForRN/Classes/inner/PCSBaseViewController/PCSBaseViewController.m

@@ -3124,33 +3124,73 @@
 
             if (self.isVideoStitchStopedWhenRecording &&
                 (self.stitchResult != LenVideoStitchResultFail && self.stitchResult != LenVideoStitchResultStitchFail)) {
-                [self updateViewStatusWhenStitchSave:YES];
-                self.isStitchBigImage = YES;
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    if (self.stitchView.hidden) {
+                        [self updateViewStatusWhenStitchSave:YES];
+                        self.isStitchBigImage = YES;
+                    }
+                });
             }
             LenVideoStitchDirction dirction = LenVideoStitchDirctionLeft;
             if (self.panoramOrientationGuideView.selectedItemIndex == PanoramaOrientationViewUp) {
-                if (self.currentTgDirection == TgDirectionDown) {
+//                if (self.currentTgDirection == TgDirectionDown) {
+//                    dirction = LenVideoStitchDirctionDown;
+//                } else {
+//                    dirction = LenVideoStitchDirctionUp;
+//                }
+                if (self.currentTgDirection == TgDirectionPortrait) {
+                    dirction = LenVideoStitchDirctionUp;
+                } else if (self.currentTgDirection == TgDirectionDown) {
                     dirction = LenVideoStitchDirctionDown;
+                } else if (self.currentTgDirection == TgDirectionLeft) {
+                    dirction = LenVideoStitchDirctionRight;
                 } else {
-                    dirction = LenVideoStitchDirctionUp;
+                    dirction = LenVideoStitchDirctionLeft;
                 }
             } else if (self.panoramOrientationGuideView.selectedItemIndex == PanoramaOrientationViewDown) {
-                if (self.currentTgDirection == TgDirectionDown) {
+//                if (self.currentTgDirection == TgDirectionDown) {
+//                    dirction = LenVideoStitchDirctionUp;
+//                } else {
+//                    dirction = LenVideoStitchDirctionDown;
+//                }
+                if (self.currentTgDirection == TgDirectionPortrait) {
+                    dirction = LenVideoStitchDirctionDown;
+                } else if (self.currentTgDirection == TgDirectionDown) {
                     dirction = LenVideoStitchDirctionUp;
+                } else if (self.currentTgDirection == TgDirectionLeft) {
+                    dirction = LenVideoStitchDirctionLeft;
                 } else {
-                    dirction = LenVideoStitchDirctionDown;
+                    dirction = LenVideoStitchDirctionRight;
                 }
             } else if (self.panoramOrientationGuideView.selectedItemIndex == PanoramaOrientationViewLeft) {
-                if (self.currentTgDirection == TgDirectionDown) {
+//                if (self.currentTgDirection == TgDirectionDown) {
+//                    dirction = LenVideoStitchDirctionRight;
+//                } else {
+//                    dirction = LenVideoStitchDirctionLeft;
+//                }
+                if (self.currentTgDirection == TgDirectionPortrait) {
+                    dirction = LenVideoStitchDirctionLeft;
+                } else if (self.currentTgDirection == TgDirectionDown) {
                     dirction = LenVideoStitchDirctionRight;
+                } else if (self.currentTgDirection == TgDirectionLeft) {
+                    dirction = LenVideoStitchDirctionUp;
                 } else {
-                    dirction = LenVideoStitchDirctionLeft;
+                    dirction = LenVideoStitchDirctionDown;
                 }
             } else if (self.panoramOrientationGuideView.selectedItemIndex == PanoramaOrientationViewRight) {
-                if (self.currentTgDirection == TgDirectionDown) {
+//                if (self.currentTgDirection == TgDirectionDown) {
+//                    dirction = LenVideoStitchDirctionLeft;
+//                } else {
+//                    dirction = LenVideoStitchDirctionRight;
+//                }
+                if (self.currentTgDirection == TgDirectionPortrait) {
+                    dirction = LenVideoStitchDirctionRight;
+                } else if (self.currentTgDirection == TgDirectionDown) {
                     dirction = LenVideoStitchDirctionLeft;
+                } else if (self.currentTgDirection == TgDirectionLeft) {
+                    dirction = LenVideoStitchDirctionDown;
                 } else {
-                    dirction = LenVideoStitchDirctionRight;
+                    dirction = LenVideoStitchDirctionUp;
                 }
             } else {
                 dirction = LenVideoStitchDirctionAny;
@@ -3161,7 +3201,6 @@
                                   isStop:self.isVideoStitchStopedWhenRecording
                                 complete:^(LenVideoStitchResult result, LenVideoStitchNeedSave needSave) {
                 self.stitchResult = result;
-                
                 UIImage *image = [LenStitcher getCurrentPanoramaShowImage];
                 UIImage *saveImage = [self rotateImageWith:image];
                 base.stitchResult = result;
@@ -3182,26 +3221,28 @@
                 } else {
  
                     if (!base.isRecording && self.isVideoStitchStopedWhenRecording) {
-                        //停止拼接,移除保存中 非success数据
-                        if (self.mode == SDK_CAPTURE_MODE_PANORAMA) {
-                            NSMutableArray *array = [NSMutableArray array];
-                            [self.resourceModel.panoramArray enumerateObjectsUsingBlock:^(LenzResourceItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
-                                if (obj.path.length) {
-                                    [array addObject:obj];
-                                }
-                            }];
-                            self.resourceModel.panoramArray = array;
-                        } else if (self.mode == SDK_CAPTURE_MODE_INTELLEGENCE_PANORAMA) {
-                            NSMutableArray *array = [NSMutableArray array];
-                            [self.resourceModel.aiPanoramArray enumerateObjectsUsingBlock:^(LenzResourceItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
-                                if (obj.path.length) {
-                                    [array addObject:obj];
-                                }
-                            }];
-                            self.resourceModel.aiPanoramArray = array;
+                        if (result == LenVideoStitchResultFail || result == LenVideoStitchResultStitchFail) {
+                            //停止拼接,移除保存中 非success数据
+                            if (self.mode == SDK_CAPTURE_MODE_PANORAMA) {
+                                NSMutableArray *array = [NSMutableArray array];
+                                [self.resourceModel.panoramArray enumerateObjectsUsingBlock:^(LenzResourceItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
+                                    if (obj.path.length) {
+                                        [array addObject:obj];
+                                    }
+                                }];
+                                self.resourceModel.panoramArray = array;
+                            } else if (self.mode == SDK_CAPTURE_MODE_INTELLEGENCE_PANORAMA) {
+                                NSMutableArray *array = [NSMutableArray array];
+                                [self.resourceModel.aiPanoramArray enumerateObjectsUsingBlock:^(LenzResourceItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
+                                    if (obj.path.length) {
+                                        [array addObject:obj];
+                                    }
+                                }];
+                                self.resourceModel.aiPanoramArray = array;
+                            }
+                            [self updateViewStatusWhenStitchSave:NO];
+                            [self updateViewStatus];
                         }
-                        [self updateViewStatusWhenStitchSave:NO];
-                        [self updateViewStatus];
                         [self.stitchkLock unlock];
                         return;
                     }

+ 3 - 4
LenzStitchSDK.framework/Headers/LenStitcher.h

@@ -20,10 +20,9 @@ typedef NS_ENUM(NSInteger, LenVideoStitchResult) {
     LenVideoStitchResultSuccess,         //1: 视频拼接成功
     LenVideoStitchResultSlowMore,       // 2:特征点变少,放慢速度
     LenVideoStitchResultSlow,          //3 : 特征点极少,即将失败
-    LenVideoStitchResultDirectError, // 4:当前拍摄固定了方向,请勿往反方向移动
-    LenVideoStitchResultModerate,   // 5:请减速拍摄
-    LenVideoStitchResultParallel,  // 6:请正对目标物平行拍摄
-
+    LenVideoStitchResultModerate,     // 4 :请减速拍摄
+    LenVideoStitchResultParallel,     // 5: 正对目标拍摄
+    LenVideoStitchResultDirectError, // 当前拍摄固定了方向,请勿往反方向移动
 };
 
 typedef NS_ENUM(NSInteger, LenVideoStitchNeedSave) {

+ 0 - 4
LenzStitchSDK.framework/Headers/lenz_stitch_jni.hpp

@@ -32,8 +32,6 @@
  *          2: 特征点变少,放慢速度
  *          3: 特征点极少,即将失败
  *          4:当前拍摄固定了方向,请勿往反方向移动
- *          5:请减速拍摄
- *          6:请正对目标物平行拍摄
  *       是否需要存图:
  *          0:不需要
  *          1:需要
@@ -48,8 +46,6 @@ const char* getTestCurrentPanoramaShow(void);
 
 cv::Mat getCurrentPanoramsShowMat(void);
 
-
-
 #endif
 
 

+ 0 - 141
LenzStitchSDK.framework/Headers/lenz_stitcher.hpp

@@ -1,141 +0,0 @@
-//
-//  lenz_stitcher.hpp
-//  LenzCameraNativeModuleForRN
-//
-//  Created by lr on 2023/2/8.
-//
-
-#ifndef lenz_stitcher_hpp
-#define lenz_stitcher_hpp
-
-#if __cplusplus && __has_include(<opencv2/imgcodecs/ios.h>)
-
-#import <opencv2/core/ocl.hpp>
-#import <opencv2/opencv.hpp>
-
-#include <iostream>
-#include <thread>
-#include <vector>
-#include <string>
-#include <random>
-#include <math.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-using namespace cv;
-using namespace cv::detail;
-using namespace cv::ocl;
-using namespace std;
-
-#define STITCH_STATUS_INIT 0
-#define STITCH_STATUS_CHECKING 1
-#define STITCH_STATUS_STITCHING 2
-#define STITCH_STATUS_FREE 3
-#define STITCH_STATUS_FAILED 4
-
-#define FEATURE_HEIGHT 300
-#define STITCH_HEIGHT 300
-#define BIG_STITCH_HEIGHT 1000
-#define BIG_FEATURE_HEIGHT 800
-
-#define MAX_SIZE 4000      // 缩略图的最大尺寸,长或宽都不能超过MAX_SIZE*MAX_SIZE,否则直接报错
-#define BIG_MAX_SIZE 10000 // 拼接大图的最大尺寸, 长或宽都不能超过BIG_MAX_SIZE
-
-struct stitch_data
-{
-    Mat scaled_gray_frame;
-    float work_scale;
-    vector<Point2f> good_keypoints;
-    Mat descriptors;
-    Mat homo = (Mat_<double>(3, 3) << 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0); // store homography matrix to base image
-    Mat base_homo = (Mat_<double>(3, 3) << 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0); // store homography matrix to last base image
-};
-
-struct LinePara
-{
-    float k;
-    float b;
-};
-
-string test_image_path = "";
-
-class LenzStitcher
-{
-public:
-    string task_id = "";
-    string local_path = "";
-    int stitcher_status = STITCH_STATUS_INIT; // 0: initialized, 1: checking, 2: stitching, 3: free
-
-    int failed_count = 0;  // 当前连续失败的帧数
-    int failed_thresh = 10; // 连续5帧失败才返回失败
-    vector<float> last_move_distances; // 记录存下来的最近10帧的移动距离,算均值,大于阈值的时候提示速度过快
-
-    float iou_thresh = 0.7;  // iou低于该阈值的时候把这张图片存下来
-    float area_thresh = 0.5; // area threshold for green box
-    float angle_thresh = 10; // angle threshold for green box
-    float inline_thresh = 0.1; // 光流法匹配的点的比例至少要大于这个值,才认为是正确的映射矩阵
-    int matches_thresh = 10; // 前后两帧基于光流的匹配点的个数的阈值,低于该值则无法进行拼接
-    float check_match_conf = 0.2f;
-    int frame_index = 0;
-    vector<Point2f> last_warp_points; // 上一张存下来的图的四个点在拼接图上的坐标
-    int big_frame_index = 0;          // 存下来的帧的信息
-    float total_shift_x = 0;
-    float total_shift_y = 0;
-
-    Mat last_frame;
-    Mat last_stitch_image = Mat(); // 最后一张拼接缩略图
-    int last_direction = 0;        // 上一帧的手机移动方向
-    vector<float> last_angles = vector<float>{90, 90, 90, 90};
-    vector<float> last_scales = vector<float>{1, 1, 1, 1};
-    string last_stitch_image_path = ""; // 拼接缩略图的本地路径
-    stitch_data last_check_data;        // 上一帧的数据
-    string big_stitch_image_path = "";  // 拼接大图的本地路径
-
-    string test_image_path = ""; // test
-
-    LenzStitcher(string input_id);
-    int *ofcheck_stitch(Mat &frame, int const direction, int const is_last_one); // 输入每一帧实时产生拼接缩略图
-
-    bool get_big_image(int get_big_image); // 在收到当前帧是最后一帧的时候运行,会用之前存下来的帧数据产生最后的拼接大图
-    void remove_local_path();
-};
-
-bool is_good_homo(const vector<Point2f> &corners, const Mat &frame, float area_thresh, float angle_thresh);
-bool is_convex(const vector<Point2f> &corners);
-float calc_area(const vector<Point2f> &corners, const Mat &frame);
-float min_axis(vector<float> input_list);
-float max_axis(vector<float> input_list);
-float calc_angle(const vector<cv::Point2f> &conners);
-float calc_vangle(const vector<cv::Point2f> &conners);
-float calc_hangle(const vector<cv::Point2f> &conners);
-void double_match(const Mat &query_des, const Mat &train_des, vector<DMatch> &good_matches, float check_match_conf);
-void single_match(const Mat &query_des, const Mat &train_des, vector<DMatch> &good_matches, float check_match_conf);
-void getFilePath(const char *path, const char *filename, char *filepath);
-void deleteFile(const char *path);
-bool isFloderexit(const char *path);
-void randomSelectKeyPoints(vector<KeyPoint> kpts, vector<Point2f> &pts, int max_num);
-void optimizeSeam(Mat &last_img, Mat &stitched_image, vector<Point2f> &corners);
-void getLinePara(float x1, float y1, float x2, float y2, LinePara &LP);
-float point_2_line(float k, float b, float k2, float x, float y);
-int get_direction(vector<Point2f> &frame_corners, vector<Point2f> &transpose_corners);
-float get_move_distance(vector<Point2f> &frame_center, vector<Point2f> &transpose_center);
-int dcmp(float x);
-float cross(Point2f a, Point2f b, Point2f c);
-float CPIA(vector<Point2f> a, vector<Point2f> b, int na, int nb);
-float SPIA(vector<Point2f> a, vector<Point2f> b, int na, int nb);
-Point2f get_intersection_point(Point2f a, Point2f b, Point2f c, Point2f d);
-float PolygonArea(vector<Point2f> p, int n);
-float single_quadrangle_iou(vector<Point2f> pts1, vector<Point2f> pts2);
-float single_box_iou(vector<Point2f> pts1, vector<Point2f> pts2);
-void stitch_big_image(Mat frame, vector<float> angles, vector<float> scales, int direction, int big_frame_index);
-void cylindrical_projection(Mat &img, Mat &output, float angle);
-void SphericalProjection(Mat& imgMat, Mat& output, float angle);
-void fill_contours(vector<vector<Point>> contours, Mat &source_image, Mat &target_image);
-float angle_of_two_vector(Point2f &pt1, Point2f &pt2, Point2f &c);
-void calc_angles(vector<Point2f> &conners);
-
-#endif
-
-#endif

BIN
LenzStitchSDK.framework/Info.plist


BIN
LenzStitchSDK.framework/LenzStitchSDK


BIN
LenzStitchSDK.framework/_CodeSignature/CodeDirectory


BIN
LenzStitchSDK.framework/_CodeSignature/CodeRequirements


BIN
LenzStitchSDK.framework/_CodeSignature/CodeRequirements-1


+ 7 - 22
LenzStitchSDK.framework/_CodeSignature/CodeResources

@@ -6,7 +6,7 @@
 	<dict>
 		<key>Headers/LenStitcher.h</key>
 		<data>
-		w3j4zB8oGG58XPUsYdQYf0uMO14=
+		Z9ixfHAAn3JIUWP40X+ZoOtZVEE=
 		</data>
 		<key>Headers/LenzStitchSDK.h</key>
 		<data>
@@ -14,15 +14,11 @@
 		</data>
 		<key>Headers/lenz_stitch_jni.hpp</key>
 		<data>
-		oNFxw7ug2R8C17ir9Km6LzTGSuA=
-		</data>
-		<key>Headers/lenz_stitcher.hpp</key>
-		<data>
-		Ni+lJR/qcMiOIZUNH/QZIU+qXFI=
+		BiWMBnP4j0+CuhQUrzL60L65CHc=
 		</data>
 		<key>Info.plist</key>
 		<data>
-		n6WyF8fk/Dh5HVNvsEvKPMpuN2Y=
+		LSUjpnRzDiXqIOtmD4Oig8zNPsQ=
 		</data>
 		<key>Modules/module.modulemap</key>
 		<data>
@@ -35,11 +31,11 @@
 		<dict>
 			<key>hash</key>
 			<data>
-			w3j4zB8oGG58XPUsYdQYf0uMO14=
+			Z9ixfHAAn3JIUWP40X+ZoOtZVEE=
 			</data>
 			<key>hash2</key>
 			<data>
-			5VC7boy3NUMKDT9SimGmVjB+OwsOGrxftWjFB0vOhec=
+			vwFTRUHWsUP+CKxIhrIJrfRTiqXhCpRrtd/ihBY2Sb0=
 			</data>
 		</dict>
 		<key>Headers/LenzStitchSDK.h</key>
@@ -57,22 +53,11 @@
 		<dict>
 			<key>hash</key>
 			<data>
-			oNFxw7ug2R8C17ir9Km6LzTGSuA=
-			</data>
-			<key>hash2</key>
-			<data>
-			1oaSfT9ERNb+tD11tDtQuMyTO7NkGjzSqBEMilJjJ8Q=
-			</data>
-		</dict>
-		<key>Headers/lenz_stitcher.hpp</key>
-		<dict>
-			<key>hash</key>
-			<data>
-			Ni+lJR/qcMiOIZUNH/QZIU+qXFI=
+			BiWMBnP4j0+CuhQUrzL60L65CHc=
 			</data>
 			<key>hash2</key>
 			<data>
-			un0w274O7ySRTuYBwD3Wz0m+vPagWRU6COSjW5RkCp4=
+			XXLOZB3e0u9OU3Qqoad7mMTT7hgvQcpE4kDHoqMrF0A=
 			</data>
 		</dict>
 		<key>Modules/module.modulemap</key>

BIN
LenzStitchSDK.framework/_CodeSignature/CodeSignature