简体   繁体   中英

How to use mediapipe to detect static image in ios

i can run the mediapipe example ios app,but i have a question is:How to use mediapipe to detect static image in ios. if u how to do,please tell me,think u


///this is a demo for check face static image 
UIImage *faceImage = [UIImage imageNamed:@"faceImage.jpeg"];
UIImageView *bgView = [[UIImageView alloc] initWithImage:faceImage];
bgView.frame = CGRectMake(0, 0, faceImage.size.width, faceImage.size.height);
bgView.center = self.view.center;
[self.view insertSubview:bgView aboveSubview:self.liveView];

UIImageView *bgView1 = [[UIImageView alloc] init];
bgView1.frame = CGRectMake(0, CGRectGetMaxY(bgView.frame) + 20, self.view.frame.size.width, 200);
[self.view insertSubview:bgView1 aboveSubview:self.liveView];

CVPixelBufferRef buffer = [self pixelBufferFromCGImage:faceImage.CGImage];
///but this function not work
mediapipe::Packet packet = [self.mediapipeGraph imagePacketWithPixelBuffer:buffer];

mediapipe::Image image = packet.Get<mediapipe::Image>();
CVPixelBufferRef pixelBufferOut = image.GetCVPixelBufferRef();
bgView1.image = [self convert:pixelBufferOut];

i solve it,if u meet same problem, look this: https://github.com/lxm1799/FaceMediapipe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM