Detect before Track by particle filter.
조회 수: 5 (최근 30일)
이전 댓글 표시
i am trying to find out bhattacharyya distance for likelihood calculations. i wrote the following code and getting a wrong answer. please go through the code and help me out.
=================
rgbimageR = imread('r32.jpg');
rgbimage = imread('r36.jpg');
%imshow(rgbimage);
figure;
%Split into RGB Channels
RedR = rgbimageR(:,:,1);
GreenG = rgbimageR(:,:,2);
BlueB = rgbimageR(:,:,3);
Red = rgbimage(:,:,1);
Green = rgbimage(:,:,2);
Blue = rgbimage(:,:,3);
figure ;
imshow(RedR);
figure;
%imhist(RedR,7);
[countsR,binLocationsR] = imhist(RedR,5);
stem(binLocationsR,countsR);
[rowsR,colsR]=size(RedR);
figure;
[countsG,binLocationsG] = imhist(GreenG,5);
stem(binLocationsG,countsG);
[rowsG,colsG]=size(GreenG);
figure;
[countsB,binLocationsB] = imhist(BlueB,5);
stem(binLocationsB,countsB);
[rowsB,colsB]=size(BlueB);
figure;
%imhist(Red,7);
[counts,binLocations] = imhist(Red,5);
stem(binLocations,counts);
[rows,cols]=size(Red);
%btacoffi=0; %p=zeros(rows,1);
btacoffiR = zeros(5,1);
btacoffiG = zeros(5,1);
btacoffiB = zeros(5,1);
%co =1;
for ro = 1:5 ;
btacoffiR(ro) = btacoffiR(ro) + sqrt((countsR(ro))*(counts(ro)));
btacoffiG(ro) = btacoffiG(ro) + sqrt((countsG(ro))*(counts(ro)));
btacoffiB(ro) = btacoffiB(ro) + sqrt((countsB(ro))*(counts(ro)));
%btacoffi = sqrt((countsR(ro,co))*(counts(ro,co)));
%btacoffi = btacoffi+btacoffi;
end
%btadis = sqrt(1-btacoffi);
btadisR=0;
btadisG=0;
btadisB=0;
for i=1:5
btadisR=btadisR + sqrt(1-btacoffiR(i));
btadisG=btadisG + sqrt(1-btacoffiG(i));
btadisB=btadisB + sqrt(1-btacoffiB(i));
end
btadis = btadisR + btadisG + btadisB ;
===================
댓글 수: 1
Image Analyst
2016년 11월 25일
편집: Image Analyst
2016년 11월 25일
And attach 'r32.jpg' so we can run your code.
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!