diff --git "a/utils/processing.html" "b/utils/processing.html" new file mode 100644--- /dev/null +++ "b/utils/processing.html" @@ -0,0 +1,1465 @@ + + + + + + Cython: processing.pyx + + + +

Generated by Cython 3.0.11

+

+ Yellow lines hint at Python interaction.
+ Click on a line that starts with a "+" to see the C code that Cython generated for it. +

+

Raw output: processing.c

+
+001: # File: processing.pyx
+
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
 002: # cython: language_level=3, boundscheck=False, wraparound=False, nonecheck=False, cdivision=True
+
 003: 
+
+004: import numpy as np
+
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
 005: cimport numpy as np
+
+006: import pandas as pd
+
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_pandas, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pd, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
 007: cimport pandas as pd
+
 008: from libc.math cimport isnan
+
 009: from cpython.mem cimport PyMem_Malloc, PyMem_Free
+
 010: 
+
 011: # Define C types for better performance
+
+012: ctypedef np.float32_t DTYPE_t
+
typedef __pyx_t_5numpy_float32_t __pyx_t_13processing_cy_DTYPE_t;
+
 013: ctypedef np.int32_t ITYPE_t
+
 014: 
+
+015: def process_bbox_depth_cy(np.ndarray[DTYPE_t, ndim=2] depth_map,
+
/* Python wrapper */
+static PyObject *__pyx_pw_13processing_cy_1process_bbox_depth_cy(PyObject *__pyx_self, 
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+PyDoc_STRVAR(__pyx_doc_13processing_cy_process_bbox_depth_cy, "\n    Optimized bbox depth calculations using Cython\n    ");
+static PyMethodDef __pyx_mdef_13processing_cy_1process_bbox_depth_cy = {"process_bbox_depth_cy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_13processing_cy_1process_bbox_depth_cy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_13processing_cy_process_bbox_depth_cy};
+static PyObject *__pyx_pw_13processing_cy_1process_bbox_depth_cy(PyObject *__pyx_self, 
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+  PyArrayObject *__pyx_v_depth_map = 0;
+  int __pyx_v_y_min;
+  int __pyx_v_y_max;
+  int __pyx_v_x_min;
+  int __pyx_v_x_max;
+  #if !CYTHON_METH_FASTCALL
+  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+  #endif
+  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("process_bbox_depth_cy (wrapper)", 0);
+  #if !CYTHON_METH_FASTCALL
+  #if CYTHON_ASSUME_SAFE_MACROS
+  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+  #else
+  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+  #endif
+  #endif
+  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+  {
+    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_depth_map,&__pyx_n_s_y_min,&__pyx_n_s_y_max,&__pyx_n_s_x_min,&__pyx_n_s_x_max,0};
+  PyObject* values[5] = {0,0,0,0,0};
+    if (__pyx_kwds) {
+      Py_ssize_t kw_args;
+      switch (__pyx_nargs) {
+        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
+        CYTHON_FALLTHROUGH;
+        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
+        CYTHON_FALLTHROUGH;
+        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
+        CYTHON_FALLTHROUGH;
+        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
+        CYTHON_FALLTHROUGH;
+        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+        CYTHON_FALLTHROUGH;
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
+      switch (__pyx_nargs) {
+        case  0:
+        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_depth_map)) != 0)) {
+          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
+          kw_args--;
+        }
+        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
+        else goto __pyx_L5_argtuple_error;
+        CYTHON_FALLTHROUGH;
+        case  1:
+        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_y_min)) != 0)) {
+          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
+          kw_args--;
+        }
+        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
+        else {
+          __Pyx_RaiseArgtupleInvalid("process_bbox_depth_cy", 1, 5, 5, 1); __PYX_ERR(0, 15, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  2:
+        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_y_max)) != 0)) {
+          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
+          kw_args--;
+        }
+        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
+        else {
+          __Pyx_RaiseArgtupleInvalid("process_bbox_depth_cy", 1, 5, 5, 2); __PYX_ERR(0, 15, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  3:
+        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x_min)) != 0)) {
+          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
+          kw_args--;
+        }
+        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
+        else {
+          __Pyx_RaiseArgtupleInvalid("process_bbox_depth_cy", 1, 5, 5, 3); __PYX_ERR(0, 15, __pyx_L3_error)
+        }
+        CYTHON_FALLTHROUGH;
+        case  4:
+        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x_max)) != 0)) {
+          (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
+          kw_args--;
+        }
+        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
+        else {
+          __Pyx_RaiseArgtupleInvalid("process_bbox_depth_cy", 1, 5, 5, 4); __PYX_ERR(0, 15, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        const Py_ssize_t kwd_pos_args = __pyx_nargs;
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "process_bbox_depth_cy") < 0)) __PYX_ERR(0, 15, __pyx_L3_error)
+      }
+    } else if (unlikely(__pyx_nargs != 5)) {
+      goto __pyx_L5_argtuple_error;
+    } else {
+      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
+      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
+      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
+      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
+    }
+    __pyx_v_depth_map = ((PyArrayObject *)values[0]);
+    __pyx_v_y_min = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_y_min == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
+    __pyx_v_y_max = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_y_max == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
+    __pyx_v_x_min = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_x_min == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
+    __pyx_v_x_max = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_x_max == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
+  }
+  goto __pyx_L6_skip;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("process_bbox_depth_cy", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 15, __pyx_L3_error)
+  __pyx_L6_skip:;
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L3_error:;
+  {
+    Py_ssize_t __pyx_temp;
+    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+    }
+  }
+  __Pyx_AddTraceback("processing_cy.process_bbox_depth_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_depth_map), __pyx_ptype_5numpy_ndarray, 1, "depth_map", 0))) __PYX_ERR(0, 15, __pyx_L1_error)
+  __pyx_r = __pyx_pf_13processing_cy_process_bbox_depth_cy(__pyx_self, __pyx_v_depth_map, __pyx_v_y_min, __pyx_v_y_max, __pyx_v_x_min, __pyx_v_x_max);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+
+  /* function exit code */
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __pyx_r = NULL;
+  __pyx_L0:;
+  {
+    Py_ssize_t __pyx_temp;
+    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+    }
+  }
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_13processing_cy_process_bbox_depth_cy(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_depth_map, int __pyx_v_y_min, int __pyx_v_y_max, int __pyx_v_x_min, int __pyx_v_x_max) {
+  int __pyx_v_i;
+  int __pyx_v_j;
+  int __pyx_v_count;
+  double __pyx_v_sum_val;
+  double __pyx_v_mean_val;
+  PyArrayObject *__pyx_v_flat_vals = 0;
+  int __pyx_v_flat_size;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_depth_map;
+  __Pyx_Buffer __pyx_pybuffer_depth_map;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_flat_vals;
+  __Pyx_Buffer __pyx_pybuffer_flat_vals;
+  PyObject *__pyx_r = NULL;
+  __pyx_pybuffer_flat_vals.pybuffer.buf = NULL;
+  __pyx_pybuffer_flat_vals.refcount = 0;
+  __pyx_pybuffernd_flat_vals.data = NULL;
+  __pyx_pybuffernd_flat_vals.rcbuffer = &__pyx_pybuffer_flat_vals;
+  __pyx_pybuffer_depth_map.pybuffer.buf = NULL;
+  __pyx_pybuffer_depth_map.refcount = 0;
+  __pyx_pybuffernd_depth_map.data = NULL;
+  __pyx_pybuffernd_depth_map.rcbuffer = &__pyx_pybuffer_depth_map;
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_depth_map.rcbuffer->pybuffer, (PyObject*)__pyx_v_depth_map, &__Pyx_TypeInfo_nn___pyx_t_13processing_cy_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 15, __pyx_L1_error)
+  }
+  __pyx_pybuffernd_depth_map.diminfo[0].strides = __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_depth_map.diminfo[0].shape = __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_depth_map.diminfo[1].strides = __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_depth_map.diminfo[1].shape = __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.shape[1];
+/* … */
+  /* function exit code */
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  __Pyx_XDECREF(__pyx_t_12);
+  __Pyx_XDECREF(__pyx_t_13);
+  __Pyx_XDECREF(__pyx_t_14);
+  __Pyx_XDECREF(__pyx_t_21);
+  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
+    __Pyx_PyThreadState_declare
+    __Pyx_PyThreadState_assign
+    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_depth_map.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flat_vals.rcbuffer->pybuffer);
+  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
+  __Pyx_AddTraceback("processing_cy.process_bbox_depth_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  goto __pyx_L2;
+  __pyx_L0:;
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_depth_map.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flat_vals.rcbuffer->pybuffer);
+  __pyx_L2:;
+  __Pyx_XDECREF((PyObject *)__pyx_v_flat_vals);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+/* … */
+  __pyx_tuple__4 = PyTuple_Pack(12, __pyx_n_s_depth_map, __pyx_n_s_y_min, __pyx_n_s_y_max, __pyx_n_s_x_min, __pyx_n_s_x_max, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_count, __pyx_n_s_sum_val, __pyx_n_s_mean_val, __pyx_n_s_flat_vals, __pyx_n_s_flat_size); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 15, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_tuple__4);
+  __Pyx_GIVEREF(__pyx_tuple__4);
+/* … */
+  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_13processing_cy_1process_bbox_depth_cy, 0, __pyx_n_s_process_bbox_depth_cy, NULL, __pyx_n_s_processing_cy, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s_process_bbox_depth_cy, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_processing_pyx, __pyx_n_s_process_bbox_depth_cy, 15, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 15, __pyx_L1_error)
+
 016:                          int y_min, int y_max, int x_min, int x_max):
