cocoaimagequartz-composerisight

Using QCView and iSight to capture image


I have a QCView that loads a Quartz file which gives you iSights feedback (basically like a QTCaptureView)

Everything displays fine

The button simply takes a snapshot using the following simple lines of code

- (void)takePicture:(id)sender {NSImage *currentImage = [outputView valueForOutputKey:@"ImageOutput"];
[[currentImage TIFFRepresentation] writeToFile:@"/Users/hendo13/Desktop/capture.tiff" atomically:NO];}

The exported image however has some very wonky colouring issues like so: http://kttns.org/gjhnj

No filters of any sort have been applied. Does anyone know what is causing this?


Solution

  • It's inverted. You can use the CIInvert filter to correct it (assuming there's no way to correct the actual output of the QC view).

    Oh, and I think the blue and green alpha channels are the wrong way around, too (possibly an endianness problem?). If you go with the CIInvert solution, you can use CIColorMatrix to rearrange the channels, swapping blue and green back to their proper places. Here's a tutorial I wrote for it—I wrote it for the user interface in Core Image Fun House, but using it programmatically shouldn't be too hard once you understand how the filter works.