Hi,
I've been working through updating my code to work with the latest javacv, but hit a strange problem. Performance really dropped off, with laggy/slow video feed. After going through my code to figure out where, its happening when I call face detection if there has been movement detected in the frame:
faces = cvHaarDetectObjects(originalImage, cascade, faceStorage, 1.1, 3, CV_HAAR_DO_CANNY_PRUNING);
I looked through the examples, and I can see FaceApplet and FacePreview use this, but aimed for Android. So I don't know if I need to downsize the image first like in these examples, but I'd rather avoid that as I'm already dealing with a small resolution.
So then I thought, aha maybe the haarcascade_frontalface_alt.xml has been updated between openCV 2.X to 3, and it looks like it has. But if I copy in a new one, I get:
[java] OpenCV Error: Unspecified error (The node does not represent a user object (unknown type?)) in cvRead, file /home/vin/javacpp-presets/opencv/cppbuild/linux-x86_64/opencv-3.0.0/modules/core/src/persistence.cpp, line 4976
[java] Exception in thread "main" java.lang.RuntimeException: /home/vin/javacpp-presets/opencv/cppbuild/linux-x86_64/opencv-3.0.0/modules/core/src/persistence.cpp:4976: error: (-2) The node does not represent a user object (unknown type?) in function cvRead
Now, I know the general setup must be OK, as I just overwrite the previous file. Looking at start of the xml, in the new one (copied out of opencv, opencv/cppbuild/linux-x86_64/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml)
<opencv_storage>
<cascade type_id="opencv-cascade-classifier"><stageType>BOOST</stageType>
<featureType>HAAR</featureType>
<height>20</height>
<width>20</width>
<stageParams>
<maxWeakCount>213</maxWeakCount></stageParams>
<featureParams>
<maxCatCount>0</maxCatCount></featureParams>
<stageNum>22</stageNum>
<stages>
..... (lots more)
compared to the old one
<opencv_storage>
<haarcascade_frontalface_alt type_id="opencv-haar-classifier">
<size>20 20</size>
<stages>
<_>
<!-- stage 0 -->
<trees>
<_>
<!-- tree 0 -->
.... (lots more)
I wondered if anyone else has hit either performance issues and figured out the problem, or if it is this classifier, somehow it loads the old one OK but its not as good performance as the latest one, so is there a way to get the new one loaded?
Thanks!