Bir resmin rgb değerlerini (80 * 120) dönüştürerek bir çeşit hsv histogramı yapmaya çalışıyorum. Bu kodu verilmiştir: hsvHistogram: A(I,J,...): index to dimension 2 out of bounds; value 121 out of bound 120
Sınırlardan şüpheli Okunak
rgb2hsv piksel dönüştürücü bir piksel: i her zaman hata alıyorum HSV matrisi elde etmeye çalışmak zaman
function Image_histogram = hsvHistogram(path, count_bins)
Image = double(imread(path));
Image_histogram = zeros(3 * count_bins);
[n m] = size(Image);
H_vect = zeros(n, m);
S_vect = zeros(n, m);
V_vect = zeros(n, m);
hue_vect = zeros(1, count_bins);
saturation_vect = zeros(1, count_bins);
value_vect = zeros(1, count_bins);
for line = 1 : n
for row = 1 : m
%[H_vect(line, row), S_vect(line, row), V_vect(line, row)] = rgb2hsv(Image(line, row, 1), Image(line, row, 2), Image(line, row, 3));
endfor
endfor
number = 100/count_bins;
for count = 0 : count_bins - 1
left = (number * count);
right = (number * count + number);
hue_vect(1, count + 1) = (sum(sum(H_vect(:,:) >= left & H_vect(:,:) < right)));
saturation_vect(1, count + 1) = (sum(sum(S_vect(:,:) >= left & S_vect(:,:) < right)));
value_vect(1, count + 1) = (sum(sum(V_vect(:,:) >= left & V_vect(:,:) < right)));
endfor
Image_histogram = horzcat(hue_vect, saturation_vect, value_vect);
endfunction
. R G B'yi H S V'ye dönüştürür. Yerleşik rgb2hsv işlevi değildir. Yorumlanan çizgi problemli olanı gibi görünüyor.
Eğer yorumlanan satır hatayı atarsa, bu satırın 'rgb2hsv()' nizi içerdiğini düşünürsek, bu tür işlevler için de kodu eklemelisiniz. Aksi halde yardım edemeyiz. Görünüşe göre bu işlevin içinde yanlış bir şeyler var. – Alessiox
rgb2hsv işlevi burada açıklanan http://www.rapidtables.com/convert/color/rgb-to-hsv.htm işlevidir. Tek fark, [0,100] aralığında H S V'm var. H = (H/360) * 100, S = (delta/Cmax) * 100, V = Cmax * 100 – RobertD