Colouring specific points in a MATLAB surface plot - matlab

I have a 3 dimensional data set which I intend to analyse. After analysing the data set, basically running an algorithm to find a range of points, I this range of points to have a specific colour so that when someone sees the surface plot, they know which are the points of interest. How can this be achieved?
I have tried to find some help in the mathworks forums, but so far I am not able to find a satisfactory solution.

If you are using the surface function, you can use the 4 parameter version surf(x,y,z,c) where c lets you specify colour based on the currently used colour map. See this link at the mathworks site for more detail http://www.mathworks.co.uk/help/matlab/ref/surf.html

Related

Find the rectangular region encompassing the extracted circle (point of interest) using the method extractSurFFeatures

Good morning, everyone,
I hope you are doing well. Well, I have an image and I would like to extract or detect the points of interest using SURF detector. When I use the method provided by matlab I get the points of interest but for me I would like to get the patches, wish means the area of interest (rectangles), if there is a method you know I will be grateful. Thank you very much for your time and help.
To better explain, i have an image A
and i want to extract the regions (patches) using the function of matlab :
f=extractSurfFeatures(A);
unfortunately this function allows to extract the points of interest but for my case I want to extract the rectangles including these points as mentre the following figure :
patches images
Check out the C++ original SURF version I recently published. There you will find the size of the patches. https://github.com/herbertbay/SURF

MATLAB: Digitizing a plot with multiple variables and implementing the data

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.

Reproduce a colorbar with auto-rescaling between min & max value to use entire spectrum

I am new to matlab and stackexchange too.
I wish to reproduce a colorbar for my own work (guess it was made using tecplot) preferably in MATLAB or python (matplotlib).
Here's an example of what I want to reproduce:
http://iopscience.iop.org/0963-0252/23/1/015007/downloadHRFigure/figure/psst484284fig14
My idea is to have a script which can be run on any x-y-z type of data such that this colorbar is applied in a way that all the colors are used (presume it will be some kind of rescaling?)
This colorbar does not need to display the actual values but just min and max will suffice.
Many thanks for all your help and suggestions.
This answer is for matlab. Since you do not say anything about recreating the colormap I assume that you know how to do that. However, if not, try the colormap editor.
surf(peaks(30));
colormapeditor;
Where peaks is a function creating some good demo data. The colormap can the be obtained from the figure. About your problem: Normally the colormap is automatically scaled to use the full spectrum of your colormap. If this for some reason does not work, set the CLim property to the range of your spectrum. That can for example be the maximum and minimum for your data or some other suitable range.
Good luck!

How to obtain the difference between 2 image in Matlab?

I have 2 scatter plots obtained from an experiment. The images look very similar on a naked eye. I would like to obtain the difference between these 2 images. The 2 images have :
Same Background
Line markers are yellow and blue.
I am not an expert with image processing tools in Matlab. What would be the right approach to highlight the differences in the 2 scatter plots ?
Do we need to plot the scatter plots using the same linemarkers in order to obtain the difference ?
Thanks
You could use the command imshowpair(img1,img2) to compare between images, more help can be found at Mathworks Compare differences between images section.
Simple, in openCV, I would use absDiff which will highlight the difference very well. MatLab too have this function, while I have never used the MatLab's version before, it shouldn't differ too much from the OpenCV version.
Here's the MatLab equivalent: imabsdiff
An example showing how to utilise absdiff for your case: imabsdiff example with code
Do comment if you need anymore help, or if that doesn't solve your problem.

How get coordinates of specific points (i.e turning points) in Matlab

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.