Predator(Zdenek Kalal 的 TLD 算法)RGB 模式跟踪 (Matlab)
实际上我正在研究这个算法并且我一直在探索他的代码(目前在Matlab中)。我想知道是否有人尝试过运行这个算法,并且有人可以指出我如何在颜色/RGB 模式下跟踪对象。目前,当我运行它时,它以灰度模式检测对象。
TLD 代码是开源的,位于:https://github.com/zk00006/OpenTLD
我已经探索了代码,有一个文件 img_alloc.m 其中包含:
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);
语句“img.input = rgb2gray(in);”将输入从 RGB 模式转换为灰度模式。当我试图通过将其更改为“img.input = in;”来阻止它时程序以 RGB 模式启动,但在 1 或 2 帧后卡住。
任何帮助将不胜感激。
PS:我是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, 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
那段代码告诉我该算法(或至少这段代码)不处理 RGB 图像。完全没有。
我怀疑这一点的原因很简单,因为它明确检查输入是 1D(灰度)还是 3D(RGB),如果是 3D,则将其转换为灰度。
此外,使用算法处理颜色很少像只提供 3D 矩阵而不是 1D 矩阵那么简单,因为额外的维度通常意味着至少需要一些额外的工作。
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.
有两个组件需要修复:
1. 1BIT 特征 - 您必须将它们应用于不同的颜色平面(也就是说,每个特征必须位于其中一个平面中)
2. Lucas Kanade追踪器;它实际上在彩色方面效果更好(如果您的输入没有噪音;您将需要比灰度更好质量的相机),但 predator 使用的 OpenCV 不包含版本。 (不,我不知道是否有开源的)。
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).