%clc, clear, close all
A = imread('image.jpg');R = A(:, :, 1);G = A(:, :, 2);B = A(:, :, 3);[m,n] = size(A);total = m*n;color = zeros(total,3);freq = zeros(total);index = 1;for i = 1:172 for j = 1:276 X(1) = R(i,j); X(2) = G(i,j); X(3) = B(i,j); if i==1 && j==1 color(index,1) = X(1); color(index,2) = X(2); color(index,3) = X(3); freq(index) = 1; else k = index; while k >= 1 if color(k,1)== X(1) && color(k,2)== X(2) && color(k,3)== X(3) freq(k) = freq(k)+1; break; end k = k-1; end if k < 0 index = index + 1; color(index,1) = X(1); color(index,2) = X(2); color(index,3) = X(3); freq(index) = 1; end end endendC = sort(freq, 'descend');fprintf('\n');fprintf('\t Number \t Frequency\n');for i = 1 : index fprintf '('color(i,1)','color(i,2)','color(i,3)' = 'freq(i)'\n' ;end
MATLAB: Please help me run this code, as i am unable to solve an error.
#single errorImage Processing Toolbox
Best Answer