필터 지우기
필터 지우기

How to assign Pixel values to the entire images?

조회 수: 3 (최근 30일)
Mohan Prasath Thirumalaisamy
Mohan Prasath Thirumalaisamy 2013년 1월 16일
Hi, I have set of images and then i need to make those images into 32*32. I did this by using imresize. Now i have 32*32 pixel image, then i need to image pixel value between 0 and 1. I know that i can use rand(32, 32) to have values between 0 and 1. how i can give it to the image?
  댓글 수: 1
Jan
Jan 2013년 1월 16일
The question is not clear. What does "giving to the image" mean?

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

채택된 답변

Matt J
Matt J 2013년 1월 16일
a=min(A(:));
b=max(A(:));
B=(A-a)/(b-a);
  댓글 수: 5
Matt J
Matt J 2013년 1월 16일
편집: Matt J 2013년 1월 16일
It also assumes that max(A(:))=255 which need not be the case. But the kind of normalization asked for here is still not clear (the image could be the first in a series ranging from 0 to 255 for example). So, it could be valid...
Mohan Prasath Thirumalaisamy
Mohan Prasath Thirumalaisamy 2013년 1월 16일
hi really thanks for your idea.

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

추가 답변 (1개)

Jurgen
Jurgen 2013년 1월 16일
Not 100% sure what format your images are, but try this:
If A is your 32x32 image, then
A = mat2gray(A)
will scale it to 0-1. Alternatively, if you want to keep relative intensities: use
A = im2double(A).
If your image contains real values in a larger range (that contains the 0-1 subrange), and you only want to show the pixels in that 0-1 range: (and clip others at black or white)
A = mat2gray(A,[0 1])

카테고리

Help CenterFile Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by