我刚使用opencv_traincascade.exe(opencv 2.4.11 (vc10)) cascade.xml 文件生成。
然后当我尝试在 javacv 0.8(以及1.0)中使用它时,我收到此错误:
OpenCV Error: Unspecified error (The node does not represent a user object (unknown type?))
in cvRead, file ..\..\..\..\opencv\modules\core\src\persistence.cpp, line 4991
Exception in thread "main" java.lang.RuntimeException:
..\..\..\..\opencv\modules\core\src\persistence.cpp:4991: error: (-2) The node does not represent a user object (unknown type?) in function cvRead
Windows PATH变量查找该文件夹,该文件夹包含 opencv_traincascade.exe 。所以我尝试使用cacade.xml来实现它。
我还有另一个cascade.xml,工作正常。我发现了级联之间的区别:
工作:
<opencv_storage>
<haarcascade_frontalface_default type_id="opencv-haar-classifier">
<size>24 24</size>
<stages>
<trees>
... some tags for one stage
</trees>
</stages>
</haarcascade_frontalface_default>
</opencv_storage>
不要工作:
<opencv_storage>
<cascade>
<stageType>BOOST</stageType>
<featureType>HAAR</featureType>
<height>20</height>
<width>20</width>
<stageParams>
<boostType>GAB</boostType>
<minHitRate>9.9000000953674316e-001</minHitRate>
<maxFalseAlarm>4.0000000596046448e-001</maxFalseAlarm>
<weightTrimRate>9.4999999999999996e-001</weightTrimRate>
<maxDepth>1</maxDepth>
<maxWeakCount>100</maxWeakCount>
</stageParams>
<featureParams>
<maxCatCount>0</maxCatCount>
<featSize>1</featSize>
<mode>ALL</mode>
</featureParams>
<stageNum>16</stageNum>
<stages>
<!-- stage 0 -->
<_>
<maxWeakCount>1</maxWeakCount>
<stageThreshold>1.</stageThreshold>
<weakClassifiers>
<_>
<internalNodes>
0 -1 1 -2.3408320546150208e-001</internalNodes>
<leafValues>
1. -1.</leafValues></_></weakClassifiers></_>
<!-- stage 1 -->
.... //16 stages
<features>
.... // a lot of "rect" tags
</features>
</cascade>
</opencv_storage>
每个人都可以注意到,结构是不同的。我想,这就是错误的原因。
我做错了什么?我如何使用我的cascade.xml?
答案 0 :(得分:0)
是的,问题是我使用了javacv方法,它使用旧的级联xml格式。 使用c ++ - 一切正常。 谢谢,berak!