+
 017:     """
+
 018:     Optimized bbox depth calculations using Cython
+
 019:     """
+
 020:     cdef:
+
+021:         int i, j, count = 0
+
  __pyx_v_count = 0;
+
+022:         double sum_val = 0.0
+
  __pyx_v_sum_val = 0.0;
+
+023:         double mean_val = 0.0
+
  __pyx_v_mean_val = 0.0;
+
 024:         np.ndarray[DTYPE_t, ndim=1] flat_vals
+
+025:         int flat_size = 0
+
  __pyx_v_flat_size = 0;
+
 026: 
+
+027:     for i in range(y_min, y_max):
+
  __pyx_t_1 = __pyx_v_y_max;
+  __pyx_t_2 = __pyx_t_1;
+  for (__pyx_t_3 = __pyx_v_y_min; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
+
+028:         for j in range(x_min, x_max):
+
    __pyx_t_4 = __pyx_v_x_max;
+    __pyx_t_5 = __pyx_t_4;
+    for (__pyx_t_6 = __pyx_v_x_min; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
+      __pyx_v_j = __pyx_t_6;
+
+029:             if not isnan(depth_map[i, j]):
+
      __pyx_t_7 = __pyx_v_i;
+      __pyx_t_8 = __pyx_v_j;
+      __pyx_t_9 = (!isnan((*__Pyx_BufPtrStrided2d(__pyx_t_13processing_cy_DTYPE_t *, __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_depth_map.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_depth_map.diminfo[1].strides))));
+      if (__pyx_t_9) {
+/* … */
+      }
+    }
+  }
+
+030:                 sum_val += depth_map[i, j]
+
        __pyx_t_8 = __pyx_v_i;
