I'm looking to automate the finding of a location on a plot.
this is the plot
I want my code to automatically find the point where the plot smoothes out. The point that is highlighted in the plot. I did this by hand with the selector tool, but I need to do it for many different plots, so selecting them each by hand would take too long.
Is there anyway to automate this process?
Related
I would like to follow a curve (with matlab or opencv) and to find the other end of it when it is cut by an empty space like this example, which is simplified to illustrate the problem:
Link to image of cut curve
Real images are more like this one: Link to real image to analyse
To follow the curve, I can use a skeleton and look at the neighbourhood. The problem is that I don't know how to find the other end efficiently.
I don't think that closing or opening operations could help because as shown on the previous image, there are other curves and the two parts of the curve are quite far from each other so it could lead to boundaries between the different curves instead of the two parts.
I was thinking about polynomial evaluation which could be a solution for simple curves but I am not sure about the precision I could get. If I use a skeleton, I have to find exactly the right pixel or to search in a reasonable neighbourhood which would take some time and once again, as there are other curves in the images, I have to be sure that I will find the good one.
That's why I am searching for an existing function which could estimate precisely the trajectory of the curve and give an usefull output to go further and find the second part of the curve.
If that kind of function doesn't exist, I'm open to any other way of analysing the problem if it can help.
I will start to explain with the first image you provided, you can implement common OpenCV function useful for detecting contour(black region in your case as you have binary image) known as cv2.findContours(), which returns the coordinates of the edges of the surface detected then you can plot each detected contour separately in a blank image to get the edge of your desired line.
Now coming to your 2nd image you have to be slightly careful while performing above analysis as there are many tiny lines. get back to me for further help
I have 8 plots which I want to implement in my Matlab code. These plots originate from several research papers, hence, I need to digitize them first in order to be able to use them.
An example of a plot is shown below:
This is basically a surface plot with three different variables. I know how to digitize a regular plot with just X and Y coordinates. However, how would one digitize a graph like this? I am quite unsure, hence, the question.
Also, If I would be able to obtain the data from this plot. How would you be able to utilize it in your code? Maybe with some interpolation and extrapolation between the given data points?
Any tips regarding this topic are welcome.
Thanks in advance
Here is what I would suggest:
Read the image in Matlab using imread.
Manually find the pixel position of the left bottom corner and the upper right corner
Using these pixels values and the real numerical value, it is simple to determine the x and y value of every pixel. I suggest you use meshgrid.
Knowing that the curves are in black, then remove every non-black pixel from the image, which leaves you only with the curves and the numbers.
Then use the function bwareaopen to remove the small objects (the numbers). Don't forget to invert the image to remove the black instead of the white.
Finally, by using point #3 and the result of point #6, you can manually extract the data of the graph. It won't be easy, but it will be feasible.
You will need the data for the three variables in order to create a plot in Matlab, which you can get either from the previous research or by estimating and interpolating values from the plot. Once you get the data though, there are two functions that you can use to make surface plots, surface and surf, surf is pretty much the same as surface but includes shading.
For interpolation and extrapolation it sounds like you might want to check out 2D interpolation, interp2. The interp2 function can also do extrapolation as well.
You should read the documentation for these functions and then post back with specific problems if you have any.
I am workin on a some sort of System test wherein i have a set of readings in the form of a .mat file.
It has a structure in the .mat file with one field as Measurement. It has several Arrays(e.g air mass flow, velocity, carbon content) which further have fields like time and value.
From these, I Need to plot the velocity and the air mass flow against time. For that i wrote the following command which gave me the corresponding plots:
plot(Measurement.(Measurement.air_mass_flow.time),Measurement.air_mass_flow.value)
plot(Measurement.(Measurement.velocity.time),Measurement.velocity.value)
Now i Need to create a script in matlab wherein i can get both the curves one under the other i.e. on the same page. Can anyone help in the Approach i should procede with ?
ok now i will further extend my question.
I have two fields as velocity and acceleration. I Need to plot it on the same curve with grids on for the comparison. But the y axis for both are different.
the velocity y-axis is: (0:20:120), which should be displayed on the left side and the acceleration y-axis is: (0:2:12) which should be displayed on the right side.
i wrote the following code for this:
plot(Measurement.(Measurement.VehV_v.time),Measurement.VehV_v.value)
grid on
set(gca,'xtick',[0:500:2000])
set(gca,'ytick',[0:20:120])
hold on
plot(Measurement.(Measurement.accel_w.time),Measurement.accel_w.value)
grid on
set(gca,'xtick',[0:500:2000])
set(gca,'ytick',[0:2:12])
Do i Need to write a function for that as i am directly reading the values from the structure.
plotyy() also doesnt seem to work
But the axis are not matching and the graph for acceleration is very small. Could anyone help me out with this ?
I also want to add a Picture of the Graphs here but unfortunately there is some error here. I hope the question is clear without the Picture.
Yes you can use the subplot command, e.g.:
figure
subplot(1,2,1)
plot(Measurement(Measurement.air_mass_flow.time),Measurement.air_mass_flow.value)
subplot(1,2,2)
plot(Measurement.(Measurement.velocity.time),Measurement.velocity.value)
You can use help subplot on Matlab for further details or have a look at this:
https://www.dartmouth.edu/~rc/classes/matlab_graphics/Matlab-subplots.html
I am trying to plot Phase Transition Diagram similar to the one shown below:
Right now, I am able to determine what the phase is for a given point (T,P) (whether it's water or ice or vapor). However, I am having trouble figuring out how to plot the boundary lines (such as the liquidus and solidus lines) like the ones in the figure.
I am not sure whether this is a proper question to ask here, but any input would be much appreciated! Thanks.
I have a set of (X, Y) coordinates which, when plotted produce a graph as in the pictures below. What I am trying to do, is to find the coordinates of the areas (corner points) circled in red.
I have been trying to find ways to accomplish this, as those actual turning points represents my area of interest. Please note that I do not have the actual equation for those coordinates.
I would find it grateful if someone could please advise me, or give me some directions on how to go about this, either by using Matlab, or even some other ideas using some C++ tools.
I manage to solve this using a combinaison of the Point Cloud Library and Matlab. The former helped me to separate the coordinates in line segments (RANSAC) and using the latter, I was able to get the Equation of each line segments (Curve Fitting), and simply compute the intersection point through some basic math calculation.