script.py
1 #!/usr/bin/env python3 2 import time 3 import requests 4 import subprocess 5 6 def capture_image(image_path): 7 # Define the command to capture an image 8 command = ["libcamera-still", "-o", image_path] 9 10 11 # Run the command 12 try: 13 subprocess.run(command, check=True) 14 15 print(f"Image captured successfully: {image_path}") 16 subprocess.run(['python', 'search.py']) 17 except subprocess.CalledProcessError as e: 18 print(f"Failed to capture image: {e}") 19 20 if __name__ == "__main__": 21 # Define the path for the image 22 image_path = "/home/captured_image.jpg" 23 24 # Capture the image 25 capture_image(image_path)