Skip to content

HOG no longer copyable without SVM coefficients #20131

@sergiud

Description

@sergiud
System information (version)
  • OpenCV => 4.5.2
  • Operating System / Platform => Arch Linux
  • Compiler => GCC 11.1
Detailed description

The change introduced in #12591 casues a segmentation fault in cv::HOGDescripor::copyTo if setSVMDetector was not previously called. This essentially prohibits the use of the descriptor without compatible SVM coefficients because their number is tied to the descriptor configuration. Setting dummy SVM parameters before copyTo is called does not help and results in an OpenCV exception.

Steps to reproduce
#include <opencv2/objdetect.hpp>

int main()
{
    cv::HOGDescriptor hog{{256, 256}, {16, 16}, {8, 8}, {8, 8}, 9, 1};
    cv::HOGDescriptor other;
    hog.copyTo(other);
}

GDB output:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f328b0 in cv::HOGDescriptor::setSVMDetector(cv::_InputArray const&) () from /usr/lib/libopencv_objdetect.so.4.5
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions