When I first read about the Omron HVC-P2 roadtest I was excited about the possibility of implementing a security monitoring application with a camera/image processor that had human image recognition built in. Based on the specs I thought I could monitor an area 20 feet deep by 10 feet wide (about the size of either the outside or inside entry area to my house). I discussed the applicable parameters in my "Application Feasibilty" blog post. As I've been testing the unit, I've come to doubt whether the unit could actually work in this application but thought that I'd give it a try.
I have a fairly straightforward implementation. The HVC-P2 does all of the image processing internally and provides the detection result via a USB UART. I added a Raspberry Pi Zero W to provide remote communication and control. The RPi handles all the configuration and result processing for the HVC-P2. Omron provides sample programs in C and Python. I elected to use Python.
Basic Requirements:
1) Detect Human Body, Face or Facial recognition based on configuration
2) Perform some logic to determine if there is an alert condition
3) Send alert (initially just send email)
That's all I intended to implement. If things worked well I could extend the functionality.
Requirement 1 is easy because that's the primary function of the HVC-P2. Main concerns here are reliability and accuracy of detection (based on poor repeatability in static testing).
The provided Omron software provides an execution API that returns an hvc_tracking_result object that has all the relevant detection properties.
Here is the Class Diagram: I apologize that it isn't easily readable - you may have to copy the image if you are interested.
Just by way of example:
To initiate a detection sequence you just call the API execute function
(res_code, stb_status) = hvc_p2_api.execute(output_img_type, hvc_tracking_result, img)
and you get back the tracking_result and an image if that was enabled
In my application I write the tracking result to a log file and save the image.
Here is an excerpt from the log file when I only had Body detection enabled:
Image name: img_1_112418_164331.jpg
Face Count = 0
Body Count = 1
Detection X:1152 Y:416, Size:384 Conf:739
Hand Count = 0
==== Elapsed time:270.56[msec] ====
You can see the X, Y coordinates of the body center and the body size and detection confidence
I also timestamp the image because I need to post process the image to insert the detection bounding box.
I don't process real time to not slow down the detection frequency.
Here is the post processed image that corresponds to this log result:
One interesting aspect is that the application has to initiate the detection process. So, for continuous detection it has to always stay in a loop.
It is also easy to satisfy the requirement for creating alert logic by using the hvc_tracking_result properties.
e.g. hvc_tracking_result.bodies is the array of bodies that has been detected, so that len(hvc_tracking_result.bodies) >= 1 indicates that a body has been detected
I'm not doing any specific processing, but I could use the x,y position to determine if a body were in an off-limits location or moving inappropriately.
Once an alert condition is encountered then I send an email with the alert condition and also attach the detection image.
To send the email from the RPi I needed to use the smtplib and to attach the image I needed to use MIME. I used my account at zoho.com to do the mail forwarding.
So, here's the punchline....... I ran into a problem that I haven't solved that makes my application not usable. And as a result I won't be able to do any performance testing unless I can find a workaround.
You can see from my log result that the detection time was 270 msec which might be marginal for a moving target. However, as I looked at the timestamps of sequentially captured images, I realized that the images were only being captured about every 4 seconds. I put a debug timer in the loop and measured about 4500 msec. I discovered that the culprit was the save of the captured image using the GrayScaleImage() function from the Omron software. I have to do some further testing - it may be an issue with using the SD card on the RPi for storage. It definitely correlates to the amount of data being stored. The 4500 msec was to save a 320x240 pixel image. It reduced to 1200 msec with a 160x120 pixel image.
At this point, I think I'm going to work on my review summary. I believe that even without this last glitch that the HVC-P2 probably isn't a good fit for what I had intended. I think that the lack of certain features combined with poor repeatability will limit the scope of its usability. I'll cover that in my review.
Top Comments