forked from go/golangs_learn
张献维
1 year ago
7 changed files with 188960 additions and 0 deletions
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,41 @@ |
|||||
|
package main |
||||
|
|
||||
|
import ( |
||||
|
"fmt" |
||||
|
"github.com/lazywei/go-opencv/opencv" |
||||
|
) |
||||
|
|
||||
|
func main() { |
||||
|
fmt.Println(opencv.Version()) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
func main() { |
||||
|
// 加载图像
|
||||
|
imagePath := "E:\\VivimanZhang\\OneDrive\\归档\\图片\\正式头像.jpg" |
||||
|
image := opencv.LoadImage(imagePath) |
||||
|
if image == nil { |
||||
|
fmt.Printf("Error loading image: %s\n", imagePath) |
||||
|
return |
||||
|
} |
||||
|
defer image.Release() |
||||
|
|
||||
|
// 加载Haar级联分类器XML文件(用于人脸检测)
|
||||
|
classifier := opencv.LoadHaarClassifierCascade("E:\\Code-Go\\Golang学习项目\\golang_learn\\data_func\\go_to_opencv\\haarcascade_frontalface_default.xml") |
||||
|
if classifier == nil { |
||||
|
fmt.Println("Error loading Haar classifier") |
||||
|
return |
||||
|
} |
||||
|
defer classifier.Release() |
||||
|
|
||||
|
// 进行人脸检测
|
||||
|
faces := classifier.DetectObjects(image) |
||||
|
fmt.Printf("Found %d faces\n", len(faces)) |
||||
|
|
||||
|
// 显示图像
|
||||
|
window := opencv.NewWindow("Face Detection") |
||||
|
defer window.Destroy() |
||||
|
window.ShowImage(image) |
||||
|
opencv.WaitKey(0) |
||||
|
} |
||||
|
*/ |
Loading…
Reference in new issue