Detect before Track by particle filter.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Image Analyst
am 25 Nov. 2016
Bearbeitet: Image Analyst
am 25 Nov. 2016
And attach 'r32.jpg' so we can run your code.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing and Computer Vision finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!