Form an image of vertical ramp having a ramp values from 0 to 255 and dimension 256x256.

조회 수: 7 (최근 30일)
scripy for that???

채택된 답변

John BG
John BG 2017년 1월 25일
Pravin
this is ramp
A=uint8(repmat([0:1:255]',1,256))
imshow(A)
.
you can save the image in JPEG format:
.
imwrite(A,'ramp.jpg')
.
if this is the kind of ramp you are looking for would you please be so kind to mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John BG
  댓글 수: 8
Guillaume
Guillaume 2017년 1월 26일
@John,
As pointed out by Image Analyst, it is a default install of the latest version, R2016b, that gives the warning.
As for 2017-prerelease, as per the NDA you implicitly agreed to if you downloaded it, we're not allowed to talk about it.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jorge Mario Guerra González
Jorge Mario Guerra González 2017년 1월 24일
편집: Jan 2017년 1월 26일
I suppose you want a ramp horizontally, since you only want values from 0-255 in a 256x256 matrix. Filled with integers.
X=uint8(0:255);
x=meshgrid(X,X);
imshow(x, [])
  댓글 수: 3
Jan
Jan 2017년 1월 25일
편집: Jan 2017년 1월 25일
@Jorge: The image is displayed correctly either if you use:
X = uint8(0):uint8(255);
or:
X = linspace(0, 1, 256);
Jorge Mario Guerra González
Jorge Mario Guerra González 2017년 1월 25일
편집: Jorge Mario Guerra González 2017년 1월 25일
Sorry I wrote the code before without using matlab.
X=0:255;
x=meshgrid(X,X);
imshow(x,[]) %although it uses more memory
that one works as well using imshow(x,[ ]), I corrected it

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by