Skip to content

Commit

Permalink
fix: dont loop if problem with webcam polling
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrinux committed Aug 20, 2022
1 parent 15293d9 commit 455a206
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@ func detectFace(deviceID int, xmlFile string, retryTime int, debug bool) (int, b
for range make([]int, retryTime) {
if ok := webcam.Read(&img); !ok {
fmt.Printf("cannot read device %d\n", deviceID)
continue
break
}

if img.Empty() {
fmt.Printf("img empty %d\n", deviceID)
time.Sleep(1000 * time.Millisecond)
continue
}

Expand Down

0 comments on commit 455a206

Please sign in to comment.