mail-archives/mono-osx/2011-January/003855.html

108 строки
4.0 KiB
HTML
Исходник Постоянная ссылка Обычный вид История

2019-06-06 22:05:17 +03:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-osx] StillMotion Sample - Issues
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20StillMotion%20Sample%20-%20Issues&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="003562.html">
<LINK REL="Next" HREF="003856.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-osx] StillMotion Sample - Issues</H1>
<B>Sergio Estevao</B>
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20StillMotion%20Sample%20-%20Issues&In-Reply-To="
TITLE="[Mono-osx] StillMotion Sample - Issues">sergioestevao at gmail.com
</A><BR>
<I>Sun Jan 2 18:32:00 EST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="003562.html">[Mono-osx] Suggestions for standard naming of &quot;numberOf...&quot; methods
</A></li>
<LI>Next message: <A HREF="003856.html">[Mono-osx] newbie question
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3855">[ date ]</a>
<a href="thread.html#3855">[ thread ]</a>
<a href="subject.html#3855">[ subject ]</a>
<a href="author.html#3855">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>
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(&quot;Width&quot;), new NSString(&quot;Height&quot;), new
NSString(&quot;PixelFormatType&quot;)});
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(&quot;/a.jpg&quot;, System.Drawing.Imaging.ImageFormat.Jpeg);
};
Is this the best/fastest way of doing it? Is there any other method?
Thanks,
S&#233;rgio
--
View this message in context: <A HREF="http://mono.1490590.n4.nabble.com/StillMotion-Sample-Issues-tp3171375p3171375.html">http://mono.1490590.n4.nabble.com/StillMotion-Sample-Issues-tp3171375p3171375.html</A>
Sent from the Mono - OSX mailing list archive at Nabble.com.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="003562.html">[Mono-osx] Suggestions for standard naming of &quot;numberOf...&quot; methods
</A></li>
<LI>Next message: <A HREF="003856.html">[Mono-osx] newbie question
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#3855">[ date ]</a>
<a href="thread.html#3855">[ thread ]</a>
<a href="subject.html#3855">[ subject ]</a>
<a href="author.html#3855">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
mailing list</a><br>
</body></html>