本文整理匯總了Golang中github.com/lazywei/go-opencv/opencv.IplImage.Height方法的典型用法代碼示例。如果您正苦於以下問題:Golang IplImage.Height方法的具體用法?Golang IplImage.Height怎麽用?Golang IplImage.Height使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/lazywei/go-opencv/opencv.IplImage
的用法示例。
在下文中一共展示了IplImage.Height方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ProcessImage
func ProcessImage(img *opencv.IplImage, win *opencv.Window, pos int) error {
w := img.Width()
h := img.Height()
// Create the output image
cedge := opencv.CreateImage(w, h, opencv.IPL_DEPTH_8U, 3)
defer cedge.Release()
// Convert to grayscale
gray := opencv.CreateImage(w, h, opencv.IPL_DEPTH_8U, 1)
edge := opencv.CreateImage(w, h, opencv.IPL_DEPTH_8U, 1)
defer gray.Release()
defer edge.Release()
opencv.CvtColor(img, gray, opencv.CV_BGR2GRAY)
opencv.Smooth(gray, edge, opencv.CV_BLUR, 3, 3, 0, 0)
opencv.Not(gray, edge)
// Run the edge detector on grayscale
opencv.Canny(gray, edge, float64(pos), float64(pos*3), 3)
opencv.Zero(cedge)
// copy edge points
opencv.Copy(img, cedge, edge)
win.ShowImage(img)
return nil
}
示例2: ProcessImage
func ProcessImage(img *opencv.IplImage, gradeOfCanny int) *opencv.IplImage {
w := img.Width()
h := img.Height()
// Create the output image
cedge := opencv.CreateImage(w, h, opencv.IPL_DEPTH_8U, 3)
//defer cedge.Release()
// Convert to grayscale
gray := opencv.CreateImage(w, h, opencv.IPL_DEPTH_8U, 1)
edge := opencv.CreateImage(w, h, opencv.IPL_DEPTH_8U, 1)
//newimage := opencv.CreateImage(w, h, opencv.IPL_DEPTH_8U, 1)
defer gray.Release()
defer edge.Release()
opencv.CvtColor(img, gray, opencv.CV_BGR2GRAY)
opencv.Smooth(gray, edge, opencv.CV_BLUR, 3, 3, 0, 0)
opencv.Not(gray, edge)
// Run the edge detector on grayscale
opencv.Canny(gray, edge, float64(gradeOfCanny), float64(gradeOfCanny*3), 3)
opencv.Zero(cedge)
// copy edge points
opencv.Copy(img, cedge, edge)
return cedge
}
示例3: ToImage
func ToImage(img *opencv.IplImage) image.Image {
out := image.NewNRGBA(image.Rect(0, 0, img.Width(), img.Height()))
if img.Depth() != opencv.IPL_DEPTH_8U {
return nil // TODO return error
}
for y := 0; y < img.Height(); y++ {
for x := 0; x < img.Width(); x++ {
s := img.Get2D(x, y).Val()
b, g, r, a := s[2], s[1], s[0], s[3]
c := color.NRGBA{uint8(b), uint8(g), uint8(r), uint8(a)}
out.Set(x, y, c)
}
}
return out
}
示例4: DetectFacialFeatures
func (detector *FaceDetector) DetectFacialFeatures(image *opencv.IplImage, faceCoords []pixelCoord) faces {
var faces = make(faces, 0)
for _, faceCoord := range faceCoords {
//Lets find us some eyes
leftEyes, rightEyes := detector.DetectEyes(image, &faceCoord)
if len(leftEyes) == 0 || len(rightEyes) == 0 {
//No eyes found, lets flop the picture and check again
fmt.Println("Flopping Picture to look for eyes")
floppedImage := opencv.DecodeImageMem(FlopImage(ToByteBuffer(image)))
floppedFaceCoords := faceCoord
floppedFaceCoords.Flop(pixelCoord{width: image.Width(), height: image.Height()})
floppedLeftEyes, floppedRightEyes := detector.DetectEyes(floppedImage, &floppedFaceCoords)
if len(leftEyes) == 0 {
floppedRightEyes.FlopEmAll(pixelCoord{width: image.Width(), height: image.Height()})
leftEyes = append(leftEyes, floppedRightEyes...)
}
if len(rightEyes) == 0 {
floppedLeftEyes.FlopEmAll(pixelCoord{width: image.Width(), height: image.Height()})
leftEyes = append(rightEyes, floppedLeftEyes...)
}
}
leftEye, rightEye := FindBestEyes(leftEyes, rightEyes)
faces = append(faces, face{
coord: faceCoord,
eye_left: leftEye,
eye_right: rightEye,
})
}
fmt.Println(faces)
return faces
}
示例5: HoughCirclesWithParams
func HoughCirclesWithParams(img *opencv.IplImage, dp float64, min_dist float64, param_1 float64, param_2 float64, min_radius int, maxradius int) []opencv.CircleStruct {
var gray = opencv.CreateImage(img.Width(), img.Height(), opencv.IPL_DEPTH_8U, 1)
opencv.CvtColor(img, gray, opencv.CV_BGR2GRAY)
return opencv.HoughCircles(gray, dp, min_dist, param_1, param_2, 1, 500)
}
示例6: HoughCircles1
func HoughCircles1(img *opencv.IplImage) []opencv.CircleStruct {
var gray = opencv.CreateImage(img.Width(), img.Height(), opencv.IPL_DEPTH_8U, 1)
opencv.CvtColor(img, gray, opencv.CV_BGR2GRAY)
return opencv.HoughCircles(gray, 15, 100, 75, 5, 25, 500)
}
示例7: cloneGreyscale
func cloneGreyscale(im *opencv.IplImage) *opencv.IplImage {
w, h := im.Width(), im.Height()
g := opencv.CreateImage(w, h, opencv.IPL_DEPTH_8U, 1)
opencv.CvtColor(im, g, opencv.CV_BGR2GRAY)
return g
}