提高直方图反投影的速度
我目前正在使用 OpenCV 的内置基于补丁的直方图反投影 (cv::calcBackProjectPatch()
) 来识别图像中目标材料的区域。图像分辨率为 640 x 480,窗口大小为 10 x 10,处理单个图像大约需要 1200 毫秒。虽然结果很好,但这对于实时应用程序来说太慢了(处理时间应该不超过约 100 毫秒)。
我已经尝试过减小窗口大小并从 CV_COMP_CORREL 切换到 CV_COMP_INTERSECT 来加快处理速度,但没有看到任何明显的加速。 OpenCV 文档可以对此进行解释(重点是我的):
测量每个新图像,然后 转换为图像图像数组 超过选定的投资回报率。直方图是 取自该图像的某个区域的图像 被一个带有锚点的“补丁”覆盖 如下图所示居中。 使用以下公式对直方图进行归一化 参数norm_factor,以便它可以 与历史进行比较。计算出的 直方图与模型进行比较 直方图; hist 使用 函数 cvCompareHist() 进行比较 方法=
方法
)。由此产生的 输出放置在该位置 对应于补丁锚点 概率图像 dst。这 重复该过程作为补丁 滑过了投资回报率。 迭代直方图 通过减去尾随像素进行更新 被补丁覆盖并添加新的 直方图覆盖的像素可以 虽然省去了很多操作 尚未实施。
这给我留下了几个问题:
- 是否有另一个库支持迭代直方图更新?
- 使用迭代更新可以带来多大的加速?
- 还有其他技术可以加速此类操作吗?
I am currently using OpenCV's built-in patch-based histogram back projection (cv::calcBackProjectPatch()
) to identify regions of a target material in an image. With an image resolution of 640 x 480 and a window size of 10 x 10, processing a single image requires ~1200 ms. While the results are great, this far too slow for a real-time application (which should have a processing time of no more than ~100 ms).
I have already tried reducing the window size and switching from CV_COMP_CORREL
to CV_COMP_INTERSECT
to speed up the processing, but have not seen any appreciable speed up. This may be explained by the OpenCV documentation (emphasis mine):
Each new image is measured and then
converted into an image image array
over a chosen ROI. Histograms are
taken from this image image in an area
covered by a “patch” with an anchor at
center as shown in the picture below.
The histogram is normalized using the
parameter norm_factor so that it may
be compared with hist. The calculated
histogram is compared to the model
histogram; hist uses The function
cvCompareHist() with the comparison
method=method
). The resulting
output is placed at the location
corresponding to the patch anchor in
the probability image dst. This
process is repeated as the patch is
slid over the ROI. Iterative histogram
update by subtracting trailing pixels
covered by the patch and adding newly
covered pixels to the histogram can
save a lot of operations, though it is
not implemented yet.
This leaves me with a few questions:
- Is there another library that supports iterative histogram updates?
- How significant of a speed-up should I expect from using an iterative update?
- Are there any other techniques for speeding up this type of operation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 OpenCV 积分直方图中提到的,肯定会提高速度。
请查看以下链接中的示例实现
http://smsoftdev-solutions.blogspot.com /2009/08/integral-histogram-for-fast-calculation.html
As mentioned in OpenCV Integral Histograms will definitely improve speed.
Please take a look at a sample implementation in the following link
http://smsoftdev-solutions.blogspot.com/2009/08/integral-histogram-for-fast-calculation.html