Skip to content

Commit

Permalink
opencv: update interface and examples to indicate multipurpose
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Oct 23, 2017
1 parent f37af5c commit 5e2ea8c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/ardrone_face_tracking.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func main() {
gobot.Every(300*time.Millisecond, func() {
drone.Hover()
i := img
faces := opencv.DetectFaces(cascade, i)
faces := opencv.DetectObjects(cascade, i)
biggest := 0
var face image.Rectangle
for _, f := range faces {
Expand Down
2 changes: 1 addition & 1 deletion examples/opencv_face_detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func main() {
if i.Empty() {
return
}
faces := opencv.DetectFaces(cascade, i)
faces := opencv.DetectObjects(cascade, i)
opencv.DrawRectangles(i, faces, 0, 255, 0, 5)
window.ShowImage(i)
window.WaitKey(1)
Expand Down
4 changes: 2 additions & 2 deletions platforms/opencv/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func loadCascadeClassifier(haar string) *gocv.CascadeClassifier {
return classifier
}

// DetectFaces loads Haar cascade to detect face objects in image
func DetectFaces(haar string, img gocv.Mat) []image.Rectangle {
// DetectObjects loads Haar cascade to detect face objects in image
func DetectObjects(haar string, img gocv.Mat) []image.Rectangle {
return loadCascadeClassifier(haar).DetectMultiScale(img)
}

Expand Down
2 changes: 1 addition & 1 deletion platforms/opencv/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func TestUtils(t *testing.T) {
_, currentfile, _, _ := runtime.Caller(0)
image := gocv.IMRead(path.Join(path.Dir(currentfile), "lena-256x256.jpg"), gocv.IMReadColor)
rect := DetectFaces("haarcascade_frontalface_alt.xml", image)
rect := DetectObjects("haarcascade_frontalface_alt.xml", image)
gobottest.Refute(t, len(rect), 0)
DrawRectangles(image, rect, 0, 0, 0, 0)
}

0 comments on commit 5e2ea8c

Please sign in to comment.