[Mono-osx] StillMotion Sample - Issues

Sergio Estevao sergioestevao at gmail.com
Sun Jan 2 18:32:00 EST 2011


Hi,

I'm trying to change the StillMotion sample to grab frames in a different
PixelFormat and resolution and I'm using the following code:

decompressedVideo.PixelBufferAttributes = NSDictionary.FromObjectsAndKeys(
    new NSObject [] { new NSNumber(320), new NSNumber(240), new NSNumber(24)
},
    new NSObject [] { new NSString("Width"), new NSString("Height"), new
NSString("PixelFormatType")});


This code when used in the original Cocoa StillMotion sample works perfectly
and changes the resolution of the grabbed frames to 320x240 and the pixel
format to 24 bits RGB.

Am I doing something wrong or there is some problem in the biding? As you
can for the pixelFormat options the constants available in Cocoa are not
available in MonoMac is this a problem?

In the same sample I'm trying to convert CVImageBuffer to
System.Drawing.Bitmap instead of a NSImage, 
I'm using the following code

delegate(object sender, QTCaptureVideoFrameEventArgs e) {
					currentImage = e.VideoFrame;

					if (currentImage == null)
						return;

					var img = CIImage.FromImageBuffer (currentImage);
					NSBitmapImageRep imageRep = new NSBitmapImageRep(img);
			
					var bitmap = new Bitmap(imageRep.PixelsWide, imageRep.PixelsHigh, 
					                        imageRep.BytesPerRow,
                                            PixelFormat.Format24bppRgb,
imageRep.BitmapData);
				    // Debug: Save the image as a JPEG.
				        bitmap.Save("/a.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
			};


Is this the best/fastest way of doing it? Is there any other method?

Thanks,

Sérgio
-- 
View this message in context: http://mono.1490590.n4.nabble.com/StillMotion-Sample-Issues-tp3171375p3171375.html
Sent from the Mono - OSX mailing list archive at Nabble.com.


More information about the Mono-osx mailing list