praxmon
praxmon

Reputation: 5131

Embedding windows in GUI

I am trying to build an app that does 2 things.

  1. Get live feed from webcam and display it using OpenCV. (tried IP Camera but gave up, its still not working)
  2. Plot a chart on the basis of the video input.

The webcam feed is working, I am able to display it using imshow() and namedWindow() . The chart I have made using Tkinter.

The two outputs above, I want to add them in a single frame. Is it possible to do so?

And what do I use to embed them in a single window?

Please note I am using Python and developing on Windows.

Upvotes: 0

Views: 915

Answers (1)

Kalirajan M
Kalirajan M

Reputation: 51

You can combine two or more output windows into a single output window using numpy stack concept.

Referene Link:-

http://docs.scipy.org/doc/numpy/reference/generated/numpy.hstack.html http://docs.scipy.org/doc/numpy/reference/generated/numpy.vstack.html#numpy.vstack

Sample Code:-

import cv2
import numpy as np

img1 = cv2.imread('Bird1.jpg')
img2 = cv2.imread('Bird2.jpg')

img_stack = np.hstack((img1,img2))

cv2.imshow('Image Stack',img_stack)
cv2.waitKey(0)
cv2.destroyAllWindows()

Note:-

You can combine any number of output windows into single one. To do this, the Input Images Height, Width and Channel must be same.

Channel means, If images are in RGB Mode means all Images should be in RGB Mode.

You cannot combine, one RGB Mode Image and one Grayscale Mode Image into a single window.

Like Images, you may also stack videos.

Upvotes: 1

Related Questions