Sinusoidal fit with some points fixed

In summary, the conversation discusses a method for digitizing tidal lines from photographs using Matlab. The process involves selecting index pairs based on pixel contrast and then fitting a sinusoid to these pairs. However, there is an issue with eliminating some true line segments based on restrictive length criteria. The solution proposed is to reintroduce these segments if they intersect with the sinusoidal curve fit or have a similar slope. The conversation also mentions the use of five tidal constituents for accuracy and the potential for decreasing accuracy if only a short time period is shown in the photograph. Additionally, there are discussions about the accuracy of the fit around high and low water marks and the method for determining which points are closest to the approximate tidal line.
  • #1
edge333
16
0
I'm doing some image processing of some tidal lines that I'm trying to digitize from photographs using Matlab. The digitization is heavily dependent on the indexing of the image of x-values (time) and y-values (water level). After some initial processing based on pixel contrast, line continuity and minimum color (darkest) criteria, I need to fit a sinusoid to the resulting selected index pairs. For every x-value there is only one y-value.

The gist of the digitization procedure is that the contrast values are initially chosen to generate a series of line segments, which are then expanded upon by a forward and backward contrast trace (like the old-school video game Snake). It's an iterative process where some line segments get eliminated from the overall array based on length and RMSE criteria. However, the length criteria can be too restricted and eliminates lines that really are part of the tidal signal but they just don't fully connect to a larger line because of white space existing between the lines.

My problem is that I need to find a way of reintroducing these eliminated 'true' line segments without reintroducing 'false' tidal line segments. The method I came up with is to do a full image-scale sinusoidal curve fit using the fit and fitOptions functions. Then having the segments re-introduce if they intersect that fit line or have a similar slope over the line segment time domain.

This doesn't have to be a fit to determine the tidal constants as with most tidal harmonic analysis. Just accurate enough to get a precise fit. The problem, as with most harmonic analysis, is that the highs and lows are not really accurate. This accuracy is important for the image processing because it forces the ebb and flood regions to be constrained within the time of the extrema.

Is there a way to fix the high and low index values in place while the remaining points are fit to the curve?

Here is the set-up I have now:

xinput( yinput == 9999 ) = [];
yinput( yinput == 9999 ) = [];

% ffit = fittype('sin3');
fitOptions = fitoptions('sin5');
newOptions = fitoptions(fitOptions,'Robust','Bisquare','Normalize','on');
y_fit = fit( xinput, yinput, 'sin5', newOptions );​

I have it at 'sin5' because it increases the accuracy of the fit and not because of the number of potential tidal constituents being 5 (i.e. M2, S1, K1, M4, P1 ).

However, I have also thought about establishing the relative deterministic frequencies of the above mentioned constituents in relation to the pixel span. This might cut down on the number of iterations required. Then again, this might decrease accuracy because the image only shows the tide signal for a day and a half rather than a month necessary to actually do harmonic analysis.
 
Last edited:
Mathematics news on Phys.org
  • #2
This is the image zoomed in:

zoom_in.png

  1. The blue lines are initial contrast points that the segments grow from.
  2. The cyan points indicate a segment that was retained by the length and RMSE requirement
  3. The red points are the forward and backward pixels from the cyan point that were not chosen to be included because they were further away from the thick magenta line.
  4. The yellow points are the final line values for that iteration.
  5. The red line is the fitted sinusoid based on 'sin5'
  6. (The thin magenta line is the final line values in line form from the fit - not important because it is the same as the yellow points)
Note that the bottom darkened pixels are not the true tidal line but are cross-hairs indicating high or, in this case, low water (low water is to the left of the image).

Here is the same image fully zoomed out:

zoom_out.png


The green points (hard to distinguish with cyan) indicate a segment that was retained by the length but NOT the RMSE requirement.

The following is a zoom in of the second low water:

zoom_low.png


Essentially the thin red line fit is supposed to be an iterative replacement for the thick magenta line. However, as you can see it doesn't do all the well around the high and low water marks that intersect the cross-hairs. This is important for more than just re-introducing the eliminated 'true' line segments.

The magenta line (and hopefully the future red line) is used to determine which sets of red points are closest to the approximate tidal line that become yellow points. Red points further away are disregarded.

There are occasionally situations where this line is too inaccurate to distinguish between the tide and the cross-hairs (and occasionally hand-written notes).
 

What is sinusoidal fit with some points fixed?

Sinusoidal fit with some points fixed is a statistical technique used to fit a sinusoidal curve to a set of data points while also fixing certain points to specific values. This allows for a more accurate representation of the data and can provide insights into the underlying sinusoidal pattern.

How does sinusoidal fit with some points fixed differ from other curve fitting methods?

Sinusoidal fit with some points fixed is unique in that it takes into account the specific values of certain points in the data set, rather than just fitting a general curve to all the points. This can provide a more accurate and nuanced understanding of the data.

What are some common applications of sinusoidal fit with some points fixed?

Sinusoidal fit with some points fixed is commonly used in fields such as physics, engineering, and finance to analyze data with periodic patterns. It can be used to predict future values, identify trends, and make informed decisions based on the data.

What are the benefits of using sinusoidal fit with some points fixed?

Sinusoidal fit with some points fixed allows for a more accurate and precise analysis of data with a sinusoidal pattern. It also provides the ability to fix certain points, which can help to better understand the underlying trends and fluctuations in the data.

What are the limitations of sinusoidal fit with some points fixed?

Sinusoidal fit with some points fixed relies on the assumption that the data follows a sinusoidal pattern, so it may not be applicable to all types of data. Additionally, the fixed points may not accurately represent the true values, leading to potential errors in the analysis.

Similar threads

  • STEM Academic Advising
Replies
13
Views
2K
Back
Top