Ask Your Question

hanban's profile - activity

2019-11-11 20:25:08 -0600 received badge  Notable Question (source)
2019-09-01 12:15:38 -0600 received badge  Famous Question (source)
2019-01-18 13:25:54 -0600 received badge  Popular Question (source)
2018-05-04 04:36:07 -0600 received badge  Notable Question (source)
2018-01-25 05:48:48 -0600 received badge  Popular Question (source)
2017-05-23 12:59:14 -0600 asked a question Need Code: Android OpenCV camera2 capture application

Hello all.

I need a simple reference to a code that opens the camera device using API android.hardware.camera2 , and pass the frame to a Mat object for OPENCV processing.

All the code I manage to find use athe andorid.hardware.camera API, and I get low frame rates even when not doing any processing, just in preview mode. If anyone have an application with high speed frame rate camera output with Mat for openCV work, please share with me..

Thanks!

2017-05-15 16:53:45 -0600 answered a question good capture card for HDMI capture with openCV

anyone can help with this?

2017-05-09 23:41:42 -0600 asked a question good capture card for HDMI capture with openCV

Hi all. I need a recommendation on a good capture card for capturing HDMI stream that works 100% with OpenCV. the HDMI input is coming from a camera. I need a good model with minimum latency. from your experience, which one should I go for?

2017-04-17 18:01:47 -0600 received badge  Enthusiast
2017-04-14 18:17:16 -0600 commented question getting openCV to read from an HDMI source

Steven, Thanks for looking around for me, sucks that the HDMI input on the board is not supported.. So right now what should I consider as my best option? If I need to get a dongle or a capture card supported by openCV I would do that. The problem is I need somthing that can atleast in preview mode (as I dont need any actual recording) will allow me to see, say, my moving hand infront of the camera with practically no delay on my pc monitor. I cant have the surgeon see his camera movements with delay.. it's a big NO NO.. Is there anything out in the capture card market that can fit me? I'll take any idea you might have. P.S, my open cv code add litttle to no delay, its based on marking/drawing on live video. I dont use any heavy tracking ... (more)

2017-04-13 12:52:13 -0600 commented question getting openCV to read from an HDMI source

hi berak, camera is a Laparoscopic Surgery camera, I treat is as a black box with an HDMI output. I doubt It has an SDK. I just need to do some processing on openCV before i send the video to the TV monitor in the operating room. So openCV process letancy aside, i need the frames to arrive to the computer in real time. I also have a firefly RK-3288 reload development board running linux with an HDMI input .I can use it instead of a pc, , but I'm not sure how openCV can read from an HDMI input directly.

2017-04-13 12:07:06 -0600 asked a question getting openCV to read from an HDMI source

Hey, I need to make openCV use an hdmi source (a medical camera which connects to an HDMI input). my problem is, the camera out is HDMI, not usb, needless to say, it is not a webcam.

what is the best way to get openCV to read the HDMI input? I have looked at video capture cards, but I dont really need to do any recording, I just need the video feed to go live in realtime. I dont need to save any of that data.

any ideas?

thanks.

2017-04-04 06:00:25 -0600 received badge  Editor (source)
2017-04-04 06:00:07 -0600 asked a question OpenCV video window mouse cursor style

Is it possible to change the crosshair style cursor when opening a video with openCV? (python)

It's too small, I need a bigger one, with a different shape.

Do I have to use a GUI for that? (using GUI like Tkinter slows down my FPS drastically when trying to resize for full screen)

Would be happy if someone can lead me to a simple python code that lets me play a full screen video (or webcam..) with openCV, with a good sized mouse cursor, OR, tell me how to modify the highgui to give a different cursor

2017-04-04 04:46:30 -0600 commented question Python + OpenCV + Tkinter playing video help

Hi Eduardo, using self.current_image= self.current_image.resize([1280,1024],PIL.Image.NEAREST) inside the video_loop function still slows down FPS greatly. I've tried to make openCV do the resize with frame = cv2.resize(frame, (1280,1024)) just below ok, frame = self.vs.read() in the loop, still FPS slowed down. I would greatly appreciate if anyone can run this code on some test avi/mp4 file and see if there is any way to go full screen with proper FPS. I could in theory just run the openCV window without any Tkinter GUI and get good speed, but i must have the mouse cursor options Tkinter gives me, the stock openCV window crosshair cursor is too small and there is no way to modify it without using GUI.

2017-04-04 03:28:49 -0600 asked a question Python + OpenCV + Tkinter playing video help

Hey, all. So here's my problem: I need a GUI to get a live webcam stream from openCV (or just open a video file), pass it to the Tkinter GUI window, and add some buttons and stuff to it. when I run the code and play the video, the video plays with proper FPS (same speed as just opening it with winows media player), however, the video window is small. It's very important that i get the video to full screen dimentions, perhaps a tad less so I can still see the GUI button.

If i try to resize the video for full screen, by adding self.current_image= self.current_image.resize([2560,1440],PIL.Image.ANTIALIAS), my FPS drop and video is playing very slowly.

going with self.root.attributes("-fullscreen",True) , the window just goes full screen but the video size itself is same. so that's no good either.

How can I fill the screen with the video while keeping proper FPS? is it a code error or just slow processing?

here is the code: thanks evryone

import PIL
from PIL import Image, ImageTk
import Tkinter as tk
import argparse
import datetime
import cv2
import os

class Application:
    def __init__(self, output_path = "./"):
        """ Initialize application which uses OpenCV + Tkinter. It displays
            a video stream in a Tkinter window and stores current snapshot on disk """
        self.vs = cv2.VideoCapture('Kaabil Hoon (Kaabil) Hrithik Roshan (2K Ultra HD 1440p)-(HDLoft.Com).mp4') # capture video frames, 0 is your default video camera
        self.output_path = output_path  # store output path
        self.current_image = None  # current image from the camera

        self.root = tk.Tk()  # initialize root window
        self.root.title("PyImageSearch PhotoBooth")  # set window title
        # self.destructor function gets fired when the window is closed
        self.root.protocol('WM_DELETE_WINDOW', self.destructor)
        self.panel = tk.Label(self.root)  # initialize image panel
        self.panel.pack(padx=10, pady=10)
        self.root.config(cursor="arrow")

        # create a button, that when pressed, will take the current frame and save it to file
        btn = tk.Button(self.root, text="Snapshot!", command=self.take_snapshot)
        btn.pack(fill="both", expand=True, padx=10, pady=10)

        # start a self.video_loop that constantly pools the video sensor
        # for the most recently read frame
        self.video_loop()


    def video_loop(self):
        """ Get frame from the video stream and show it in Tkinter """
        ok, frame = self.vs.read()  # read frame from video stream
#        frame = cv2.resize(frame, (1500,1000))
        if ok:  # frame captured without any errors
            key = cv2.waitKey(1000)
            cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)  # convert colors from BGR to RGBA
            self.current_image = Image.fromarray(cv2image)  # convert image for PIL
            #self.current_image= self.current_image.resize([1280,1024],PIL.Image.ANTIALIAS)
            imgtk = ImageTk.PhotoImage(image=self.current_image)  # convert image for tkinter 
            self.panel.imgtk = imgtk  # anchor imgtk so it does not be deleted by garbage-collector  
            self.panel.config(image=imgtk)  # show the image
            #self.root.attributes("-fullscreen",True)
        self.root.after(1, self.video_loop)  # call the same function after 30 milliseconds

    def take_snapshot(self):
        """ Take snapshot and ...
(more)