ArgumentException

  • 66 Views
  • Last Post 21 June 2018
jedarc posted this 19 June 2018

In the following code snippet:

var imageStream = new ReadStream(myByteArrayFile); 
var image = imageTools.OpenImageFileFromStream(imageStream); 

if (improveQuality) 
{ 
     for (var pageIndex = 0; pageIndex < image.PagesCount; pageIndex++) 
     { 
           var page = image.OpenImagePage(pageIndex); 
           page = imageTools.RemoveNoise(page, null); 
           // Image quality improvements ... 
      } 
} 

 When attempting to execute the RemoveNoise() method, the following exception is being thrown:

System.ArgumentException: Arguments check failed. Expected: _sourceImage->GetInternalImageFormat() == Image::IIF_RGB    
at FCEngine.IImageProcessingTools.RemoveNoise(IImage Image, IDenoiseFilterParams Params)

 I would like to know the possible reasons why this exception is being thrown, and how to circumvent it.

Daria Zvereva posted this 21 June 2018

Hello!

The RemoveNoise method of the ImageProcessingTools object can be used for color images only. Kindly check the article API Reference→Objects→Image-Related Objects→ImageProcessingTools→RemoveNoise in the Developer’s Help for more details. Please make sure you are trying to preprocess the color image (not black-and-white). 

Please note that some methods require images of the specific color type. You can check this in the Developer’s Help if necessary.  

Hope the information will be helpful!

 

Close