Usage of median(im1bjNkxp)

Hello Everyone !!

Context

My objective is to detect isolated groups of pixels (I am trying to distinguish between large and small groups). To achieve this, I want to use “median(im1b1Nkxp)” and see which value of k and p is the good one.

Configuration setup

My system: Windows10
Version of the OTB: 8.1.1
I installed the OTB with: the binaries
QGIS version: 3.30.1
Python version:

Description of my issue

However, it only works for “median(im1b1N21x21),” (and lower k & p values) which is too small for my purposes. I am getting the following error message:
2023-04-27 10:04:20 (INFO) BandMathX: Image #1 has 1 components
2023-04-27 10:04:20 (INFO) BandMathX: Using expression: median(im1b1N77x77);im1b1
2023-04-27 10:04:20 (FATAL) BandMathX: itk::ERROR: BandMathXImageFilter(00000074653BBEC0): Following variables not allowed : im1b1N33x33

I’v reed the cookbook, and on the forum i don’t find similar category.
Thanks for your help

Hi @Namhc ,

Here is the format parser for im1b1Nkxp :

  m_SizeNeighbourhood = 10;
    for (unsigned int x = 0; x <= m_SizeNeighbourhood; x++)
      for (unsigned int y = 0; y <= m_SizeNeighbourhood; y++)
      {
    ....
        ahc.info[0] = idx;       // Input image #ID
        ahc.info[1] = j;         // Band #ID
        ahc.info[2] = 2 * x + 1; // Size x direction (matrix convention = cols)
        ahc.info[3] = 2 * y + 1; // Size y direction (matrix convention = rows)
        m_VAllowedVarNameAuto.push_back(ahc);

That explains why the maximum number of neighboors allowable is 21. I guess this limitation in OTB was done for performance reason, I am not sure. I think we could improve this by putting up this maximum to 50 or something like that. Feel free to open an issue in gitlab, maybe it will be taken in account for the upcoming 8.2 version

Best regards

Thanks a lot for these clarifications! I thought I had misunderstood something!

Best regards