fixed typo across the project

This commit is contained in:
esimov
2020-10-21 11:03:06 +03:00
parent c85c33ef2f
commit 6b4129f4c8
17 changed files with 79 additions and 79 deletions

View File

@@ -153,7 +153,7 @@ func TestFlploc_LandmarkPointsDetectorShouldReturnCorrectDetectionPoints(t *test
} }
} }
expectedLandmarkPoints := 2*len(eyeCascades) + len(mouthCascades) + 1 expectedLandmarkPoints := 2*len(eyeCascades) + len(mouthCascades) + 1 // lendmark points of the left/right eyes, mouth + nose
if expectedLandmarkPoints != detectedLandmarkPoints { if expectedLandmarkPoints != detectedLandmarkPoints {
t.Fatalf("expected facial landmark points to be detected: %d, got: %d", expectedLandmarkPoints, detectedLandmarkPoints) t.Fatalf("expected facial landmark points to be detected: %d, got: %d", expectedLandmarkPoints, detectedLandmarkPoints)
} }

View File

@@ -59,7 +59,7 @@ func FindFaces(pixels []uint8) uintptr {
coords := make([]int, 0, len(dets)) coords := make([]int, 0, len(dets))
go func() { go func() {
// Since in Go we cannot transfer a 2d array trough an array pointer // Since in Go we cannot transfer a 2d array through an array pointer
// we have to transform it into 1d array. // we have to transform it into 1d array.
for _, v := range dets { for _, v := range dets {
coords = append(coords, v...) coords = append(coords, v...)

View File

@@ -22,7 +22,7 @@ class GoPixelSlice(Structure):
("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong), ("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong),
] ]
# Obtain the camera pixels and transfer them to Go trough C types. # Obtain the camera pixels and transfer them to Go through C types.
def process_frame(pixs): def process_frame(pixs):
dets = np.zeros(ARRAY_DIM * MAX_NDETS, dtype=np.float32) dets = np.zeros(ARRAY_DIM * MAX_NDETS, dtype=np.float32)
pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte)) pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte))

View File

@@ -19,7 +19,7 @@ class GoPixelSlice(Structure):
("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong), ("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong),
] ]
# Obtain the camera pixels and transfer them to Go trough Ctypes. # Obtain the camera pixels and transfer them to Go through Ctypes.
def process_frame(pixs): def process_frame(pixs):
dets = np.zeros(3 * MAX_NDETS, dtype=np.float32) dets = np.zeros(3 * MAX_NDETS, dtype=np.float32)
pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte)) pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte))

View File

@@ -19,7 +19,7 @@ class GoPixelSlice(Structure):
("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong), ("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong),
] ]
# Obtain the camera pixels and transfer them to Go trough Ctypes. # Obtain the camera pixels and transfer them to Go through Ctypes.
def process_frame(pixs): def process_frame(pixs):
dets = np.zeros(3 * MAX_NDETS, dtype=np.float32) dets = np.zeros(3 * MAX_NDETS, dtype=np.float32)
pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte)) pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte))

View File

