Reputation: 1
I'm trying to write simple program to get image from astronomy camera, image data is read as object{int[,]} according to this doc: ASCOM.DriverAccess.Camera.ImageArray
To display and convert this data to image I want to convert it to 2D int array. Could someone help me how to do this? Or maybe it's better, simpler way to convert this image object array to image...
Upvotes: 0
Views: 115
Reputation: 81563
What you seemingly have is a SafeArray
.
The application must inspect the Safearray parameters to determine the dimensions.
You may be able to do this
Array ct = (Array)SomeFunkyArrayTypeYouGet;
int[,] content = new int[ct.GetUpperBound(0), ct.GetUpperBound(1)];
ct.CopyTo(content, 0);
Note : I have not tested this, nor confident it will work, it's based on a result I found with a quick web search
Upvotes: 0