BitmapExtensionAsBitmapTColor, TDepth Method |
http://www.emgu.com
Provide a more efficient way to convert Image<Gray, Byte>, Image<Bgr, Byte> and Image<Bgra, Byte> into Bitmap
such that the image data is shared with Bitmap.
If you change the pixel value on the Bitmap, you change the pixel values on the Image object as well!
For other types of image this property has the same effect as ToBitmap()
Take extra caution not to use the Bitmap after the Image object is disposed
Namespace:
Emgu.CV
Assemblies:
Emgu.CV.Platform.NetCore (in Emgu.CV.Platform.NetCore.dll) Version: 4.3.0.3890
Emgu.CV.Platform.NetFramework (in Emgu.CV.Platform.NetFramework.dll) Version: 4.3.0.3890 (4.3.0.3890)
Syntaxpublic static Bitmap AsBitmap<TColor, TDepth>(
this Image<TColor, TDepth> image
)
where TColor : struct, new(), IColor
where TDepth : new()
<ExtensionAttribute>
Public Shared Function AsBitmap(Of TColor As {Structure, New, IColor}, TDepth As New) (
image As Image(Of TColor, TDepth)
) As Bitmap
public:
[ExtensionAttribute]
generic<typename TColor, typename TDepth>
where TColor : value class, gcnew(), IColor
where TDepth : gcnew()
static Bitmap^ AsBitmap(
Image<TColor, TDepth>^ image
)
[<ExtensionAttribute>]
static member AsBitmap :
image : Image<'TColor, 'TDepth> -> Bitmap when 'TColor : struct, new() and IColor when 'TDepth : new()
Parameters
- image
- Type: Emgu.CVImageTColor, TDepth
The image to create Bitmap from
Type Parameters
- TColor
- The color of the image
- TDepth
- The depth of the image
Return Value
Type:
BitmapA bitmap representation of the image. In the cases of Image<Gray, Byte>, Image<Bgr, Byte> and Image<Bgra, Byte>, the image data is shared between the Bitmap and the Image object.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
ImageTColor,
TDepth. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also