Extract numeric values from a colormap
10 次查看(过去 30 天)
显示 更早的评论
Hello everyone
I am trying to extract the numerical values of a variable represented in the following colormap with its respective colorbar (which I also attach in PDF format):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1698666/image.png)
It would be very desirable to be able to create a database based on the spatial deviation from the center of the hexagon along the directions defined by the a1 and a2 vectors as a fraction of a0, being a0 the modulus of the aforementioned vectos:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1698671/image.png)
Any idea?
0 个评论
回答(1 个)
Image Analyst
2024-5-19
编辑:Image Analyst
2024-5-19
You need to read that colorbar part of the image and then divide by 255.
colorsInBar = rgbImage(row1:row2, col1:col2, :);
[r, g, b] = imsplit(colorsInBar);
cMap = double([r(:), g(:), b(:)]) / 255;
You may be interested to see how I did it for thermal images:
To get the numbers you can use ocr in the Computer Vision Toolbox, but the numbers must be at least 20 pixels high.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!