gocv icon indicating copy to clipboard operation
gocv copied to clipboard

Support waitKeyEx

Open Thanzex opened this issue 1 year ago • 3 comments

Description

This library supports waitKey, but not waitKeyEx or pollKey for that matter.

pollKey is already a fairly big omission, but missing waitKeyEx is a breaking functionality.

Right now waitKey only returns alphanumeric characters + symbols, but no special characters.

This is a problem since directional keys, F-keys, CTRL, SHIFT or ALT or their combination are not supported and either don't show up or report as 0.

waitKeyEx returns the full key code, allowing the whole keyboard to be used.

Steps to Reproduce

package main

import (
	"fmt"

	"gocv.io/x/gocv"
)

func main() {
	window := gocv.NewWindow("Test")
	defer window.Close()

	for {

		/*
		* Do something
		 */

		switch k := window.WaitKey(64); k {
		case 'q':
			return
		default:
			fmt.Println("\nPressed ", k)
		}

	}
}

Your Environment

  • Operating System and version: Windows 11
  • OpenCV version used: 4.10.0
  • How did you install OpenCV? Build in the package directory
  • GoCV version used: 0.37.0
  • Go version: go1.22.4 windows/amd64

Thanzex avatar Jul 04 '24 10:07 Thanzex

Yes, please!

deadprogram avatar Jul 22 '24 10:07 deadprogram

Hi all! Just sent a pull request for adding waitKeyEx.

cheers!

diegohce avatar Aug 13 '24 22:08 diegohce

Merged. Tagged to close this on next release. Thanks @diegohce

deadprogram avatar Aug 15 '24 15:08 deadprogram