Remove outliers from a noisy curve
Expanding my comment:

One can use a regression method (eg linear, non-linear, symbolic, ..) to try to fit a curve to the data.

Outliers can be removed in 1 or 2 steps:
2.a. Remove some points before applying regression, eg by testing how much away they are wrt to std.
2.b. Remove outliers after fitting the curve and measuring distance of point from curve and discard if above a certain threshold.


[UPDATE]
In curve fitting using regression, one rarely has knowledge of the actual curve, instead one assumes the curve belongs to some class of functions and tries various options.
Furthermore, there are what are called symbolic regression methods, which assume even less about the actual curve and can even find functions in implicit form, although more tedious.
Finally, some pre-processing to remove outliers before applying regression (eg discard points very &quot;far&quot;, density-based approaches, ..) can certainly improve the outcome based on reasonable domain-based assumptions.
The above will work for most of the cases presented in question. This is an ill-posed inverse problem, so one should make some assumptions and have reasonable expectations.
[UPDATE 2]
If your data is only 2D image data and you simply need to get the curve as an image (and not need to infer any analytical form of the curve), then doing a combination of blur/lowpass filtering and edge detection, can be an option. OpenCV, for example, has methods to achieve that.
References:

An edge detection based noise removal algorithm


We present an image denoising method using the edge map of an image.
The denoised image is considered as a linear combination of the
observed image and its average value, where the coefficients are
controlled by a local edge detector. The parameters are set on
suitable values related to noise energy computed by the curvature norm
of the original image. Implementation can be done in a single
iteration and the speed of the process is reasonably high. Noise
reduction quality of the introduced method is compared with Wiener and
Total Variation based filters for some images. The method appears to
be easy, fast and useful for very noisy images. The differences
between our method and the patent 6229578 “Edge Detection Based Noise
Removal Algorithm” are explained.


How to remove the noise without destroying the main edge?

Canny Edge Image - Noise removal