Note that there are some explanatory texts on larger screens.

plurals
  1. POCouldn't capture overlay image
    primarykey
    data
    text
    <p>I have 3 images. I load one by one to camera overlay image. Then i need to take snapshot. But when i click button it take snapshot of particular image. When i put imageName.png in captureStillImageWithOverlay it take snapshot of that image only, it won't taking other images when present in overlay</p> <p>Button click code:</p> <pre><code>- (void)ButtonPressed { [[self captureManager] captureStillImageWithOverlay:[UIImage imageNamed:@"img2.png"]]; } </code></pre> <p>Load images:</p> <pre><code>-(void)loadNextPage:(int)index { int countFlag=0; for(int i=index*4;i&lt;(index+1)*4;i++) { UIButton *imageView=[[UIButton alloc]initWithFrame:CGRectMake((320*index)+countFlag*80+ 2, 5, 75, 75)]; imageView.tag=i+1; [imageView addTarget:self action:@selector(imageViewClicked:) forControlEvents:UIControlEventTouchUpInside]; [imageView.layer setBorderColor:[UIColor lightGrayColor].CGColor]; [imageView.layer setBorderWidth:1.0f]; switch ((i+1)%5) { case 0: [imageView setImage:[UIImage imageNamed:@"img1.png"] forState:UIControlStateNormal]; break; case 1: [imageView setImage:[UIImage imageNamed:@"img2.png"] forState:UIControlStateNormal]; break; case 2: [imageView setImage:[UIImage imageNamed:@"img3.png"] forState:UIControlStateNormal]; break; } [myScrollView addSubview:imageView]; [imageView release]; countFlag++; } } </code></pre> <p>Capture overlay image:</p> <pre><code>- (void)captureStillImageWithOverlay:(UIImage*)overlay { AVCaptureConnection *videoConnection = nil; for (AVCaptureConnection *connection in [[self stillImageOutput] connections]) { for (AVCaptureInputPort *port in [connection inputPorts]) { if ([[port mediaType] isEqual:AVMediaTypeVideo]) { videoConnection = connection; break; } } if (videoConnection) { break; } } NSLog(@"about to request a capture from: %@", [self stillImageOutput]); [[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler:^(CMSampleBufferRef imageSampleBuffer, NSError *error) { CFDictionaryRef exifAttachments = CMGetAttachment(imageSampleBuffer, kCGImagePropertyExifDictionary, NULL); if (exifAttachments) { NSLog(@"attachements: %@", exifAttachments); } else { NSLog(@"no attachments"); } NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer]; UIImage *image = [[UIImage alloc] initWithData:imageData]; CGSize imageSize = [image size]; CGSize overlaySize = [overlay size]; UIGraphicsBeginImageContext(imageSize); [image drawInRect:CGRectMake(0, 0, imageSize.width, imageSize.height)]; CGFloat xScaleFactor = imageSize.width / 320; CGFloat yScaleFactor = imageSize.height / 480; [overlay drawInRect:CGRectMake(30 * xScaleFactor, 100 * yScaleFactor, overlaySize.width * xScaleFactor, overlaySize.height * yScaleFactor)]; // rect used in AROverlayViewController was (30,100,260,200) UIImage *combinedImage = UIGraphicsGetImageFromCurrentImageContext(); [self setStillImage:combinedImage]; UIGraphicsEndImageContext(); [image release]; [[NSNotificationCenter defaultCenter] postNotificationName:kImageCapturedSuccessfully object:nil]; }]; } </code></pre> <p>I take the reference from this url <a href="http://www.musicalgeometry.com/?p=1681" rel="nofollow">[http://www.musicalgeometry.com/?p=1681]</a> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload