LENZViewController.m 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. //
  2. // ViewController.m
  3. // Demo
  4. //
  5. // Created by lr on 2023/2/1.
  6. //
  7. #import "LENZViewController.h"
  8. #import <AVFoundation/AVFoundation.h>
  9. #import <Photos/Photos.h>
  10. #import <Masonry/Masonry.h>
  11. #import <MobileCoreServices/MobileCoreServices.h>
  12. //#import "LenzTensorFlow.h"
  13. @interface LENZViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>
  14. @property (nonatomic) UIImagePickerController *imagePickerVc;
  15. @property (nonatomic) UIButton *takeButton;
  16. //@property (nonatomic) LenzTensorFlow *tensor;
  17. @property (nonatomic) UILabel *resultLabel;
  18. @property (nonatomic) UILabel *remakeLabel;
  19. @property (nonatomic) UITextView *textView;
  20. @property (nonatomic) UIButton *photoButton;
  21. @end
  22. @implementation LENZViewController
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. [self.navigationController setNavigationBarHidden:YES animated:NO];
  26. self.view.backgroundColor = [UIColor whiteColor];
  27. self.photoButton = [[UIButton alloc]init];
  28. self.photoButton.backgroundColor = [UIColor grayColor];
  29. [self.photoButton setTitle:@"打开相机" forState:UIControlStateNormal];
  30. [self.photoButton addTarget:self action:@selector(photoAction) forControlEvents:UIControlEventTouchUpInside];
  31. [self.view addSubview:self.photoButton];
  32. [self.photoButton mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.centerX.mas_equalTo(self.view);
  34. make.bottom.mas_offset(-80);
  35. make.width.mas_offset(80);
  36. make.height.mas_offset(44);
  37. }];
  38. self.textView = [[UITextView alloc]init];
  39. self.textView.backgroundColor = [UIColor lightGrayColor];
  40. [self.view addSubview:self.textView];
  41. [self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.left.mas_offset(20);
  43. make.right.mas_offset(-20);
  44. make.top.mas_offset(50);
  45. make.bottom.mas_equalTo(self.photoButton.mas_top).mas_offset(-50);
  46. }];
  47. }
  48. - (void)photoAction {
  49. // {
  50. // "cameraMode": [{
  51. // "flashMode": "auto",
  52. // "isRemake": true,
  53. // "mode": "continuous",
  54. // "quality": 100,
  55. // "type": "back"
  56. // }, {
  57. // "flashMode": "auto",
  58. // "isRemake": true,
  59. // "mode": "single",
  60. // "quality": 100,
  61. // "type": "back"
  62. // }, {
  63. // "flashMode": "auto",
  64. // "isRemake": true,
  65. // "mode": "video",
  66. // "quantity": 0,
  67. // "recTime": 30,
  68. // "type": "back",
  69. // "videoQuality": 480
  70. // }, {
  71. // "flashMode": "auto",
  72. // "isRemake": true,
  73. // "mode": "parnorama",
  74. // "type": "back",
  75. // "videoQuality": 480
  76. // }],
  77. // "dataRetainedMode": "retain"
  78. // }
  79. self.textView.text = nil;
  80. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  81. dict[@"dataRetainedMode"] = @"retain";
  82. NSArray *array = @[@{@"flashMode": @"auto", @"isRemake":@(1),@"mode":@"continuous", @"quality":@(100),@"type":@"back" },
  83. @{@"flashMode": @"auto", @"isRemake":@(1),@"mode":@"single", @"quality":@(100),@"type":@"back" },
  84. @{@"flashMode": @"auto", @"isRemake":@(1),@"mode":@"video", @"quality":@(100),@"type":@"back", @"videoQuality":@(1080)},
  85. @{@"flashMode": @"auto", @"isRemake":@(1),@"mode":@"panorama", @"quality":@(100),@"type":@"back", @"videoQuality":@(1080)},
  86. @{@"flashMode": @"auto", @"isRemake":@(1),@"mode":@"panoramaPlus", @"quality":@(100),@"type":@"back", @"videoQuality":@(480)}];
  87. dict[@"cameraMode"] = array;
  88. // dict[@"flashMode"] = @"auto";
  89. // dict[@"type"] = @"back";
  90. // dict[@"videoQuality"] = @(720);
  91. // dict[@"recTime"] = @(100);
  92. // dict[@"keyframe"] = @(1);
  93. // [LenzCameraSDK showCameraSDKWithParams:dict presentVC:self complete:^(NSDictionary * _Nonnull dict) {
  94. // NSError *error;
  95. // NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict
  96. // options:NSJSONWritingSortedKeys
  97. // error:&error];
  98. // NSString *jsonString;
  99. // if (!jsonData) {
  100. // NSLog(@"%@",error);
  101. // } else {
  102. // jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
  103. // }
  104. // self.textView.text = jsonString;
  105. // }];
  106. }
  107. @end