mirror of
https://github.com/esimov/pigo-wasm-demos.git
synced 2025-09-26 20:31:20 +08:00
wasm: tweak params
This commit is contained in:
@@ -162,9 +162,9 @@ func (d *Detector) clusterDetection(pixels []uint8, width, height int) []pigo.De
|
|||||||
}
|
}
|
||||||
cParams := pigo.CascadeParams{
|
cParams := pigo.CascadeParams{
|
||||||
MinSize: 200,
|
MinSize: 200,
|
||||||
MaxSize: 640,
|
MaxSize: 720,
|
||||||
ShiftFactor: 0.1,
|
ShiftFactor: 0.1,
|
||||||
ScaleFactor: 1.1,
|
ScaleFactor: 1.05,
|
||||||
ImageParams: *imgParams,
|
ImageParams: *imgParams,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@ type Canvas struct {
|
|||||||
video js.Value
|
video js.Value
|
||||||
|
|
||||||
showPupil bool
|
showPupil bool
|
||||||
showFace bool
|
showFaceRect bool
|
||||||
showEyeMask bool
|
showEyeMask bool
|
||||||
showMouthMask bool
|
showMouthMask bool
|
||||||
showCoord bool
|
showCoord bool
|
||||||
@@ -91,9 +91,9 @@ func NewCanvas() *Canvas {
|
|||||||
|
|
||||||
c.ctx = c.canvas.Call("getContext", "2d")
|
c.ctx = c.canvas.Call("getContext", "2d")
|
||||||
c.showPupil = true
|
c.showPupil = true
|
||||||
c.showFace = false
|
c.showFaceRect = false
|
||||||
c.showEyeMask = true
|
c.showEyeMask = true
|
||||||
c.showMouthMask = false
|
c.showMouthMask = true
|
||||||
c.drawCircle = false
|
c.drawCircle = false
|
||||||
|
|
||||||
det = detector.NewDetector()
|
det = detector.NewDetector()
|
||||||
@@ -250,7 +250,7 @@ func (c *Canvas) drawDetection(dets [][]int) {
|
|||||||
c.ctx.Set("lineWidth", 3)
|
c.ctx.Set("lineWidth", 3)
|
||||||
c.ctx.Set("strokeStyle", "red")
|
c.ctx.Set("strokeStyle", "red")
|
||||||
|
|
||||||
if c.showFace {
|
if c.showFaceRect {
|
||||||
if c.drawCircle {
|
if c.drawCircle {
|
||||||
c.ctx.Call("moveTo", row+int(scale/2), col)
|
c.ctx.Call("moveTo", row+int(scale/2), col)
|
||||||
c.ctx.Call("arc", row, col, scale/2, 0, 2*math.Pi, true)
|
c.ctx.Call("arc", row, col, scale/2, 0, 2*math.Pi, true)
|
||||||
@@ -352,7 +352,7 @@ func (c *Canvas) detectKeyPress() {
|
|||||||
keyCode := args[0].Get("key")
|
keyCode := args[0].Get("key")
|
||||||
switch {
|
switch {
|
||||||
case keyCode.String() == "q":
|
case keyCode.String() == "q":
|
||||||
c.showFace = !c.showFace
|
c.showFaceRect = !c.showFaceRect
|
||||||
case keyCode.String() == "z":
|
case keyCode.String() == "z":
|
||||||
c.showPupil = !c.showPupil
|
c.showPupil = !c.showPupil
|
||||||
case keyCode.String() == "a":
|
case keyCode.String() == "a":
|
||||||
|
Reference in New Issue
Block a user