# How to find median position of a contour that represents a peak?

I was reading some papers on time-frequency methods of signal analysis and I am confused about one concept. The idea in these works is to plot a power spectrum in time-frequency plane and then to detect peaks at a given significance level (90%-98%). The authors have mentioned that they found median position of each peak in the plane. A brief summary of their procedure can be seen in Fig:1.

My doubts are:

1. For a nice contour with regular shape (say for example almost rounded edged rectangle shape or an elliptical shape), we can take the widest range and find the middle location along each axis to find the points. But do we need to finad a single point where both the medians coincide? I guess for a nice regular shape the two will coincide? How to calculate this with minimum error?
2. For an irregular shaped contour, what should be the approach? I am attaching a picture of a graph shown by the authors in Fig: 2. I circled two of the contours in blue ink. Here, the contour shapes are quite irregular. So if I consider frequency range as "bottom most point to top most point" and time range as "left most point to right most point", and I calculate the median, then would that be the correct approach?
3. To do this calculation, what would be the best way to avoid errors in measurement? I am trying to implement this method in MATLAB. Please suggest any useful MATLAB functions or code snippets if you can.

Pay attention that the median is not well defined in $$\mathbb{R}^{d}, \; d > 1$$ as the space is not ordered as in $$\mathbb{R}$$.

Usually, given a set of points $${\left\{ \boldsymbol{x}_{i} \in \mathbb{R}^{d} \right\}}_{i = 1}^{N}$$ we define the median as:

$$\arg \min_{\boldsymbol{m}} \sum_{i = 1}^{N} {\left\| \boldsymbol{m} - \boldsymbol{x}_{i} \right\|}_{1}$$

This can be solved in many ways where the easiest way is to take advantage of the separability of the problem which means median of each dimension. This is what the paper mentions and the reason why it is valid.

The question in the above is what is the set of points $${\left\{ \boldsymbol{x}_{i} \in \mathbb{R}^{d} \right\}}_{i = 1}^{N}$$?

There are several options with the 2 of the more reasonable ones being:

1. The values defining the contour.
2. All the values in the contour.

For (1) I'd use the median as defined.
For (2) I'd actually just calculate the center of the mass.