필터 지우기
필터 지우기

Detect before Track by particle filter.

조회 수: 4 (최근 30일)
Kamran Ashfaq
Kamran Ashfaq 2016년 11월 25일
편집: Walter Roberson 2016년 11월 25일
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 ;
===================

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by