How can I index color bar values from an image generated using Matlab imagesc? I want to be able to index them in the command window.
27 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I created a range plot using the matlab command
where G is range data
figure
colormap(jet)
imagesc(20*log10(abs(G)))
xlabel('No. of Sweeps')
ylabel('Range')
title('Range Profiles')
clim = get(gca,'CLim');
set(gca, 'CLim', clim(2)+[-40,0]);
colorbar
axis xy
The image created in colomarp has associated color bar values for each pixel in the image. I want to be able to index row element/pixels using the matlab command and use their associated colobar value instead of the actual pixel value.
Thanks
0 Commenti
Risposte (1)
Walter Roberson
il 23 Mag 2018
mat2gray() to do the equivalent of imagesc's mapping between minimum and maximum value. im2uint8() to transform to uint8. Then use ind2rgb.
Or use histc() or histcounts() to transform values to bin numbers, and use the bin numbers to index the colormap. Or just map.
cmap = jet;
mapped_data = 20*log10(abs(G));
min_mapped = min(mapped_data(:));
max_mapped = max(mapped_data(:));
ind = ceil((mapped_data - min_mapped) .* (max_mapped - min_mapped) * size(cmap,1));
ind(ind == 0) = 1;
RGB = cmap(ind, :);
4 Commenti
Image Analyst
il 24 Mag 2018
Not exactly sure what "how do I know which pixel i am indexing by just looking at the image?" means, but you can see the pixel value at a particular (x,y) location in an image by using ginput(1), impixelinfo(), or imtool(). With the intensity or index, and caxis() and the colormap() you can also get the RGB color the index/intensity is mapped to.
Vedere anche
Categorie
Scopri di più su Blue in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!