Reputation: 107
I read an image in using I = imread('myimg.jpg')
, then did hsv = rgb2hsv(I)
but now I'm stuck in doing the following:
"Go through each element of HSV(i,j,3)
[i
and j
are like for loop counters] and scale the value from 0-1 to 1-256 and use that value as the index into your histogram."
I'm new to matlab so I'm very unsure as to how to do this. Can anyone help me out?
Thanks
Upvotes: 3
Views: 67
Reputation: 83457
Use the colon operator:
I = imread('myimg.jpg');
hsv = rgb2hsv(I);
scale_factor = 255
result = hsv(:, :, 3) * scale_factor + 1
Upvotes: 3