TensorFlowWrapper.m 839 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // TensorFlowWrapper.m
  3. // LenzCameraNativeModuleForRN
  4. //
  5. // Created by 王昭威 on 2023/1/29.
  6. //
  7. #import "TensorFlowWrapper.h"
  8. @implementation TensorFlowWrapper
  9. @synthesize tensorFlow = _tensorFlow;
  10. - (BOOL)remake:(CVPixelBufferRef)buffer image:(UIImage *)image{
  11. id tensorFlow = [[TensorFlowWrapper alloc] init].tensorFlow;
  12. if(tensorFlow == nil){
  13. NSLog(@"load tensor flow failed");
  14. return NO;
  15. }
  16. NSNumber *remake = [tensorFlow performSelector:@selector(remake:) withObject:(__bridge id)(buffer)];
  17. float value = [remake floatValue];
  18. NSLog(@"remake:value:%@",remake);
  19. return value > 0.8;
  20. }
  21. - (id)tensorFlow {
  22. if (!_tensorFlow) {
  23. Class tfClass = NSClassFromString(@"LenzTensorFlow");
  24. _tensorFlow = [[tfClass alloc] init];
  25. }
  26. return _tensorFlow;
  27. }
  28. @end