In EmguCV 3.1.X (installed from Nuget) with the non-commercial license I had this code, which I got from here and which worked fine:
public static dynamic GetValue(this UMat mat, int row, int col)
{
var value = CreateElement(mat.Depth);
Marshal.Copy(mat.ToMat(AccessType.Read).DataPointer + (row * mat.Cols + col) * mat.ElementSize, value, 0, 1);
return value[0];
}
I now want to switch to the commercial version of EmguCV 3.3.X (installed from Nuget) and therefore had to change this code into:
public static dynamic GetValue(this UMat mat, int row, int col)
{
var value = CreateElement(mat.Depth);
Marshal.Copy(mat.GetMat(AccessType.Read).DataPointer + (row * mat.Cols + col) * mat.ElementSize, value, 0, 1);
return value[0];
}
For no apparent reason, this code hangs without exception or anything on the line:
Marshal.Copy(mat.GetMat(AccessType.Read).DataPointer + (row * mat.Cols + col) * mat.ElementSize, value, 0, 1);
Am I doing something wrong or could this be bug in EmguCV?