Image Normalization between range 0 - 1

1 次查看(过去 30 天)
I need help with my project. My supervisor said to normalize an image within the range of 0 - 1 which i did, but he wants it to give just one value instead of the matrix values its generating. This is the code i used to normalize
function normImage = NPSS(img)
clear all
img = imread('ps.jpg','jpg');
normImage = mat2gray(img);
  1 个评论
Guillaume
Guillaume 2016-11-11
编辑:Guillaume 2016-11-11
What does "give just one value instead of the matrix values its generating" mean? Why don't you ask your supervisor if you haven't understood what he/she means?
Note that clear all must not be used in a function (and really shouldn't be used in scripts either). The only reason it doesn't cause your function to fail is that you're not using the function input.

请先登录,再进行评论。

回答(2 个)

Bjorn Gustavsson
Bjorn Gustavsson 2016-11-11
It sounds like you need to ask your advisor what he wants. In my not necessarily humble opinion images ought to contain different values in many pixels. As a first guess I assume that he wants you to select some threshold level and set all pixel with intensities above that to 1 and those below to 0, but ask for clarification...
HTH,

Image Analyst
Image Analyst 2016-11-11
Offer him the value 42.
function justOneValue = NPSS(img)
justOneValue = 42;
If he's not happy with that then ask him why not.
  1 个评论
Guillaume
Guillaume 2016-11-11
Having been a supervisor to a few students, I strongly suspect that the issue is not with what the supervisor asked but with the student's understanding and rewording of what was asked.
... or we can build a supercomputer to know what the question was. Less than 2 millions more year to wait... as long as the Vogons don't build that highway...

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by