필터 지우기
필터 지우기

image block indices

조회 수: 2 (최근 30일)
Rusmaya Luthfina
Rusmaya Luthfina 2011년 11월 14일
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??

답변 (1개)

David Young
David Young 2011년 11월 14일
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
Rusmaya Luthfina
Rusmaya Luthfina 2011년 11월 15일
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 2011년 11월 15일
Yes, that's apparent. Why not just use imhist()?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by