有没有一种方法使用GPU(显卡)调整的形象是消耗品通过.NET应用程序?
Is there a way to resize an image using GPU (graphic card) that is consumable through a .NET application?
我要寻找一个非常高性能的方式来调整图像,并听说GPU能比CPU要快得多(使用C#GDI +)。是否有使用GPU来调整,我可以消耗.NET图像称为实现或样品code?
I am looking for an extremely performant way to resize images and have heard that the GPU could do it much quicker than CPU (GDI+ using C#). Are there known implementations or sample code using the GPU to resize images that I could consume in .NET?
你有没有想过使用XNA来调整图片大小? 在这里你可以找到如何使用XNA来的图像保存为PNG / JPEG到一个MemoryStream和以后重新使用位图对象:
Have you thought about using XNA to resize your images? Here you can find out how to use XNA to save image as a png/jpeg to a MemoryStream and later reuse it a Bitmap object:
编辑:我会后你该怎样来使用XNA这里的一个例子(从上面的链接采取的)
I will post an example here (taken from the link above) on how you can possibly use XNA.
public static Image Texture2Image(Texture2D texture)
{
Image img;
using (MemoryStream MS = new MemoryStream())
{
texture.SaveAsPng(MS, texture.Width, texture.Height);
//Go To the beginning of the stream.
MS.Seek(0, SeekOrigin.Begin);
//Create the image based on the stream.
img = Bitmap.FromStream(MS);
}
return img;
}
我也发现了今天,你可以OpenCV的使用GPU /多核CPU。例如,您可以选择使用.NET包装,如 Emgu 并与使用它的Image类操纵你的照片并返回一个.NET Bitmap类:
I also found out today that you can OpenCV to use GPU/multicore CPUs. You can for example choose to use a .NET wrapper such as Emgu and and use its Image class to manipulate with your picture and return a .NET Bitmap class:
public static Bitmap ResizeBitmap(Bitmap sourceBM, int width, int height)
{
// Initialize Emgu Image object
Image<Bgr, Byte> img = new Image<Bgr, Byte>(sourceBM);
// Resize using liniear interpolation
img.Resize(width, height, INTER.CV_INTER_LINEAR);
// Return .NET Bitmap object
return img.ToBitmap();
}
上一篇:显示一个Android传感器列表传感器、列表、Android
下一篇:工具栏在AppBarLayout是滚动的,虽然RecyclerView有没有足够的内容来滚动没有足够、工具栏、内容、RecyclerView