0
votes

I am trying to save a large image (2048 x 2048 pixels) from a C# software to the filesystem using the emgu cv library:

var mat = new Mat( pathToFile, ImreadModes.GrayScale );
mat.Save( "imagename.png" );

The second line of the code snippet throws an exception with the message

System.ArgumentException: Parameter is not valid. at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, Int32 stride, PixelFormat format, IntPtr scan0)

I found out, that the size of the image can be a problem, when the save() function creates a bitmap.

What other possibilites do you suggest, to save the Mat-image onto the filesystem?

Note that I the Image is not already stored in the filesystem as my code snippet implies. I am receiving it from a camera.

1
I don't think the image size is your problem. I had no trouble saving an image of the size in a test on my computer. - Anders
@AndersJørgensen You were right. See my answer below. - Blackbriar

1 Answers

0
votes

In fact the problem was not the size of the image. Before saving the image, some strange settings were made to the camera what made all taken pictures unreadable. Now it works.