This is workaround for crash caused by _tmpl_sz.width or _tmpl_sz.height be equal to 2*cell_size. Later in getFeatureMaps(&z_ipl, cell_size, &map) dimensions of the CvLSVMFeatureMapCaskade *map will be set to [_tmpl_sz.width / cell_size, _tmpl_sz.height / cell_size] and in normalizeAndTruncate(map, 0.2f) they will be changed to map.sizeX -= 2 and map.sizeY -= 2, so if, for example, _tmpl_sz.height == 2*cell_size then final map dimension will be map.sizeY == 0, that does not make sense and there will be crash in createHanningMats() during multiplacation of two matrixes.
This is workaround for crash caused by
_tmpl_sz.width
or_tmpl_sz.height
be equal to2*cell_size
. Later ingetFeatureMaps(&z_ipl, cell_size, &map)
dimensions of theCvLSVMFeatureMapCaskade *map
will be set to[_tmpl_sz.width / cell_size, _tmpl_sz.height / cell_size]
and innormalizeAndTruncate(map, 0.2f)
they will be changed tomap.sizeX -= 2
andmap.sizeY -= 2
, so if, for example,_tmpl_sz.height == 2*cell_size
then finalmap
dimension will bemap.sizeY == 0
, that does not make sense and there will be crash increateHanningMats()
during multiplacation of two matrixes.Actual assert in OpenCV
OpenCV Error: Assertion failed (type == (((6) & ((1 << 3) - 1)) + (((2)-1) << 3))) in gemmImpl, file /opencv/modules/core/src/matmul.cpp, line 1218
in
cv::Mat hann2d = hann2t * hann1t;
becausehann2t
has size[1 x 0]