+        __pyx_t_7 = __pyx_v_j;
+        __pyx_v_sum_val = (__pyx_v_sum_val + (*__Pyx_BufPtrStrided2d(__pyx_t_13processing_cy_DTYPE_t *, __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_depth_map.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_depth_map.diminfo[1].strides)));
+
+031:                 count += 1
+
        __pyx_v_count = (__pyx_v_count + 1);
+
 032: 
+
+033:     if count > 0:
+
  __pyx_t_9 = (__pyx_v_count > 0);
+  if (__pyx_t_9) {
+/* … */
+  }
+
+034:         mean_val = sum_val / count
+
    __pyx_v_mean_val = (__pyx_v_sum_val / ((double)__pyx_v_count));
+
 035: 
+
 036:     # Create array for trimmed mean calculation
+
+037:     flat_vals = np.zeros(count, dtype=np.float32)
+
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 37, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 37, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_11);
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_count); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 37, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_10);
+  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 37, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_GIVEREF(__pyx_t_10);
+  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10)) __PYX_ERR(0, 37, __pyx_L1_error);
+  __pyx_t_10 = 0;
+  __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 37, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_10);
+  __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 37, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_13);
+  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_float32); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 37, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_14);
+  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+  if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_14) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
+  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 37, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_14);
+  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+  if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 37, __pyx_L1_error)
+  __pyx_t_15 = ((PyArrayObject *)__pyx_t_14);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flat_vals.rcbuffer->pybuffer);
+    __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flat_vals.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_13processing_cy_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
+    if (unlikely(__pyx_t_1 < 0)) {
+      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
+      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flat_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_flat_vals, &__Pyx_TypeInfo_nn___pyx_t_13processing_cy_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
+        __Pyx_RaiseBufferFallbackError();
+      } else {
+        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
+      }
+      __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
+    }
+    __pyx_pybuffernd_flat_vals.diminfo[0].strides = __pyx_pybuffernd_flat_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flat_vals.diminfo[0].shape = __pyx_pybuffernd_flat_vals.rcbuffer->pybuffer.shape[0];
+    if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 37, __pyx_L1_error)
+  }
+  __pyx_t_15 = 0;
+  __pyx_v_flat_vals = ((PyArrayObject *)__pyx_t_14);
+  __pyx_t_14 = 0;
+
+038:     flat_size = 0
+
  __pyx_v_flat_size = 0;
+
 039: 
+
+040:     for i in range(y_min, y_max):
+
  __pyx_t_1 = __pyx_v_y_max;
+  __pyx_t_2 = __pyx_t_1;
+  for (__pyx_t_3 = __pyx_v_y_min; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
+    __pyx_v_i = __pyx_t_3;
+
+041:         for j in range(x_min, x_max):
+
    __pyx_t_4 = __pyx_v_x_max;
+    __pyx_t_5 = __pyx_t_4;
+    for (__pyx_t_6 = __pyx_v_x_min; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
+      __pyx_v_j = __pyx_t_6;
+
+042:             if not isnan(depth_map[i, j]):
+
      __pyx_t_7 = __pyx_v_i;
+      __pyx_t_8 = __pyx_v_j;
+      __pyx_t_9 = (!isnan((*__Pyx_BufPtrStrided2d(__pyx_t_13processing_cy_DTYPE_t *, __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_depth_map.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_depth_map.diminfo[1].strides))));
+      if (__pyx_t_9) {
+/* … */
+      }
+    }
+  }
+
+043:                 flat_vals[flat_size] = depth_map[i, j]
+
        __pyx_t_8 = __pyx_v_i;
+        __pyx_t_7 = __pyx_v_j;
+        __pyx_t_19 = __pyx_v_flat_size;
+        *__Pyx_BufPtrStrided1d(__pyx_t_13processing_cy_DTYPE_t *, __pyx_pybuffernd_flat_vals.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_flat_vals.diminfo[0].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_13processing_cy_DTYPE_t *, __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_depth_map.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_depth_map.diminfo[1].strides));
+
+044:                 flat_size += 1
+
        __pyx_v_flat_size = (__pyx_v_flat_size + 1);
+
 045: 
+
+046:     return mean_val, np.median(flat_vals), np.percentile(flat_vals, [20, 80])
+
  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_14 = PyFloat_FromDouble(__pyx_v_mean_val); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 46, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_14);
