Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I change cmd code. #670

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmd/caffe-classifier/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ func main() {
continue
}

// convert image Mat DataType to CV_32F
img_CV32F := img.Clone()
img_CV32F.ConvertTo(&img_CV32F, gocv.MatTypeCV32F)

// convert image Mat to 224x224 blob that the classifier can analyze
blob := gocv.BlobFromImage(img, 1.0, image.Pt(224, 224), gocv.NewScalar(104, 117, 123, 0), false, false)
blob := gocv.BlobFromImage(img_CV32F, 1.0, image.Pt(224, 224), gocv.NewScalar(104, 117, 123, 0), false, false)

// feed the blob into the classifier
net.SetInput(blob, "")
Expand Down
6 changes: 5 additions & 1 deletion cmd/dnn-detection/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ func main() {
continue
}

// convert image Mat DataType to CV_32F
img_CV32F := img.Clone()
img_CV32F.ConvertTo(&img_CV32F, gocv.MatTypeCV32F)

// convert image Mat to 300x300 blob that the object detector can analyze
blob := gocv.BlobFromImage(img, ratio, image.Pt(300, 300), mean, swapRGB, false)
blob := gocv.BlobFromImage(img_CV32F, ratio, image.Pt(300, 300), mean, swapRGB, false)

// feed the blob into the detector
net.SetInput(blob, "")
Expand Down
6 changes: 5 additions & 1 deletion cmd/dnn-style-transfer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ func main() {
continue
}

// convert image Mat DataType to CV_32F
img_CV32F := img.Clone()
img_CV32F.ConvertTo(&img_CV32F, gocv.MatTypeCV32F)

// convert image Mat to 640x480 blob that the style transfer can analyze
blob := gocv.BlobFromImage(img, 1.0, image.Pt(640, 480), gocv.NewScalar(103.939, 116.779, 123.68, 0), false, false)
blob := gocv.BlobFromImage(img_CV32F, 1.0, image.Pt(640, 480), gocv.NewScalar(103.939, 116.779, 123.68, 0), false, false)

// feed the blob into the detector
net.SetInput(blob, "")
Expand Down
6 changes: 5 additions & 1 deletion cmd/ssd-facedetect/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ func main() {
W := float32(img.Cols())
H := float32(img.Rows())

// convert image Mat DataType to CV_32F
img_CV32F := img.Clone()
img_CV32F.ConvertTo(&img_CV32F, gocv.MatTypeCV32F)

// convert image Mat to 96x128 blob that the detector can analyze
blob := gocv.BlobFromImage(img, 1.0, image.Pt(128, 96), gocv.NewScalar(104.0, 177.0, 123.0, 0), false, false)
blob := gocv.BlobFromImage(img_CV32F, 1.0, image.Pt(300, 300), gocv.NewScalar(104.0, 177.0, 123.0, 0), false, false)
defer blob.Close()

// feed the blob into the classifier
Expand Down