Edward Lance Lorilla |
- 【Redux 】CRUD Rematch Library Create Read Update Delete
- 【GAMEMAKER】Dual View Bomber Man Game
- 【PYTHON OPENCV】 Face tracking using dlib frontal face detector for initialization and dlib discriminative correlation filter tracker
- 【VISUAL VB.NET】Device Detection
【Redux 】CRUD Rematch Library Create Read Update Delete Posted: 19 Apr 2021 08:13 PM PDT |
【GAMEMAKER】Dual View Bomber Man Game Posted: 19 Apr 2021 08:50 AM PDT Information about object: obj_splash Sprite: Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask: No Physics Object Create Event: execute code: |
Posted: 19 Apr 2021 08:43 AM PDT """ Face tracking using dlib frontal face detector for initialization and dlib discriminative correlation filter tracker """ # Import required packages:import cv2import dlib def draw_text_info(): """Draw text information""" # We set the position to be used for drawing text and the menu info: menu_pos_1 = (10, 20) menu_pos_2 = (10, 40) # Write text: cv2.putText(frame, "Use '1' to re-initialize tracking", menu_pos_1, cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255)) if tracking_face: cv2.putText(frame, "tracking the face", menu_pos_2, cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0)) else: cv2.putText(frame, "detecting a face to initialize tracking...", menu_pos_2, cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255)) # Create the video capture to read from the webcam:capture = cv2.VideoCapture("istockphoto-1131308747-640_adpp_is.mp4") # Load frontal face detector from dlib:detector = dlib.get_frontal_face_detector() # We initialize the correlation tracker.tracker = dlib.correlation_tracker() # This variable will hold if we are currently tracking the face:tracking_face = Falsewhile True: # Capture frame from webcam: ret, frame = capture.read() # We draw basic info: draw_text_info() if tracking_face is False: gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # Try to detect a face to initialize the tracker: rects = detector(gray, 0) # Check if we can start tracking (if we detected a face): if len(rects) > 0: # Start tracking: tracker.start_track(frame, rects[0]) tracking_face = True if tracking_face is True: # Update tracking and print the peak to side-lobe ratio (measures how confident the tracker is): print(tracker.update(frame)) # Get the position of the tracked object: pos = tracker.get_position() # Draw the position: cv2.rectangle(frame, (int(pos.left()), int(pos.top())), (int(pos.right()), int(pos.bottom())), (0, 255, 0), 3) # We capture the keyboard event key = 0xFF & cv2.waitKey(1) # Press '1' to re-initialize tracking (it will detect the face again): if key == ord("1"): tracking_face = False # To exit, press 'q': if key == ord('q'): break # Show the resulting image: cv2.imshow("Face tracking using dlib frontal face detector and correlation filters for tracking", frame) # Release everything:capture.release()cv2.destroyAllWindows() |
【VISUAL VB.NET】Device Detection Posted: 19 Apr 2021 08:37 AM PDT Imports System Imports System.Collections.GenericImports System.ComponentModelImports System.DataImports System.DrawingImports System.LinqImports System.TextImports System.Threading.Tasks' mak System.Diagnostics ' make sure that using System.Security.Principal; is included Imports System.Security.Principal ' make sure that using System.Diagnostics; is included Imports System.Management ' add reference system.management (.NET directory) Public Class Form1 Public Enum ChassisTypes Other = 1 Unknown Desktop LowProfileDesktop PizzaBox MiniTower Tower Portable Laptop Notebook Handheld DockingStation AllInOne SubNotebook SpaceSaving LunchBox MainSystemChassis ExpansionChassis SubChassis BusExpansionChassis PeripheralChassis StorageChassis RackMountChassis SealedCasePC End Enum Public Shared Function GetCurrentChassisType() As ChassisTypes Dim systemEnclosures As New ManagementClass("Win32_SystemEnclosure") For Each obj As ManagementObject In systemEnclosures.GetInstances() For Each i As Integer In DirectCast(obj("ChassisTypes"), UInt16()) If i > 0 AndAlso i < 25 Then Return CType(i, ChassisTypes) End If Next Next Return ChassisTypes.Unknown End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click MessageBox.Show(GetCurrentChassisType().ToString()) End SubEnd Class |
You are subscribed to email updates from Edward Lance Lorilla. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google, 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
No comments:
Post a Comment