public static boolean isBlackPixel(int idx, int radius, float gScore, int width, int height, byte[] blob) { 
      boolean result = false;
      double score = 0.0;
      if (isLegal(idx, width, height) && (blob[idx] == (byte)1 || blob[idx] == (byte)0)) { // blob[idx] == (byte)1
         int x = idx % width;
         int y = idx / width;
         int idx2 = 0;
         for (int i = -radius; i <= radius; i++) {
            for (int j = -radius; j <= radius; j++) {
               idx2 = width * (y + j) + x + i;
               if (isLegal(idx2, width, height) && blob[idx2] >= (byte)1) { //1
                  score++;
               }
            }
         }
         if (score >= gScore || blob[idx] == (byte)1) {
            result = true;
         }
      }
      return result;
   }