我想要做面部檢測,爲此我創建了我自己的XML文件。我有兩個文件夾 - 一個用於存儲正片圖像,另一個用於存儲負片圖像。我正在創建名爲positive.txt和negative.txt的描述文件。 positive.txt文件共包含2676張圖片,negative.txt共包含581張圖片。現在我想使用以下命令創建positive.txt的vec文件:爲什麼積極的文本文件不會創建樣本
opencv_createsamples -info positive.txt -vec vefile.vec -num 2676 -w 24 -h 24
。
但是,我收到一個錯誤。下面是輸出:
Info file name: positive.txt
Img file name: (NULL)
Vec file name: vefile.vec
BG file name: (NULL)
Num: 2676
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 40
Max x angle: 1.1
Max y angle: 1.1
Max z angle: 0.5
Show samples: FALSE
Width: 24
Height: 24
Create training samples from images collection...
OpenCV Error: Assertion failed (rect.width >= 0 && rect.height >= 0 && rect.x < image->width && rect.y < image->height && rect.x + rect.width >= (int)(rect.width > 0) && rect.y + rect.height >= (int)(rect.height > 0)) in cvSetImageROI, file /home/arya/stuff/opencv/opencv-2.4.7/modules/core/src/array.cpp, line 3006
terminate called after throwing an instance of 'cv::Exception'
what(): /home/arya/stuff/opencv/opencv-2.4.7/modules/core/src/array.cpp:3006: error: (-215) rect.width >= 0 && rect.height >= 0 && rect.x < image->width && rect.y < image->height && rect.x + rect.width >= (int)(rect.width > 0) && rect.y + rect.height >= (int)(rect.height > 0) in function cvSetImageROI
Aborted (core dumped)
下面是其中positive.txt包含有關2676倍的圖像信息的幾個例子:
/home/arya/myown/Positive/Pictures1102.jpeg 2 414 271 40 51 547 289 37 52
/home/arya/myown/Positive/images460.jpeg 1 108 21 93 127
/home/arya/myown/Positive/Pictures1131.jpeg 3 298 418 62 81 443 316 42 52 656 346 50 52
/home/arya/myown/Positive/face294.jpeg 1 189 84 45 57
/home/arya/myown/Positive/images129.jpeg 1 115 22 84 112
/home/arya/myown/Positive/images724.jpeg 1 128 19 89 106
/home/arya/myown/Positive/Pictures489.jpeg 1 237 418 49 75
/home/arya/myown/Positive/images90.jpeg 1 106 19 93 116
/home/arya/myown/Positive/Pictures1246.jpeg 1 964 117 131 153
/home/arya/myown/Positive/face922.jpeg 2 218 175 74 74 274 155 0 0
這可能是導致上述錯誤?