+  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 46, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_median); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 46, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_11);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_12 = NULL;
+  __pyx_t_20 = 0;
+  #if CYTHON_UNPACK_METHODS
+  if (unlikely(PyMethod_Check(__pyx_t_11))) {
+    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
+    if (likely(__pyx_t_12)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
+      __Pyx_INCREF(__pyx_t_12);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_11, function);
+      __pyx_t_20 = 1;
+    }
+  }
+  #endif
+  {
+    PyObject *__pyx_callargs[2] = {__pyx_t_12, ((PyObject *)__pyx_v_flat_vals)};
+    __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_20, 1+__pyx_t_20);
+    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
+    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 46, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+  }
+  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 46, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_12);
+  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_percentile); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 46, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_13);
+  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+  __pyx_t_12 = PyList_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 46, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_12);
+  __Pyx_INCREF(__pyx_int_20);
+  __Pyx_GIVEREF(__pyx_int_20);
+  if (__Pyx_PyList_SET_ITEM(__pyx_t_12, 0, __pyx_int_20)) __PYX_ERR(0, 46, __pyx_L1_error);
+  __Pyx_INCREF(__pyx_int_80);
+  __Pyx_GIVEREF(__pyx_int_80);
+  if (__Pyx_PyList_SET_ITEM(__pyx_t_12, 1, __pyx_int_80)) __PYX_ERR(0, 46, __pyx_L1_error);
+  __pyx_t_21 = NULL;
+  __pyx_t_20 = 0;
+  #if CYTHON_UNPACK_METHODS
+  if (unlikely(PyMethod_Check(__pyx_t_13))) {
+    __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_13);
+    if (likely(__pyx_t_21)) {
+      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
+      __Pyx_INCREF(__pyx_t_21);
+      __Pyx_INCREF(function);
+      __Pyx_DECREF_SET(__pyx_t_13, function);
+      __pyx_t_20 = 1;
+    }
+  }
+  #endif
+  {
+    PyObject *__pyx_callargs[3] = {__pyx_t_21, ((PyObject *)__pyx_v_flat_vals), __pyx_t_12};
+    __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+1-__pyx_t_20, 2+__pyx_t_20);
+    __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
+    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
+    if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 46, __pyx_L1_error)
+    __Pyx_GOTREF(__pyx_t_11);
+    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
+  }
+  __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 46, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_13);
+  __Pyx_GIVEREF(__pyx_t_14);
+  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14)) __PYX_ERR(0, 46, __pyx_L1_error);
+  __Pyx_GIVEREF(__pyx_t_10);
+  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_10)) __PYX_ERR(0, 46, __pyx_L1_error);
+  __Pyx_GIVEREF(__pyx_t_11);
+  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_11)) __PYX_ERR(0, 46, __pyx_L1_error);
+  __pyx_t_14 = 0;
+  __pyx_t_10 = 0;
+  __pyx_t_11 = 0;
+  __pyx_r = __pyx_t_13;
+  __pyx_t_13 = 0;
+  goto __pyx_L0;
+
 047: 
