You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: pigo.go
    path of file: ./repos/caire/vendor/github.com/esimov/pigo/core
    
    the code of the file until where you have to start completion: package pigo

import (
	"encoding/binary"
	"math"
	"sort"
	"sync"
	"unsafe"
)

// CascadeParams contains the basic parameters to run the analyzer function over the defined image.
// MinSize: represents the minimum size of the face.
// MaxSize: represents the maximum size of the face.
// ShiftFactor: determines to what percentage to move the detection window over its size.
// ScaleFactor: defines in percentage the resize value of the detection window when moving to a higher scale.
type CascadeParams struct {
	MinSize     int
	MaxSize     int
	ShiftFactor float64
	ScaleFactor float64
	ImageParams
}

// ImageParams is a struct for image related settings.
// Pixels: contains the grayscale converted image pixel data.
// Rows: the number of image rows.
// Cols: the number of image columns.
// Dim: the image dimension.
type ImageParams struct {
	Pixels []uint8
	Rows   int
	Cols   int
	Dim  
    
func (pg *Pigo) RunCascade(cp CascadeParams, angle float64) []Detection {
	var (
		detections []Detection
		pixels     = cp.Pixels
		treeDepth  = int(pow(2, int(pg.treeDepth)))
		q          float32
	)
	scale := cp.MinSize

	det := detpool.Get().(*Detection)
	defer detpool.Put(det)

	// Run the classification function over the detection window
	// and check if the false positive rate is above a certain value.
	for scale <= cp.MaxSize {
		step := int(math.Max(cp.ShiftFactor*float64(scale), 1))
		offset := (scale/2 + 1)

		for row := offset; row <= cp.Rows-offset; row += step {
			for col := offset; col <= cp.Cols-offset; col += step {
				if angle > 0.0 {
					if angle > 1.0 {
						angle = 1.0
					}
					q = pg.classifyRotatedRegion(row, col, scale, treeDepth, angle, cp.Rows, cp.Cols, pixels, cp.Dim)
				} else {
					q = pg.classifyRegion(row, col, scale, treeDepth, pixels, cp.Dim)
				}

				det.Row = row
				det.Col = col
				det.Scale = scale
				det.Q = q

				if q > 0.0 {
					detections = append(detections, *det)
				}
			}
		}
		// We need to avoid running into an infinite loop because of float to int conversion
		// in cases when scaleFactor == 1.1 and minSize == 9 as example.
		// When the scale is 9, the factor would come up with 9.9, which again becomes 9 because of the int() conversion.
		// This approach gives the same speed without having an impact on the detection score.
		scale = int(float64(scale) + math.Max(2, (float64(scale)*cp.ScaleFactor)-float64(scale)))
	}
	return detections
}