フィルターのクリア

How do I get a colormap from JPEG file?

15 ビュー (過去 30 日間)
Julián Francisco
Julián Francisco 2011 年 10 月 24 日
コメント済み: Walter Roberson 2016 年 6 月 7 日
Hi. I have a jpg image file of the surface of Neptune. My intention is to build a texture mapping ( see Matlab's help about this topic ). I have used the command imread with the file but jpg files have not a colormap (in general, the command imread produces an MxNx3 matriz and a colormap is a Mx3 matrix). I would like to know how I could do it.
Like a image is more valuable than 1000 words (sometimes), my purpose is doing something like that (see example) but for Neptune.
  2 件のコメント
Image Analyst
Image Analyst 2011 年 10 月 24 日
The jpg image is a true color image. What do you mean by a topographic image? You mean like a geological survey topographic map with contour lines on it and you want that somehow transferred to the surface of a spherical object? What proportion of the sphere should this 2D rectangle cover? A tiny spot? A whole hemisphere? Something in between? Or do you want some kind of 2.5D terrain image with mountains and things sticking above the surface of the sphere?
Julián Francisco
Julián Francisco 2011 年 10 月 24 日
@Image Analyst: Thank you for your interest. The image is a 2d representation of the whole surface (longitude [0,360] degrees and latitude [-90,90] degrees). I want to transform the colordata into altitude z about the sphere.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2011 年 10 月 24 日
You can use the two-output form of rgb2ind() to extract a colormap from a true-color image.
I am not certain how you plan to map colormap indices to altitudes, though.
  1 件のコメント
Julián Francisco
Julián Francisco 2011 年 10 月 24 日
@Walter Roberson: Ok, you are right. I was wrong (I thought the colour of the image was based on the altitude about Neptune's surface through some type of transformation). Thank you so much for your answer.

サインインしてコメントする。

その他の回答 (2 件)

Julián Francisco
Julián Francisco 2011 年 10 月 24 日
Here is the solution for my question based on the answer of Walter Robertson:
[X, map] = rgb2ind(imread('neptune.jpg'),128);
[x,y,z] = sphere(50);
x = 24764*x;
y = 24764*y;
z = 24764*z;
props.FaceColor= 'texture';
props.EdgeColor = 'none';
props.Cdata = flipud(X); % it is necessary to do this for getting the
% appropiate image on the sphere
surface(x,y,z,props);
colormap(map);
axis equal;
view([71 14]);

user4552
user4552 2016 年 6 月 7 日
how can you convert 2D image to 3D image, knowing that the first image is color image but 2D?

カテゴリ

Help Center および File ExchangeBlue についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by