+
+048: def handle_overlaps_cy(np.ndarray[DTYPE_t, ndim=2] depth_map,
+
/* Python wrapper */
+static PyObject *__pyx_pw_13processing_cy_3handle_overlaps_cy(PyObject *__pyx_self, 
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+PyDoc_STRVAR(__pyx_doc_13processing_cy_2handle_overlaps_cy, "\n    Optimized overlap handling using Cython\n    ");
+static PyMethodDef __pyx_mdef_13processing_cy_3handle_overlaps_cy = {"handle_overlaps_cy", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_13processing_cy_3handle_overlaps_cy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_13processing_cy_2handle_overlaps_cy};
+static PyObject *__pyx_pw_13processing_cy_3handle_overlaps_cy(PyObject *__pyx_self, 
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+  CYTHON_UNUSED PyArrayObject *__pyx_v_depth_map = 0;
+  PyArrayObject *__pyx_v_boxes = 0;
+  #if !CYTHON_METH_FASTCALL
+  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+  #endif
+  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("handle_overlaps_cy (wrapper)", 0);
+  #if !CYTHON_METH_FASTCALL
+  #if CYTHON_ASSUME_SAFE_MACROS
+  __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+  #else
+  __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+  #endif
+  #endif
+  __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+  {
+    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_depth_map,&__pyx_n_s_boxes,0};
+  PyObject* values[2] = {0,0};
+    if (__pyx_kwds) {
+      Py_ssize_t kw_args;
+      switch (__pyx_nargs) {
+        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
+        CYTHON_FALLTHROUGH;
+        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+        CYTHON_FALLTHROUGH;
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
+      switch (__pyx_nargs) {
+        case  0:
+        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_depth_map)) != 0)) {
+          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
+          kw_args--;
+        }
+        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 48, __pyx_L3_error)
+        else goto __pyx_L5_argtuple_error;
+        CYTHON_FALLTHROUGH;
+        case  1:
+        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_boxes)) != 0)) {
+          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
+          kw_args--;
+        }
+        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 48, __pyx_L3_error)
+        else {
+          __Pyx_RaiseArgtupleInvalid("handle_overlaps_cy", 1, 2, 2, 1); __PYX_ERR(0, 48, __pyx_L3_error)
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        const Py_ssize_t kwd_pos_args = __pyx_nargs;
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "handle_overlaps_cy") < 0)) __PYX_ERR(0, 48, __pyx_L3_error)
+      }
+    } else if (unlikely(__pyx_nargs != 2)) {
+      goto __pyx_L5_argtuple_error;
+    } else {
+      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
+    }
+    __pyx_v_depth_map = ((PyArrayObject *)values[0]);
+    __pyx_v_boxes = ((PyArrayObject *)values[1]);
+  }
+  goto __pyx_L6_skip;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("handle_overlaps_cy", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 48, __pyx_L3_error)
+  __pyx_L6_skip:;
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L3_error:;
+  {
+    Py_ssize_t __pyx_temp;
+    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+    }
+  }
+  __Pyx_AddTraceback("processing_cy.handle_overlaps_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_depth_map), __pyx_ptype_5numpy_ndarray, 1, "depth_map", 0))) __PYX_ERR(0, 48, __pyx_L1_error)
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_boxes), __pyx_ptype_5numpy_ndarray, 1, "boxes", 0))) __PYX_ERR(0, 49, __pyx_L1_error)
+  __pyx_r = __pyx_pf_13processing_cy_2handle_overlaps_cy(__pyx_self, __pyx_v_depth_map, __pyx_v_boxes);
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+
+  /* function exit code */
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __pyx_r = NULL;
+  __pyx_L0:;
+  {
+    Py_ssize_t __pyx_temp;
+    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+    }
+  }
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_13processing_cy_2handle_overlaps_cy(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_depth_map, PyArrayObject *__pyx_v_boxes) {
+  int __pyx_v_n_boxes;
+  int __pyx_v_i;
+  int __pyx_v_j;
+  int __pyx_v_y_min1;
+  int __pyx_v_y_max1;
+  int __pyx_v_x_min1;
+  int __pyx_v_x_max1;
+  int __pyx_v_y_min2;
+  int __pyx_v_y_max2;
+  int __pyx_v_x_min2;
+  int __pyx_v_x_max2;
+  double __pyx_v_area1;
+  double __pyx_v_area2;
+  double __pyx_v_area_intersection;
+  int *__pyx_v_to_remove;
+  PyObject *__pyx_v_y_min_int = NULL;
+  PyObject *__pyx_v_y_max_int = NULL;
+  PyObject *__pyx_v_x_min_int = NULL;
+  PyObject *__pyx_v_x_max_int = NULL;
+  int __pyx_7genexpr__pyx_v_i;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_boxes;
+  __Pyx_Buffer __pyx_pybuffer_boxes;
+  __Pyx_LocalBuf_ND __pyx_pybuffernd_depth_map;
+  __Pyx_Buffer __pyx_pybuffer_depth_map;
+  PyObject *__pyx_r = NULL;
+  __pyx_pybuffer_depth_map.pybuffer.buf = NULL;
+  __pyx_pybuffer_depth_map.refcount = 0;
+  __pyx_pybuffernd_depth_map.data = NULL;
+  __pyx_pybuffernd_depth_map.rcbuffer = &__pyx_pybuffer_depth_map;
+  __pyx_pybuffer_boxes.pybuffer.buf = NULL;
+  __pyx_pybuffer_boxes.refcount = 0;
+  __pyx_pybuffernd_boxes.data = NULL;
+  __pyx_pybuffernd_boxes.rcbuffer = &__pyx_pybuffer_boxes;
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_depth_map.rcbuffer->pybuffer, (PyObject*)__pyx_v_depth_map, &__Pyx_TypeInfo_nn___pyx_t_13processing_cy_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 48, __pyx_L1_error)
+  }
+  __pyx_pybuffernd_depth_map.diminfo[0].strides = __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_depth_map.diminfo[0].shape = __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_depth_map.diminfo[1].strides = __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_depth_map.diminfo[1].shape = __pyx_pybuffernd_depth_map.rcbuffer->pybuffer.shape[1];
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_boxes, &__Pyx_TypeInfo_nn___pyx_t_13processing_cy_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 48, __pyx_L1_error)
+  }
+  __pyx_pybuffernd_boxes.diminfo[0].strides = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_boxes.diminfo[0].shape = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_boxes.diminfo[1].strides = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_boxes.diminfo[1].shape = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.shape[1];
+/* … */
+  /* function exit code */
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_7);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_XDECREF(__pyx_t_11);
+  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
+    __Pyx_PyThreadState_declare
+    __Pyx_PyThreadState_assign
+    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
+    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_depth_map.rcbuffer->pybuffer);
+  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
+  __Pyx_AddTraceback("processing_cy.handle_overlaps_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  goto __pyx_L2;
+  __pyx_L0:;
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
+  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_depth_map.rcbuffer->pybuffer);
+  __pyx_L2:;
+  __Pyx_XDECREF(__pyx_v_y_min_int);
+  __Pyx_XDECREF(__pyx_v_y_max_int);
+  __Pyx_XDECREF(__pyx_v_x_min_int);
+  __Pyx_XDECREF(__pyx_v_x_max_int);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+/* … */
+  __pyx_tuple__6 = PyTuple_Pack(22, __pyx_n_s_depth_map, __pyx_n_s_boxes, __pyx_n_s_n_boxes, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_y_min1, __pyx_n_s_y_max1, __pyx_n_s_x_min1, __pyx_n_s_x_max1, __pyx_n_s_y_min2, __pyx_n_s_y_max2, __pyx_n_s_x_min2, __pyx_n_s_x_max2, __pyx_n_s_area1, __pyx_n_s_area2, __pyx_n_s_area_intersection, __pyx_n_s_to_remove, __pyx_n_s_y_min_int, __pyx_n_s_y_max_int, __pyx_n_s_x_min_int, __pyx_n_s_x_max_int, __pyx_n_s_i); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_tuple__6);
+  __Pyx_GIVEREF(__pyx_tuple__6);
+/* … */
+  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_13processing_cy_3handle_overlaps_cy, 0, __pyx_n_s_handle_overlaps_cy, NULL, __pyx_n_s_processing_cy, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_GOTREF(__pyx_t_2);
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s_handle_overlaps_cy, __pyx_t_2) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
 049:                       np.ndarray[ITYPE_t, ndim=2] boxes):
+
 050:     """
+
 051:     Optimized overlap handling using Cython
+
 052:     """
+
 053:     cdef:
+
+054:         int n_boxes = boxes.shape[0]
+
  __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_boxes)); if (unlikely(__pyx_t_1 == ((npy_intp *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
+  __pyx_v_n_boxes = (__pyx_t_1[0]);
+
 055:         int i, j
+
 056:         int y_min1, y_max1, x_min1, x_max1
+
 057:         int y_min2, y_max2, x_min2, x_max2
+
 058:         double area1, area2, area_intersection
+
+059:         bint* to_remove = <bint*>PyMem_Malloc(n_boxes * sizeof(bint))
+
  __pyx_v_to_remove = ((int *)PyMem_Malloc((__pyx_v_n_boxes * (sizeof(int)))));
+
 060: 
+
+061:     if not to_remove:
+
  __pyx_t_2 = (!(__pyx_v_to_remove != 0));
+  if (unlikely(__pyx_t_2)) {
+/* … */
+  }
+
+062:         raise MemoryError()
+
    PyErr_NoMemory(); __PYX_ERR(0, 62, __pyx_L1_error)
+
 063: 
+
+064:     try:
+
  /*try:*/ {
+
+065:         for i in range(n_boxes):
+
    __pyx_t_3 = __pyx_v_n_boxes;
+    __pyx_t_4 = __pyx_t_3;
+    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
+      __pyx_v_i = __pyx_t_5;
+
+066:             to_remove[i] = False
+
      (__pyx_v_to_remove[__pyx_v_i]) = 0;
+    }
+
 067: 
+
+068:         for i in range(n_boxes):
+
    __pyx_t_3 = __pyx_v_n_boxes;
+    __pyx_t_4 = __pyx_t_3;
+    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
+      __pyx_v_i = __pyx_t_5;
+
+069:             if to_remove[i]:
+
      if ((__pyx_v_to_remove[__pyx_v_i])) {
+/* … */
+      }
+
+070:                 continue
+
        goto __pyx_L9_continue;
+
 071: 
+
+072:             y_min1, x_min1, y_max1, x_max1 = boxes[i]
+
      __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_boxes), __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 72, __pyx_L5_error)
+      __Pyx_GOTREF(__pyx_t_6);
+      if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
+        PyObject* sequence = __pyx_t_6;
+        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
+        if (unlikely(size != 4)) {
+          if (size > 4) __Pyx_RaiseTooManyValuesError(4);
+          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+          __PYX_ERR(0, 72, __pyx_L5_error)
+        }
+        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+        if (likely(PyTuple_CheckExact(sequence))) {
+          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
+          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
+          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
+          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); 
+        } else {
+          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
+          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
+          __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
+          __pyx_t_10 = PyList_GET_ITEM(sequence, 3); 
+        }
+        __Pyx_INCREF(__pyx_t_7);
+        __Pyx_INCREF(__pyx_t_8);
+        __Pyx_INCREF(__pyx_t_9);
+        __Pyx_INCREF(__pyx_t_10);
+        #else
+        {
+          Py_ssize_t i;
+          PyObject** temps[4] = {&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
+          for (i=0; i < 4; i++) {
+            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 72, __pyx_L5_error)
+            __Pyx_GOTREF(item);
+            *(temps[i]) = item;
+          }
+        }
+        #endif
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      } else {
+        Py_ssize_t index = -1;
+        PyObject** temps[4] = {&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10};
+        __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 72, __pyx_L5_error)
+        __Pyx_GOTREF(__pyx_t_11);
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        __pyx_t_12 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_11);
+        for (index=0; index < 4; index++) {
+          PyObject* item = __pyx_t_12(__pyx_t_11); if (unlikely(!item)) goto __pyx_L12_unpacking_failed;
+          __Pyx_GOTREF(item);
+          *(temps[index]) = item;
+        }
+        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 4) < 0) __PYX_ERR(0, 72, __pyx_L5_error)
+        __pyx_t_12 = NULL;
+        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+        goto __pyx_L13_unpacking_done;
+        __pyx_L12_unpacking_failed:;
+        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+        __pyx_t_12 = NULL;
+        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+        __PYX_ERR(0, 72, __pyx_L5_error)
+        __pyx_L13_unpacking_done:;
+      }
+      __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L5_error)
+      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L5_error)
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L5_error)
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L5_error)
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __pyx_v_y_min1 = __pyx_t_13;
+      __pyx_v_x_min1 = __pyx_t_14;
+      __pyx_v_y_max1 = __pyx_t_15;
+      __pyx_v_x_max1 = __pyx_t_16;
+
 073: 
+
+074:             for j in range(i + 1, n_boxes):
+
      __pyx_t_16 = __pyx_v_n_boxes;
+      __pyx_t_15 = __pyx_t_16;
+      for (__pyx_t_14 = (__pyx_v_i + 1); __pyx_t_14 < __pyx_t_15; __pyx_t_14+=1) {
+        __pyx_v_j = __pyx_t_14;
+
+075:                 if to_remove[j]:
+
        if ((__pyx_v_to_remove[__pyx_v_j])) {
+/* … */
+        }
+
+076:                     continue
+
          goto __pyx_L14_continue;
+
 077: 
+
+078:                 y_min2, x_min2, y_max2, x_max2 = boxes[j]
+
        __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_boxes), __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L5_error)
