Can't convert primitive image to unit8
3 views (last 30 days)
Show older comments
Tanner Metzmeier
on 5 Jun 2018
Edited: Walter Roberson
on 5 Jun 2018
Hey guys so I'm trying to post process an image that matlab retrieved from google maps without saving it as a png or something and reimporting it, however whenever I try to do anything to it, an error is thrown that says incorrect type matlab.graphics.primitiveimage so I tried converting it to a uint8 and im still getting the same error could somebody tell me what I'm doing wrong? If anyone is curious I got 'get_google_map' from here:
lat = 38.363506; lon = -85.923929; zoomlevel = 17;
[XX, YY, M, Mcolor] = get_google_map(lat, lon);
imag = imagesc(XX,YY,M);
shading flat;
colormap(Mcolor)
whos imag
xlabel('Eastings UTM')
ylabel('Northings UTM')
title([num2str(lat) '°N ' num2str(lon) '°W'])
I = im2uint8(imag);
0 Comments
Accepted Answer
Walter Roberson
on 5 Jun 2018
Edited: Walter Roberson
on 5 Jun 2018
When you do
imag = imagesc(XX,YY,M);
then imag becomes a handle to the image() object that is being displayed.
What you should be doing in this particular situation is just
I = uint8(M);
If you want the color version of the map then
I = ind2rgb(M,Mcolor);
0 Comments
More Answers (0)
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!