Wifi模块自建热点之后只有一台设备能连接,应该如何解决 ?
-
Face recognition with LBP descriptors.
See Timo Ahonen's "Face Recognition with Local Binary Patterns".
Before running the example:
1) Download the AT&T faces database http://www.cl.cam.ac.uk/Research/DTG/attarchive/pub/data/att_faces.zip
2) Exract and copy the orl_faces directory to the SD card root.
import sensor, time, image, pyb
import network, usocket, jsonWi-fi和服务器配置
SSID = 'OPENMV_AP' # Network SSID
KEY = '1234567890' # Network key (must be 10 chars)
HOST = '192.168.1.100' # Use first available interface
PORT = 5000 # Arbitrary non-privileged portsensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.B128X128) # or sensor.QQVGA (or others)
sensor.set_windowing((92,112))
sensor.set_contrast(3)
sensor.set_gainceiling(16)
sensor.skip_frames(10) # Let new settings take affect.
sensor.skip_frames(time = 5000) #等待5s初始化AP模块
wlan = network.WINC(mode=network.WINC.MODE_AP)
wlan.start_ap(SSID, key=KEY, security=wlan.WPA2, channel=2)加载Haar算子
默认情况下,这将使用所有阶段,更低的satges更快,但不太准确。
face_cascade = image.HaarCascade("frontalface", stages=25)
print(face_cascade)
FPS clock
clock = time.clock()
#SUB = "s1"
NUM_SUBJECTS = 5 #图像库中不同人数,一共6人
NUM_SUBJECTS_IMGS = 20 #每人有20张样本图片def min(pmin, a, s):
global num
if a<pmin:
pmin=a
num=s
return pminid-摄像头标号 userId-识别到的用户id
def send_data_to_server(id,userId):
# Create a socket to connect to the server
s = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)
try:
s.connect((HOST, PORT))
# Create the JSON payload with id and user_id
payload = json.dumps({"id":str(id),"userId":str(userId)})
# Send the POST request to the server with the specific path and data
s.send("POST /openmv/receive HTTP/1.0\r\n")
s.send("Content-Type: application/json\r\n")
s.send("Content-Length: {}\r\n\r\n".format(len(payload)))
s.send(payload)
s.close()
except OSError as e:
print("Failed to connect to server:", e)while(True):
# 拍摄当前人脸。
img = sensor.snapshot()
objects = img.find_features(face_cascade, threshold=0.75, scale=1.35)
#img = image.Image("singtown/%s/1.pgm"%(SUB))
for r in objects:
img.draw_rectangle(r)
d0 = img.find_lbp((0, 0, img.width(), img.height()))
#d0为当前人脸的lbp特征
img = None
pmin = 999999
num=0
for s in range(1, NUM_SUBJECTS+1):
dist = 0
for i in range(2, NUM_SUBJECTS_IMGS+1):
img = image.Image("singtown/s%d/%d.pgm"%(s, i))
d1 = img.find_lbp((0, 0, img.width(), img.height()))
#d1为第s文件夹中的第i张图片的lbp特征
dist += image.match_descriptor(d0, d1)#计算d0 d1即样本图像与被检测人脸的特征差异度。
pmin = min(pmin, dist/NUM_SUBJECTS_IMGS, s)#特征差异度越小,被检测人脸与此样本更相似更匹配。print(num) # num为当前最匹配的人的编号 send_data_to_server(1,num)# 将匹配到的人脸发送给服务器 sensor.skip_frames(time = 3000)
-
你好,你那边wifi模块能进行openmv无线调试吗,我连上wifi后电脑软件没有wifi的图标
-
WiFi扩展板热点模式只能连接一个设备。这个是硬件限制的,解决不了。