+        __Pyx_GOTREF(__pyx_t_6);
+        if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
+          PyObject* sequence = __pyx_t_6;
+          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
+          if (unlikely(size != 4)) {
+            if (size > 4) __Pyx_RaiseTooManyValuesError(4);
+            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+            __PYX_ERR(0, 78, __pyx_L5_error)
+          }
+          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+          if (likely(PyTuple_CheckExact(sequence))) {
+            __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
+            __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
+            __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
+            __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
+          } else {
+            __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
+            __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
+            __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
+            __pyx_t_7 = PyList_GET_ITEM(sequence, 3); 
+          }
+          __Pyx_INCREF(__pyx_t_10);
+          __Pyx_INCREF(__pyx_t_9);
+          __Pyx_INCREF(__pyx_t_8);
+          __Pyx_INCREF(__pyx_t_7);
+          #else
+          {
+            Py_ssize_t i;
+            PyObject** temps[4] = {&__pyx_t_10,&__pyx_t_9,&__pyx_t_8,&__pyx_t_7};
+            for (i=0; i < 4; i++) {
+              PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 78, __pyx_L5_error)
+              __Pyx_GOTREF(item);
+              *(temps[i]) = item;
+            }
+          }
+          #endif
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        } else {
+          Py_ssize_t index = -1;
+          PyObject** temps[4] = {&__pyx_t_10,&__pyx_t_9,&__pyx_t_8,&__pyx_t_7};
+          __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 78, __pyx_L5_error)
+          __Pyx_GOTREF(__pyx_t_11);
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+          __pyx_t_12 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_11);
+          for (index=0; index < 4; index++) {
+            PyObject* item = __pyx_t_12(__pyx_t_11); if (unlikely(!item)) goto __pyx_L17_unpacking_failed;
+            __Pyx_GOTREF(item);
+            *(temps[index]) = item;
+          }
+          if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 4) < 0) __PYX_ERR(0, 78, __pyx_L5_error)
+          __pyx_t_12 = NULL;
+          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+          goto __pyx_L18_unpacking_done;
+          __pyx_L17_unpacking_failed:;
+          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+          __pyx_t_12 = NULL;
+          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+          __PYX_ERR(0, 78, __pyx_L5_error)
+          __pyx_L18_unpacking_done:;
+        }
+        __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L5_error)
+        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+        __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L5_error)
+        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+        __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L5_error)
+        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+        __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L5_error)
+        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+        __pyx_v_y_min2 = __pyx_t_13;
+        __pyx_v_x_min2 = __pyx_t_17;
+        __pyx_v_y_max2 = __pyx_t_18;
+        __pyx_v_x_max2 = __pyx_t_19;
+
 079: 
+
 080:                 # Calculate intersection
+
+081:                 y_min_int = max(y_min1, y_min2)
+
        __pyx_t_19 = __pyx_v_y_min2;
+        __pyx_t_18 = __pyx_v_y_min1;
+        __pyx_t_2 = (__pyx_t_19 > __pyx_t_18);
+        if (__pyx_t_2) {
+          __pyx_t_17 = __pyx_t_19;
+        } else {
+          __pyx_t_17 = __pyx_t_18;
+        }
+        __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_17); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L5_error)
+        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_XDECREF_SET(__pyx_v_y_min_int, __pyx_t_6);
+        __pyx_t_6 = 0;
+
+082:                 y_max_int = min(y_max1, y_max2)
+
        __pyx_t_17 = __pyx_v_y_max2;
+        __pyx_t_19 = __pyx_v_y_max1;
+        __pyx_t_2 = (__pyx_t_17 < __pyx_t_19);
+        if (__pyx_t_2) {
+          __pyx_t_18 = __pyx_t_17;
+        } else {
+          __pyx_t_18 = __pyx_t_19;
+        }
+        __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_18); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L5_error)
+        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_XDECREF_SET(__pyx_v_y_max_int, __pyx_t_6);
+        __pyx_t_6 = 0;
+
+083:                 x_min_int = max(x_min1, x_min2)
+
        __pyx_t_18 = __pyx_v_x_min2;
+        __pyx_t_17 = __pyx_v_x_min1;
+        __pyx_t_2 = (__pyx_t_18 > __pyx_t_17);
+        if (__pyx_t_2) {
+          __pyx_t_19 = __pyx_t_18;
+        } else {
+          __pyx_t_19 = __pyx_t_17;
+        }
+        __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_19); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L5_error)
+        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_XDECREF_SET(__pyx_v_x_min_int, __pyx_t_6);
+        __pyx_t_6 = 0;
+
+084:                 x_max_int = min(x_max1, x_max2)
+
        __pyx_t_19 = __pyx_v_x_max2;
+        __pyx_t_18 = __pyx_v_x_max1;
+        __pyx_t_2 = (__pyx_t_19 < __pyx_t_18);
+        if (__pyx_t_2) {
+          __pyx_t_17 = __pyx_t_19;
+        } else {
+          __pyx_t_17 = __pyx_t_18;
+        }
+        __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_17); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L5_error)
+        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_XDECREF_SET(__pyx_v_x_max_int, __pyx_t_6);
+        __pyx_t_6 = 0;
+
 085: 
+
+086:                 if y_min_int < y_max_int and x_min_int < x_max_int:
+
        __pyx_t_6 = PyObject_RichCompare(__pyx_v_y_min_int, __pyx_v_y_max_int, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L5_error)
+        __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_20 < 0))) __PYX_ERR(0, 86, __pyx_L5_error)
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        if (__pyx_t_20) {
+        } else {
+          __pyx_t_2 = __pyx_t_20;
+          goto __pyx_L20_bool_binop_done;
+        }
+        __pyx_t_6 = PyObject_RichCompare(__pyx_v_x_min_int, __pyx_v_x_max_int, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L5_error)
+        __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_20 < 0))) __PYX_ERR(0, 86, __pyx_L5_error)
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        __pyx_t_2 = __pyx_t_20;
+        __pyx_L20_bool_binop_done:;
+        if (__pyx_t_2) {
+/* … */
+        }
+        __pyx_L14_continue:;
+      }
+      __pyx_L15_break:;
+      __pyx_L9_continue:;
+    }
+
+087:                     area1 = (y_max1 - y_min1) * (x_max1 - x_min1)
+
          __pyx_v_area1 = ((__pyx_v_y_max1 - __pyx_v_y_min1) * (__pyx_v_x_max1 - __pyx_v_x_min1));
+
+088:                     area2 = (y_max2 - y_min2) * (x_max2 - x_min2)
+
          __pyx_v_area2 = ((__pyx_v_y_max2 - __pyx_v_y_min2) * (__pyx_v_x_max2 - __pyx_v_x_min2));
