Diff
checker
टेक्स्ट
टेक्स्ट
छवियां
दस्तावेज़
Excel
फ़ोल्डर्स
Legal
Enterprise
डेस्कटॉप
मूल्य
साइन इन करें
Diffchecker डेस्कटॉप डाउनलोड करें
टेक्स्ट की तुलना करें
दो टेक्स्ट फ़ाइलों के बीच अंतर ढूंढें
उपकरण
इतिहास
रियल-टाइम एडिटर
अपरिवर्तित संक्षिप्त करें
लाइन रैप बंद
लेआउट
विभाजित
संयुक्त
परिवर्तन हाइलाइट करें
स्मार्ट
शब्द
अक्षर
सिंटैक्स हाइलाइटिंग
सिंटैक्स चुनें
अनदेखा करें
टेक्स्ट बदलें
पहले अंतर पर जाएँ
इनपुट संपादित करें
Diffchecker Desktop
Diffchecker चलाने का सबसे सुरक्षित तरीका। Diffchecker Desktop ऐप पाएं: आपके diffs कभी आपके कंप्यूटर से बाहर नहीं जाते!
Desktop पाएं
cam6_11_diff
बनाया गया
2 वर्ष पहले
Diff कभी समाप्त नहीं होता
साफ़
निर्यात करें
शेयर करें
समझाएं
2 हटाए गए
लाइनें
कुल
हटाया गया
अक्षर
कुल
हटाया गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
24 लाइनें
सभी को कॉपी करें
87 जोड़े गए
लाइनें
कुल
जोड़ा गया
अक्षर
कुल
जोड़ा गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
107 लाइनें
सभी को कॉपी करें
import RPi.GPIO as GPIO
import RPi.GPIO as GPIO
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
import time
import time
, cv2
from picamera2 import Picamera2, MappedArray
from libcamera import Transform
import os
PIR_PIN = 4
PIR_PIN = 4
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
LED_PIN = 17
resolution = (800, 600)
def apply_text(request):
# Text options
colour = (255, 255, 255)
origin = (0, 60)
font = cv2.FONT_HERSHEY_SIMPLEX
scale = 1
thickness = 1
# text = "17082024 09:07"
# Get the current time in the format "DDMMYYYY HH:MM"
text = time.strftime("%d%m%Y %H:%M")
# Calculate the text size
text_size, _ = cv2.getTextSize(text, font, scale, thickness)
# Calculate the bottom-right origin
x = resolution[0] - text_size[0] - 10 # 10 pixels padding from the right
y = resolution[1] - 10 # 10 pixels padding from the bottom
origin = (x, y)
with MappedArray(request, "main") as m:
cv2.putText(m.array, text, origin, font, scale, colour, thickness)
def take_photo(picam2):
# Ensure the directory exists
if not os.path.exists("/home/pi/Camera"):
os.makedirs("/home/pi/Camera")
file_name = "/home/pi/Camera/img_" + str(time.time()) + ".jpg"
# picam2.capture_file(file_name)
picam2.switch_mode_and_capture_file(capture_config, file_name)
print(f"Photo saved: {file_name}")
return file_name
# Setup camera
picam2 = Picamera2()
# picam2.configure(picam2.create_still_configuration(transform=Transform(rotation=180)))
# Create two separate configs - one for preview and one for capture.
# Make sure the preview is the same resolution as the capture, to make
# sure the overlay stays the same size
capture_config = picam2.create_still_configuration({"size": resolution}, transform=Transform(hflip=True, vflip=True))
preview_config = picam2.create_preview_configuration({"size": resolution}, transform=Transform(hflip=True, vflip=True))
# Set the current config as the preview config
picam2.configure(preview_config)
# Add the timestamp
picam2.pre_callback = apply_text
# Start the camera
picam2.start(show_preview=True)
picam2.start() # Start the camera
# Pause for 2 seconds to allow the camera to stabilize
time.sleep(2)
print("Camera setup ok.")
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
# Setup GPIOs
GPIO.setmode(GPIO.BCM)
GPIO.setmode(GPIO.BCM)
GPIO.setup(PIR_PIN, GPIO.IN)
GPIO.setup(PIR_PIN, GPIO.IN)
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
GPIO.setup(LED_PIN, GPIO.OUT)
GPIO.output(LED_PIN, GPIO.LOW)
print("GPIOs setup ok.")
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
MOV_DETECT_THRE
A
SHOLD = 3.0
MOV_DETECT_THRE
SHOLD = 3.0
# Time threshold for sustained motion
MIN_DURATION_BETWEEN_PHOTOS = 60.0 # Minimum time between two photos (in seconds)
last_pir_state = GPIO.input(PIR_PIN)
last_pir_state = GPIO.input(PIR_PIN)
movement_timer = time.time()
movement_timer = time.time()
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
last_time_photo_taken = 0 # Initialize last photo time to 0
print("Everything has been set up.")
try:
try:
while True:
while True:
time.sleep(0.01)
time.sleep(0.01)
pir_state = GPIO.input(PIR_PIN)
pir_state = GPIO.input(PIR_PIN)
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
# Activate LED when movement is detected.
GPIO.output(LED_PIN, GPIO.HIGH if pir_state == GPIO.HIGH else GPIO.LOW)
# Detecting the start of motion
if last_pir_state == GPIO.LOW and pir_state == GPIO.HIGH:
if last_pir_state == GPIO.LOW and pir_state == GPIO.HIGH:
movement_timer = time.time()
movement_timer = time.time()
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
# Sustained motion detection
if last_pir_state == GPIO.HIGH and pir_state == GPIO.HIGH:
if last_pir_state == GPIO.HIGH and pir_state == GPIO.HIGH:
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
if time.time() - movement_timer > MOV_DETECT_THRE
A
SHOLD:
if time.time() - movement_timer > MOV_DETECT_THRE
SHOLD:
print("Take Photo and Send it by Email")
# Check if enough time has passed since the last photo
if time.time() - last_time_photo_taken > MIN_DURATION_BETWEEN_PHOTOS:
print("Take Photo and Send it by Email")
take_photo(picam2)
last_time_photo_taken = time.time() # Update the last photo taken time
last_pir_state = pir_state
last_pir_state = pir_state
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
except KeyboardInterrupt:
except KeyboardInterrupt:
GPIO.cleanup()
GPIO.cleanup()
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
picam2.stop()
सेव किए गए Diffs
ऑरिजनल टेक्स्ट
फ़ाइल खोलें
import RPi.GPIO as GPIO import time PIR_PIN = 4 GPIO.setmode(GPIO.BCM) GPIO.setup(PIR_PIN, GPIO.IN) MOV_DETECT_THREASHOLD = 3.0 last_pir_state = GPIO.input(PIR_PIN) movement_timer = time.time() try: while True: time.sleep(0.01) pir_state = GPIO.input(PIR_PIN) if last_pir_state == GPIO.LOW and pir_state == GPIO.HIGH: movement_timer = time.time() if last_pir_state == GPIO.HIGH and pir_state == GPIO.HIGH: if time.time() - movement_timer > MOV_DETECT_THREASHOLD: print("Take Photo and Send it by Email") last_pir_state = pir_state except KeyboardInterrupt: GPIO.cleanup()
परिवर्तित टेक्स्ट
फ़ाइल खोलें
import RPi.GPIO as GPIO import time, cv2 from picamera2 import Picamera2, MappedArray from libcamera import Transform import os PIR_PIN = 4 LED_PIN = 17 resolution = (800, 600) def apply_text(request): # Text options colour = (255, 255, 255) origin = (0, 60) font = cv2.FONT_HERSHEY_SIMPLEX scale = 1 thickness = 1 # text = "17082024 09:07" # Get the current time in the format "DDMMYYYY HH:MM" text = time.strftime("%d%m%Y %H:%M") # Calculate the text size text_size, _ = cv2.getTextSize(text, font, scale, thickness) # Calculate the bottom-right origin x = resolution[0] - text_size[0] - 10 # 10 pixels padding from the right y = resolution[1] - 10 # 10 pixels padding from the bottom origin = (x, y) with MappedArray(request, "main") as m: cv2.putText(m.array, text, origin, font, scale, colour, thickness) def take_photo(picam2): # Ensure the directory exists if not os.path.exists("/home/pi/Camera"): os.makedirs("/home/pi/Camera") file_name = "/home/pi/Camera/img_" + str(time.time()) + ".jpg" # picam2.capture_file(file_name) picam2.switch_mode_and_capture_file(capture_config, file_name) print(f"Photo saved: {file_name}") return file_name # Setup camera picam2 = Picamera2() # picam2.configure(picam2.create_still_configuration(transform=Transform(rotation=180))) # Create two separate configs - one for preview and one for capture. # Make sure the preview is the same resolution as the capture, to make # sure the overlay stays the same size capture_config = picam2.create_still_configuration({"size": resolution}, transform=Transform(hflip=True, vflip=True)) preview_config = picam2.create_preview_configuration({"size": resolution}, transform=Transform(hflip=True, vflip=True)) # Set the current config as the preview config picam2.configure(preview_config) # Add the timestamp picam2.pre_callback = apply_text # Start the camera picam2.start(show_preview=True) picam2.start() # Start the camera # Pause for 2 seconds to allow the camera to stabilize time.sleep(2) print("Camera setup ok.") # Setup GPIOs GPIO.setmode(GPIO.BCM) GPIO.setup(PIR_PIN, GPIO.IN) GPIO.setup(LED_PIN, GPIO.OUT) GPIO.output(LED_PIN, GPIO.LOW) print("GPIOs setup ok.") MOV_DETECT_THRESHOLD = 3.0 # Time threshold for sustained motion MIN_DURATION_BETWEEN_PHOTOS = 60.0 # Minimum time between two photos (in seconds) last_pir_state = GPIO.input(PIR_PIN) movement_timer = time.time() last_time_photo_taken = 0 # Initialize last photo time to 0 print("Everything has been set up.") try: while True: time.sleep(0.01) pir_state = GPIO.input(PIR_PIN) # Activate LED when movement is detected. GPIO.output(LED_PIN, GPIO.HIGH if pir_state == GPIO.HIGH else GPIO.LOW) # Detecting the start of motion if last_pir_state == GPIO.LOW and pir_state == GPIO.HIGH: movement_timer = time.time() # Sustained motion detection if last_pir_state == GPIO.HIGH and pir_state == GPIO.HIGH: if time.time() - movement_timer > MOV_DETECT_THRESHOLD: # Check if enough time has passed since the last photo if time.time() - last_time_photo_taken > MIN_DURATION_BETWEEN_PHOTOS: print("Take Photo and Send it by Email") take_photo(picam2) last_time_photo_taken = time.time() # Update the last photo taken time last_pir_state = pir_state except KeyboardInterrupt: GPIO.cleanup() picam2.stop()
अंतर खोजें