我正在做一個WPF應用程序,其中一個功能是記錄來自Kinect傳感器(使用Aforge和SDK 1.5)的視頻(僅RGB流)。記錄來自Kinect傳感器的RGB流
在我的應用程序中,我有一個按鈕,單擊時,它應該將視頻流保存到avi文件中。
我已經添加了引用,我複製所有.dll文件到我的項目文件夾(如被其他論壇上解釋),但某些原因,我收到此錯誤:
{"Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.":null}
所以裏面private void button4_Click(object sender, RoutedEventArgs e)
是下面的代碼:
int width = 640;
int height = 480;
// create instance of video writer
VideoFileWriter writer = new VideoFileWriter();
// create new video file
writer.Open("test.avi", width, height, 25, VideoCodec.MPEG4);
// create a bitmap to save into the video file
Bitmap image = new Bitmap (width, height, DrawingColor.PixelFormat.Format24bppRgb);
for (int i = 0; i < 1000; i++)
{
image.SetPixel(i % width, i % height, Color.Red);
writer.WriteVideoFrame(image);
}
writer.Close();
}
我會非常感謝你的幫助,也爲Im靈活的記錄RGB流的方式(如果你推薦另一種方式),只要一個它並不複雜,因爲即時通訊新的C#
你可能想看看這個 - http://stackoverflow.com/questions/3179028/mixed-mode-assembly-in-net -4 - 在您的案例中,您引用的程序集中的一個是本機/管理的混合程序集,必須在運行時爲其編譯。 –
[我問谷歌,它告訴我該怎麼做](https://www.google.com/search?q=Mixed+mode+assembly+is+built+against+version&oq=Mixed+mode+assembly+is+建立+對+版本&sugexp =鉻,mod = 13&sourceid = chrome&ie = UTF-8) – Reniuz
@AndrasZoltan非常感謝,它的工作。我再也沒有得到這個錯誤,我實際上可以找到視頻文件,但它只是一堆紅線,而不是實際的RGB流。任何想法?謝了哥們! – user1632904