Script autostart

Hi, I got the answer I posted from here:

Unfortunately, I can’t really debug this for you more than to point you in the right place. As long as you received the right number of bytes on the Pi side you should have a valid image file that is a jpg.

From the debug output it looks like you received the image fine. So, jpg images always end with FFD9 and begin with FFD8. So, it looks like you received the full image.

Mmm, as a test try writing the binary byte object to disk and then open it.

file = open("image.jpg", "wb")
file.write(image_data[0])
file.close()

The file should be in binary on disk… if you notice that the file grew in size from what you script printed out then that means you’re silently converting the bytes from binary form to text strings of what the binary data is…

Hello! Sorry for the late response, but I had it working already. Thanks for the many help!.. The serial.read(# of bytes) didnt really read accurately so I just assigned a value bigger than the number of bytes of the image…

I was able to get the right data by searching for the start bytes: ‘\xff\xd8’
and end bytes: ‘\xff\xd9’
of the jpeg data…

Anyway… I tried just streaming the images from the openMV to the Raspberry Pi, and let the face detection be done by the Raspberry Pi through OpenCV, however its very slow in image processing (even though I used LBP cascade over haar)… I only get a maximum of 5 FPS from the face detection… so I tried making the OpenMV do the face detection again… But the problem is that the face detection of the OpenMV (the one in the examples) seem to be unable to detect a face about 2m away…

I’m currently using the QVGA resolution and windowing of 240x240… Is there any way that the openmv be able to do a facial detection at least 2m away? Or maybe a different facial detection algorithm? Thanks

Hi, by chaining the scale value you change how many scales the algorithm tries.

https://github.com/openmv/openmv/blob/master/src/omv/img/haar.c#L108

Basically, by making the value closer to 1.0 you make the algorithm scale more slowly down in size.

Hello sir! Thank you for the help! However I encountered another problem. I have attached one of my cams to a gimbal as seen on the attachment… however my USB connection to the RPi gets cut off suddenly. Do u have any suggestions for this? Thanks

What?

Sorry for that previous reply… Please disregard this… Is there a way I can run the python script of the OpenMVIDE using the pyopenmv.py through the serial connection?

I tried changing the /dev/openmvcam port of the pyopenmv.py to /dev/ttyS0 which is the serial port, but it didn’t work. Thanks

Hi, you have to install udev drivers for the /dev/openmvcam device to appear. That said, this isn’t actually needed except if you want to use DFU. All you need to do is change the serial port to the /dev/ACM whatever port that appears when you connect the camera.

Hello! Thank you for the many many help… I’ve accomplished a lot of projects and features with this camera!

I was wondering, by the way, is there any way I could import my own classifier xml file. Let’s say I want to do Upper Body Detection using an upper body xml, how would I import that? I couldn’t find a frontal xml file used for your facial detection, so I don’t really know how the classifiers are imported into the code on OpenMV. Thank you!

Hello! I created a cascade file using the cascade_convert.py I found online. So, I placed it in the /home/openmvide folder. I tried to run the code (using the new cascade) as seen on the attached image but it had an error that said it can’t find the path. Sorry I know its a basic question… I tried to use its whole path which is /home/uavdlsu/openmvide/haarcascade_mcs_upperbody.cascade but it also did not work… am I doing something wrong? Thank you

Let me ask Ibrahim.

Hi,
The file needs to be on the camera’s storage (flash or SD card).

Hello! Any news? :slight_smile:

Yes, I answered above, copy the cascade file to SD or flash storage. It needs to be on the camera not the PC.

Hello! I tried placing it on the camera, but when I ran the script, this shows:

Do you have any sample cascade networks that maybe I can use? I am currently using OPENMV with a drone to follow humans, however facial detection seems to dangerous and near-sighted for drones.

Thanks

I think these? Not sure if they are in the right format for us:

Thank you!