Free Support Forum - aspose.com

How to change window size s in BinarizeBradley method?

Hi everyone,

how can I change the window size s of the BinarizeBradley method?

https://apireference.aspose.com/net/imaging/aspose.imaging/rastercachedimage/methods/binarizebradley

I want to experiment with smaller / bigger window sizes.

Kind regards,
AllMiku

@AllMiku,

I suggest you to please try using following example code on your end in order to explore the property.

string inputFile = @"D:\examples\input\1dicomEtalon.dicom";
            string outputFile = @"D:\examples\output\bradley.bmp";
            using (DicomImage image = new DicomImage(inputFile))
            {
                image.BinarizeBradley(10);
                image.Save(outputFile, new BmpOptions());
            }

        string inputFile = @"D:\examples\input\1dicomEtalon.dicom";
        string outputFile = @"D:\examples\output\Fixed.bmp";
        using (DicomImage image = new DicomImage(inputFile))
        {
            image.BinarizeFixed(100);
            image.Save(outputFile, new BmpOptions());
        }


        string inputFile = @"D:\examples\input\1dicomEtalon.dicom";
        string outputFile = @"D:\examples\output\otsu.bmp";
        using (DicomImage image = new DicomImage(inputFile))
        {
            image.BinarizeOtsu();
            image.Save(outputFile, new BmpOptions());
        }

@mudassir.fayyaz
thank you for your response!

But I don’t see where I can adjust the window size s of the BinarizeBradley Method? The parameter 10 that you are passing to BinarizeBradley is the brightnessDifference, not the window size s.

The window size s is also mentioned in the docs, but it looks like that it can not be changed?

Kindly,
AllMiku

@AllMiku,

I have observed the requirements and have not been able to completely understand it. Can you please share the detailed requirement in the form of sample image so that we may investigate that to help you further.

My requirement does not involve a sample image. It’s a general question: Is it possible to change the window size s in the BinarizeBradley method?

  1. Go to the Aspose Documentation of the Binarize Bradley Method:
    https://apireference.aspose.com/net/imaging/aspose.imaging/rastercachedimage/methods/binarizebradley
  2. You can read: “The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.”
  3. I want to know: can I change the size of this s x s window? If yes, how?

@AllMiku,

I have observed your requirements and regret to share that at present the requested support is unavailable in API. An issue with ID IMAGINGNET-3007 has been added as new feature request to provide the requested support. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.

Thanks for your work!

The issues you have found earlier (filed as IMAGINGNET-3007) have been fixed in this update.