Python Forum
Running two scripts and more....
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running two scripts and more....
#1
Hi all, (not sure if this is the right place for this)

I'm very new to this and only just getting my head round the most basic commands. Anything I've managed so far has been through copy and paste and luck.

I have two python scripts that both work individually. One is face detection using the picamera and cv2. I've been able to get this to display live and to print a value when a face is or isn't detected.
The other is a thermal camera in I2C. I've been able to get this to display almost live and to print a value when above or below a defined temperature.

I have a few things I would like to do with this but I'm now a bit stuck. I would like both scripts to run at the same time. They both seem to display in an HTML window and although one is Picamera and other is I2C, they won't seem to both run at the same time. I've used some code:

import facedetect
import seeed_python_ircamera
exec(open('facedetect.py').read())
exec(open('seeed_python_ircamera.py').read())

which runs, but it only runs the first script (or second script if I comment out the first). I tried some similar script but it didn't work either. I'm wondering if it's anything to do with rendering? Could anyone please suggest a way to run both at the same time or even send the cv2 capture to a different format to be viewed on omx or vlc? (I did try saving to avi and viewing on vlc but I couldn't get it to work either)

I'd also like to use the values, instead of printing to serial, to trigger GPIO pins. I'd also like to use them in the following logic:

No face detected = GPIO pin (w)
Face detected = GPIO pin (x) and (either <start 'ircamera' script> or <display already running but just enable temp value output>)
Temp below limit = GPIO pin (y) and <display 'a' message on screen>
Temp above limit = GPIO pin (z) and <display 'b' message on screen>

I'm really struggling with how to go about this though.

I'd also like to somehow create a nice GUI for it to display both live feeds on a background with space for text and messages. I reckon this would probably a bit of a nightmare?

I'm sure you can see where I'm going with this! I'm trying to get the picamera to detect a face and then read the temperature with the I2C thermal camera, then display a certain message depending on the temperature, all on a nice portrait screen!
I feel I'm pretty close, just needs some code tweaking and and a GUI.
Any help will be greatly appreciated Smile
Thanks
Brian
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Running python scripts from github etc pacmyc 7 3,608 Mar-03-2021, 10:26 PM
Last Post: pacmyc
  Running scripts and location of saved interpreted user-defined classes and functions leodavinci1990 3 2,466 Aug-25-2020, 03:43 AM
Last Post: micseydel
  datasharing between two separated running scripts Ispanicuz 7 4,176 Dec-21-2018, 08:46 PM
Last Post: Gribouillis
  running two python scripts pythonper 1 2,585 Mar-14-2018, 06:57 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020