I plot a second-order polynomial using the following code in Matlab:
xx = 1 : 4000;
mu = 1.0e+03 * [ 2.0733; 0.6569];
b = 198;
P = [2.5577, -1.0134, 102.4344];
figure;imshow(img,'border','tight');
hold on;
plot(xx,polyval(P,xx,[],mu)+b,'LineWidth',1.5,'Color','r');
It results the following image:
However, if I comment out the figure;imshow(img,'border','tight');
it shows the following curve:
First, I don't know why these two plots differ and which is the right plot of the polynomial.
Second, I look for a measure for the degree of bending for the object shown in Figure 1, so that I be able to compare two objects with low or high bending (curvature). However, I don't know how to extract such a measure from the polynomial formula. I tried to use the coefficient of x^2
(P(2)), but I am not sure if it is a representative of the curve in Figure 1, because Figure 2 shows something different.
First part: If you are referring to the sign of curvature, you should notice the coordinate systems in an image or in a matrix and that of a plot. When we plot
, as in your plot, usually the lower-left corner corresponds to the minimum of both x- and y-axis. Whereas in an image coordinate system, you have something like:
The coordination (with row and column index) starts from the upper-left corner.
The other visual difference between the two curves is their absolute curvature, and that is due to nothing but the axis limits. If you set the axis limits to be equal you will see two equally bent curves. Use xlim
and ylim
for this purpose.
Second part: If you want to quantify the load / pressure / weight applied to the system, the absolute value of the coefficient of x^2
is a monotonic variable. Therefore you can rely on it solely and calibrate it with applying different known amounts of stress to the system.