[OpenCV] Chapter01-04 Show image into window

Show image into window

Source Code

package main

import (
 "log"

 "gocv.io/x/gocv"
)

func main() {
 imageFilePath := "../../data/Lena.png"
 mat := gocv.IMRead(imageFilePath, gocv.IMReadAnyColor)
 if mat.Empty() {
  log.Panic("Can not read Image file : ", imageFilePath)
  return
 }

 window := gocv.NewWindow("Original Image")
 defer window.Close()

 window.IMShow(mat)
 gocv.WaitKey(5000) // if you want to show continually, 5000 -> -1
}

Execute Result

Comments

Popular posts from this blog

[OpenCV] What is gocv?

[OpenCV] Chapter01-05 Working with UI elements such as scrollbars in OpenCV window

[OpenCV] How to set up gocv