If udp: What do you mean?

Asked 2 years ago, Updated 2 years ago, 11 views

from lib.device import Camera
from lib.processors_noopenmdao import findFaceGetPulse
from lib.interface import plotXY, imshow, waitKey, destroyWindow
from cv2 import moveWindow
import argparse
import numpy as np
import datetime
#TODO: work on serial port comms, if anyone asks for it
#from serial import Serial
import socket
import sys

class getPulseApp(object):

    """
    Python application that finds a face in a webcam stream, then isolates the
    forehead.

    Then the average green-light intensity in the forehead region is gathered
    over time, and the detected person's pulse is estimated.
    """

    def __init__(self, args):
        # # Imaging device - must be a connected camera (not an ip camera or mjpeg
        # # stream)
        serial = args.serial
        baud = args.baud
        self.send_serial = False
        self.send_udp = False
        if serial:
            self.send_serial = True
            if not baud:
                baud = 9600
            else:
                baud = int(baud)
            self.serial = Serial(port=serial, baudrate=baud)

        udp = args.udp
        if udp:
            self.send_udp = True
            if ":" not in udp:
                ip = udp
                port = 5005
            else:
                ip, port = udp.split(":")
                port = int(port)
            self.udp = (ip, port)
            self.sock = socket.socket(socket.AF_INET, # Internet
                 socket.SOCK_DGRAM) # UDP

I don't understand the if serial: and if udp: in this coding part.

I searched p.s. and I think it's

money = true 
if money:
    print ("Take a Taxi")

I think I used this But what does serial = true and udp = true mean? I don't quite understand

python

2022-09-21 21:06

1 Answers

Be aware of the cases where True and False are found in Python.

1 -> True
0 -> False
"aaaa" -> True
"" "" -> False
[1, 2, 3] -> True
[] -> False
(1, 2, 3,) {'a':1} -> True
(), {} -> False

It's roughly the same as above.

Since it's args.udp, we need to know what value is substituted by args. I don't know if it's boolean.It's a string...I don't know if it's a number type...This means that if the value exists easily, it will be processed.


2022-09-21 21:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.