Predator (TLD Algorithm of Zdenek Kalal) Tracking in RGB MODE (Matlab)
Actually I am studying this algorithm and I have been exploring his code (which is currently in Matlab). I was wondering if anyone has tried running this algorithm and could anyone point me out how to track objects in Color/RGB mode. Currently, when I run it, it detects object in Grayscale mode.
TLD Code is open source and located at : https://github.com/zk00006/OpenTLD
As far as I have explored the code开发者_JAVA百科, there is a file img_alloc.m which contains:
function img = img_alloc(in,imsize)
% Allocates image structure.
if ischar(in)
in = imread(in);
end
if ndims(in) == 3
img.input = rgb2gray(in);
else
img.input = in;
end
%img.input = fliplr(img.input);
if exist('imsize','var')
img.input = imresize(img.input,imsize);
end
img.blur = img_blur(img.input,2);
The statement "img.input = rgb2gray(in);" converts input from rgb to grayscale mode. When I try to stop it by changing it to "img.input = in;" the programs starts in RGB mode but gets stuck after 1 or 2 frames.
Any help would be much appreciated.
P.S: I am a newbie in Matlab Programming.
That piece of code tells me that the algorithm (or atleast this code) does not handle RGB images. At all.
My reason to suspect this is simply because it explicitly checks if the input is 1D (grayscale) or 3D (RGB) and if it is 3D it converts it into grayscale.
Also, handling color with an algorithm is seldom as simple as just feeding it a 3D matrix instead of 1D matrix since the extra dimensions usually mean that at least some additional work is required.
There are two components that need fixing: 1. the 1BIT features - you'll have to make them apply to the different color planes (that is, each feature will have to be in one of the planes) 2. The Lucas Kanade tracker; it actually works better in color (if your input is not noisy; you will need a better quality camera than for grayscale), but OpenCV used by predator does not include a version. (and no, I don't know if an open source one is available).
精彩评论