+
+089:                     area_intersection = (y_max_int - y_min_int) * (x_max_int - x_min_int)
+
          __pyx_t_6 = PyNumber_Subtract(__pyx_v_y_max_int, __pyx_v_y_min_int); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 89, __pyx_L5_error)
+          __Pyx_GOTREF(__pyx_t_6);
+          __pyx_t_7 = PyNumber_Subtract(__pyx_v_x_max_int, __pyx_v_x_min_int); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L5_error)
+          __Pyx_GOTREF(__pyx_t_7);
+          __pyx_t_8 = PyNumber_Multiply(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L5_error)
+          __Pyx_GOTREF(__pyx_t_8);
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+          __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L5_error)
+          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+          __pyx_v_area_intersection = __pyx_t_21;
+
 090: 
+
+091:                     if area_intersection / min(area1, area2) >= 0.70:
+
          __pyx_t_21 = __pyx_v_area2;
+          __pyx_t_22 = __pyx_v_area1;
+          __pyx_t_2 = (__pyx_t_21 < __pyx_t_22);
+          if (__pyx_t_2) {
+            __pyx_t_23 = __pyx_t_21;
+          } else {
+            __pyx_t_23 = __pyx_t_22;
+          }
+          __pyx_t_2 = ((__pyx_v_area_intersection / __pyx_t_23) >= 0.70);
+          if (__pyx_t_2) {
+/* … */
+          }
+
+092:                         if area1 < area2:
+
            __pyx_t_2 = (__pyx_v_area1 < __pyx_v_area2);
+            if (__pyx_t_2) {
+/* … */
+            }
+
+093:                             to_remove[i] = True
+
              (__pyx_v_to_remove[__pyx_v_i]) = 1;
+
+094:                             break
+
              goto __pyx_L15_break;
+
 095:                         else:
+
+096:                             to_remove[j] = True
+
            /*else*/ {
+              (__pyx_v_to_remove[__pyx_v_j]) = 1;
+            }
+
 097: 
+
+098:         return np.array([i for i in range(n_boxes) if not to_remove[i]], dtype=np.int32)
+
    __Pyx_XDECREF(__pyx_r);
+    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L5_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L5_error)
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    { /* enter inner scope */
+      __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L5_error)
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_3 = __pyx_v_n_boxes;
+      __pyx_t_4 = __pyx_t_3;
+      for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
+        __pyx_7genexpr__pyx_v_i = __pyx_t_5;
+        __pyx_t_2 = (!(__pyx_v_to_remove[__pyx_7genexpr__pyx_v_i]));
+        if (__pyx_t_2) {
+          __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_7genexpr__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L5_error)
+          __Pyx_GOTREF(__pyx_t_6);
+          if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 98, __pyx_L5_error)
+          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        }
+      }
+    } /* exit inner scope */
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L5_error)
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_8);
+    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8)) __PYX_ERR(0, 98, __pyx_L5_error);
+    __pyx_t_8 = 0;
+    __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L5_error)
+    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L5_error)
+    __Pyx_GOTREF(__pyx_t_9);
+    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_int32); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 98, __pyx_L5_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 98, __pyx_L5_error)
+    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 98, __pyx_L5_error)
+    __Pyx_GOTREF(__pyx_t_10);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+    __pyx_r = __pyx_t_10;
+    __pyx_t_10 = 0;
+    goto __pyx_L4_return;
+  }
+
 099: 
+
 100:     finally:
+
+101:         PyMem_Free(to_remove)
+
  /*finally:*/ {
+    __pyx_L5_error:;
+    /*exception exit:*/{
+      __Pyx_PyThreadState_declare
+      __Pyx_PyThreadState_assign
+      __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0; __pyx_t_29 = 0; __pyx_t_30 = 0;
+      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
+      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
+      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
+      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_28, &__pyx_t_29, &__pyx_t_30);
+      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_25, &__pyx_t_26, &__pyx_t_27) < 0)) __Pyx_ErrFetch(&__pyx_t_25, &__pyx_t_26, &__pyx_t_27);
+      __Pyx_XGOTREF(__pyx_t_25);
+      __Pyx_XGOTREF(__pyx_t_26);
+      __Pyx_XGOTREF(__pyx_t_27);
+      __Pyx_XGOTREF(__pyx_t_28);
+      __Pyx_XGOTREF(__pyx_t_29);
+      __Pyx_XGOTREF(__pyx_t_30);
+      __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_24 = __pyx_filename;
+      {
+        PyMem_Free(__pyx_v_to_remove);
+      }
+      if (PY_MAJOR_VERSION >= 3) {
+        __Pyx_XGIVEREF(__pyx_t_28);
+        __Pyx_XGIVEREF(__pyx_t_29);
+        __Pyx_XGIVEREF(__pyx_t_30);
+        __Pyx_ExceptionReset(__pyx_t_28, __pyx_t_29, __pyx_t_30);
+      }
+      __Pyx_XGIVEREF(__pyx_t_25);
+      __Pyx_XGIVEREF(__pyx_t_26);
+      __Pyx_XGIVEREF(__pyx_t_27);
+      __Pyx_ErrRestore(__pyx_t_25, __pyx_t_26, __pyx_t_27);
+      __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; __pyx_t_28 = 0; __pyx_t_29 = 0; __pyx_t_30 = 0;
+      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_24;
+      goto __pyx_L1_error;
+    }
+    __pyx_L4_return: {
+      __pyx_t_30 = __pyx_r;
+      __pyx_r = 0;
+      PyMem_Free(__pyx_v_to_remove);
+      __pyx_r = __pyx_t_30;
+      __pyx_t_30 = 0;
+      goto __pyx_L0;
+    }
+  }
+