Effacer les filtres
Effacer les filtres

image block indices

2 vues (au cours des 30 derniers jours)
Rusmaya Luthfina
Rusmaya Luthfina le 14 Nov 2011
hi all,
i've this following code
function [rc, gc, bc, out, fileList] = histogram(f)
%------ ini adalah program untuk mentimpan histogram----------
%bersihin dulu variabelnya
% clear all;
%set path tempat siimpan database citra, terus baca semua citra di database
f = 'D:/pengenalan pola/tugas image retrieve/image';
fileList = dir(fullfile(f,'*.jpg'));
%Read in RGB image file.
%baca citra dan bagi citra menjadi 4 blok berukuran sama
%cari nilai pixel masing-masing komponen warna (RGB)
%simpan dalam variabel
for i = 1:length(fileList)
I{i} = imread((fullfile(f,fileList(i).name)));
out{i} = mat2cell(I{i}, ones(120/60,1)*60, ones(120/60,1)*60, 3);
[ra{i} rb{i} rc{i}] = cellfun(@(x) unique(x(:,:,1)), out{i} , 'un', 0);
[ga{i} gb{i} gc{i}] = cellfun(@(x) unique(x(:,:,2)), out{i} , 'un', 0);
[ba{i} bb{i} bc{i}] = cellfun(@(x) unique(x(:,:,3)), out{i} , 'un', 0);
for j = 1:4
rr{i}{j} = rc{i}{j}(ra{i}{j});
end
end
after i run, it shows error:
??? Subscript indices must either be real positive integers or logicals.
Error in ==> histogram at 21 rr{i}{j} = rc{i}{j}(ra{i}{j});
how can i fix it??

Réponses (1)

David Young
David Young le 14 Nov 2011
It doesn't make sense to use ra{i}{j} as an index into rc{i}{j}. You can avoid the error message by swapping their roles,
rr{i}{j} = ra{i}{j}(rc{i}{j});
but since this just reconstructs unique(out{i}{j}(:,:,1)) I'm not sure that it helps. Can you explain what the code is intended to do and how it is meant to work?
  2 commentaires
Rusmaya Luthfina
Rusmaya Luthfina le 15 Nov 2011
i've already solved my problem,, but thx for ur answer..
i'm running image retrieval histogram color based,, but still haven't got the idea what to do with the histogram
Image Analyst
Image Analyst le 15 Nov 2011
Yes, that's apparent. Why not just use imhist()?

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by