You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
private SKBitmap MatToSkBitmap(Mat mat)
{
int width = mat.Cols;
int height = mat.Rows;
int bytesPerRow = mat.Cols * 3; // 3 bytes per pixel for BGR
// Create SKBitmap with the same size and color type
SKBitmap skBitmap = new SKBitmap(width, height);
// Get the bitmap's pixel data pointer
IntPtr skBitmapData = skBitmap.GetPixels();
// Copy data from Mat to SKBitmap
unsafe
{
byte* matData = (byte*)mat.DataPointer;
byte* skBitmapDataPtr = (byte*)skBitmapData.ToPointer();
for (int row = 0; row < height; row++)
{
// Copy one row of pixels from Mat to SKBitmap
System.Buffer.MemoryCopy(
matData + row * bytesPerRow,
skBitmapDataPtr + row * bytesPerRow,
bytesPerRow,
bytesPerRow
);
}
}
return skBitmap;
}
The text was updated successfully, but these errors were encountered:
private SKBitmap MatToSkBitmap(Mat mat)
{
int width = mat.Cols;
int height = mat.Rows;
int bytesPerRow = mat.Cols * 3; // 3 bytes per pixel for BGR
}
The text was updated successfully, but these errors were encountered: