网站建设和制作,厦门网站建设680,搜狗搜图,怎么给网站做域名重定向背景
今天#xff0c;在使用模板匹配的时候#xff0c;突然程序卡死#xff0c;CPU直接飙到100%。最后排查发现是模板匹配其中一个参数 NumLevels 导致的#xff1a; NumLevels: The number of pyramid levels used during the search is determined with numLevels. If n…背景
今天在使用模板匹配的时候突然程序卡死CPU直接飙到100%。最后排查发现是模板匹配其中一个参数 NumLevels 导致的 NumLevels: The number of pyramid levels used during the search is determined with numLevels. If necessary, the number of levels is clipped to the range given when the shape model was created with CreateShapeModel. If numLevels is set to 0, the number of pyramid levels specified in CreateShapeModel is used. 大致意思是
NumLevels: 搜索期间使用的金字塔级别数由 numLevels 确定。
CreateShapeModel 创建形状模型时会有一个范围我平时使用的是”auto“
如果 numLevels 设置为 0则使用 CreateShapeModel 中指定的金字塔等级数。 什么是金字塔级数
现在来理解一下金字塔 这样看其实金字塔就是对图片做卷积也就是特征的提取金字塔级数越大抽取的特征越抽象判定的速度就越快。 卡死的原因
卡死的原因是我使用find_scaled_shape_model是我将 NumLevels 设置为1。
后面将其设置为0后就不卡了后续我设置成2依旧会卡但是没卡死。设置成3和4就变得快了。 小结 如果图片比较大比如有十几兆到上百兆NumLevels 最好不要为1。 在创建模板时CreateShapeModel就要规划好金字塔层数。可以使用auto 关键字。 模板匹配时find_scaled_shape_model如果 numLevels 设置为 0则使用 CreateShapeModel 中指定的金字塔等级数。