@@ -34,7 +34,7 @@ func FindFaces(pixels []uint8) uintptr {
det := make([]int, 0, len(result)) det := make([]int, 0, len(result))
go func() { go func() {
// Since in Go we cannot transfer a 2d array trough an array pointer // Since in Go we cannot transfer a 2d array through an array pointer
// we have to transform it into 1d array. // we have to transform it into 1d array.
for _, v := range result { for _, v := range result {
det = append(det, v...) det = append(det, v...)

View File

@@ -95,7 +95,7 @@ func FindFaces(pixels []uint8) uintptr {
coords := make([]int, 0, len(dets)) coords := make([]int, 0, len(dets))
go func() { go func() {
// Since in Go we cannot transfer a 2d array trough an array pointer // Since in Go we cannot transfer a 2d array through an array pointer
// we have to transform it into 1d array. // we have to transform it into 1d array.
for _, v := range dets { for _, v := range dets {
coords = append(coords, v...) coords = append(coords, v...)

View File

@@ -20,7 +20,7 @@ class GoPixelSlice(Structure):
("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong), ("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong),
] ]
# Obtain the camera pixels and transfer them to Go trough Ctypes. # Obtain the camera pixels and transfer them to Go through Ctypes.
def process_frame(pixs): def process_frame(pixs):
dets = np.zeros(ARRAY_DIM * MAX_NDETS, dtype=np.float32) dets = np.zeros(ARRAY_DIM * MAX_NDETS, dtype=np.float32)
pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte)) pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte))

View File

@@ -59,7 +59,7 @@ func FindFaces(pixels []uint8) uintptr {
coords := make([]int, 0, len(dets)) coords := make([]int, 0, len(dets))
go func() { go func() {
// Since in Go we cannot transfer a 2d array trough an array pointer // Since in Go we cannot transfer a 2d array through an array pointer
// we have to transform it into 1d array. // we have to transform it into 1d array.
for _, v := range dets { for _, v := range dets {
coords = append(coords, v...) coords = append(coords, v...)

View File

@@ -20,7 +20,7 @@ class GoPixelSlice(Structure):
("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong), ("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong),
] ]
# Obtain the camera pixels and transfer them to Go trough Ctypes. # Obtain the camera pixels and transfer them to Go through Ctypes.
def process_frame(pixs): def process_frame(pixs):
dets = np.zeros(ARRAY_DIM * MAX_NDETS, dtype=np.float32) dets = np.zeros(ARRAY_DIM * MAX_NDETS, dtype=np.float32)
pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte)) pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte))

View File

@@ -70,7 +70,7 @@ func FindFaces(pixels []uint8) uintptr {
coords := make([]int, 0, len(dets)) coords := make([]int, 0, len(dets))
go func() { go func() {
// Since in Go we cannot transfer a 2d array trough an array pointer // Since in Go we cannot transfer a 2d array through an array pointer
// we have to transform it into 1d array. // we have to transform it into 1d array.
for _, v := range dets { for _, v := range dets {
coords = append(coords, v...) coords = append(coords, v...)

View File

@@ -34,7 +34,7 @@ def rotateImage(image, angle):
return result return result
# Obtain the camera pixels and transfer them to Go trough Ctypes. # Obtain the camera pixels and transfer them to Go through Ctypes.
def process_frame(pixs): def process_frame(pixs):
dets = np.zeros(ARRAY_DIM * MAX_NDETS, dtype=np.float32) dets = np.zeros(ARRAY_DIM * MAX_NDETS, dtype=np.float32)
pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte)) pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte))

View File

@@ -119,7 +119,7 @@ func FindFaces(pixels []uint8) uintptr {
coords := make([]int, 0, len(dets)) coords := make([]int, 0, len(dets))
go func() { go func() {
// Since in Go we cannot transfer a 2d array trough an array pointer // Since in Go we cannot transfer a 2d array through an array pointer
// we have to transform it into 1d array. // we have to transform it into 1d array.
for _, v := range dets { for _, v := range dets {
coords = append(coords, v...) coords = append(coords, v...)

View File

@@ -47,7 +47,7 @@ class GoPixelSlice(Structure):
("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong), ("pixels", POINTER(c_ubyte)), ("len", c_longlong), ("cap", c_longlong),
] ]
# Obtain the camera pixels and transfer them to Go trough Ctypes # Obtain the camera pixels and transfer them to Go through Ctypes
def process_frame(pixs): def process_frame(pixs):
dets = np.zeros(ARRAY_DIM * MAX_NDETS, dtype=np.float32) dets = np.zeros(ARRAY_DIM * MAX_NDETS, dtype=np.float32)
pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte)) pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte))

View File

@@ -1,7 +1,7 @@
## Webcam demo (slow) ## Webcam demo (slow)
This demo shows how we can transfer the webcam frames from Python to Go by sending the captured frames as byte array into the standard output. This demo shows how we can transfer the webcam frames from Python to Go by sending the captured frames as byte array into the standard output.
We will run the face detector over the byte arrays received from the standard output and send the result into a web browser trough a webserver. We will run the face detector over the byte arrays received from the standard output and send the result into a web browser through a webserver.
### Run ### Run

View File

@@ -17,7 +17,7 @@ $ GOOS=js GOARCH=wasm go build -o lib.wasm wasm.go
``` ```
### Supported keys: ### Supported keys:
<kbd>s</kbd> - Show/hide pupils<br/> <kbd>s</kbd> - Show/hide pupils<br/>
<kbd>c</kbd> - Circle trough the detection shape types (`rectangle`|`circle`|`ellipse`)<br/> <kbd>c</kbd> - Circle through the detection shape types (`rectangle`|`circle`|`ellipse`)<br/>
<kbd>f</kbd> - Show/hide facial landmark points (hidden by default) <kbd>f</kbd> - Show/hide facial landmark points (hidden by default)
## Demos ## Demos

View File

@@ -23,7 +23,7 @@ func NewDetector() *Detector {
return &d return &d
} }
// FetchCascade retrive the cascade file trough a JS http connection. // FetchCascade retrive the cascade file through a JS http connection.
// It should return the binary data as uint8 integers or err in case of an error. // It should return the binary data as uint8 integers or err in case of an error.
func (d *Detector) FetchCascade(url string) ([]byte, error) { func (d *Detector) FetchCascade(url string) ([]byte, error) {
d.respChan = make(chan []uint8) d.respChan = make(chan []uint8)