Пример #1
0
func findFirstPixel(rectArea int, img1, img2 image.Image, rect image.Rectangle, threshold int) *RectBounds {
	count := 0
	for ; count < rectArea; count++ {
		x, y := vnc.FindXY(count, rect)
		if pixDifference(x, y, threshold, img1, img2) {
			fmt.Println("in loop iteration, %d", count)
			rb := &RectBounds{}

			rb.setLeft(x, y)
			rb.setRight(x, y)
			rb.setUpper(x, y)
			rb.setLower(x, y)
			return rb
		}
	}
	return &RectBounds{}
}
Пример #2
0
func findRectBounds(rectArea int, img1, img2 image.Image, rb *RectBounds, rect image.Rectangle, threshold int) {
	totalChanges := 0
	count := 0
	for ; count < rectArea; count++ {
		x, y := vnc.FindXY(count, rect)
		if pixDifference(x, y, threshold, img1, img2) {
			totalChanges += 1
			if x < rb.leftb.x {
				fmt.Println("leftbound changed to", x, y)
				rb.setLeft(x, y)
			} else if x > rb.rightb.x {
				fmt.Println("rightbound changed to", x, y)
				rb.setRight(x, y)
			}

			if y > rb.lowerb.y {
				fmt.Println("lowerbound changed to", x, y)
				rb.setLower(x, y)
			}
		}
	}
	fmt.Println(totalChanges)
}