kerberos-io / machinery

(DEPRECATED) An open source image processing framework, which uses your USB-, IP- or RPi-camera to recognize events (e.g. motion).
https://www.kerberos.io
490 stars 104 forks source link

Support of EasyCap devices #107

Open gorbatiy87 opened 6 years ago

gorbatiy87 commented 6 years ago

Hi, I'm trying to use USB EasyCap device (USBTV007) with KiOS and Raspberry Pi 3, EasyCap is used to convert video from analog camera, but machinery can't capture video stream. EasyCap is recognized as /dev/video0 and I'm capable to capture video with ffmpeg.

cedricve commented 6 years ago

Can you send me the output of lsusb

gorbatiy87 commented 6 years ago

I'm not at home now, will send full output later, but device id is 1b71:3002.

gorbatiy87 commented 6 years ago

[root@kios-18fa2ab6 ~]# lsusb Bus 001 Device 002: ID 0424:9514 Bus 001 Device 001: ID 1d6b:0002 Bus 001 Device 003: ID 0424:ec00 Bus 001 Device 004: ID 1b71:3002

gorbatiy87 commented 5 years ago

Hi, I've got some time for experimenting with EasyCap, I installed opencv for python and tried to grab some images using EasyCap. I found out that EasyCap doesn't support resolution changing:

vcap = cv2.VideoCapture() vcap.set(cv2.CAP_PROP_FRAME_WIDTH, 480) vcap.set(cv2.CAP_PROP_FRAME_HEIGHT, 640)

both set commands calls returns false

I tried to build build machinery with removed set calls, and resolution set to 720x480 (matching easyCap resolution):

void USBCamera::setImageSize(int width, int height)
{
    Capture::setImageSize(width, height);
   try
   {
        //m_camera->set(CV_CAP_PROP_FRAME_WIDTH, m_frameWidth);
        //m_camera->set(CV_CAP_PROP_FRAME_HEIGHT, m_frameHeight);
        m_camera->set(CV_CAP_PROP_FOURCC, CV_FOURCC(m_fourcc[0], m_fourcc[1], m_fourcc[2], m_fourcc[3]));
    }
    catch(cv::Exception & ex)
    {
       throw OpenCVException(ex.msg.c_str());
    }

}

After that I could see picture trough the web interface in kerberos-io, I guess that set calls was throwing exceptions.

Is it possible to make patch?

cedricve commented 5 years ago

@gorbatiy87 great search, to be honest I think we should create a seperate capture device for this and maybe inherit from the USBCapture class. I think that would be the most clean way.

gorbatiy87 commented 5 years ago

Sounds nice, do you need my assistance?

cedricve commented 5 years ago

Well I would say you can give it a try https://doc.kerberos.io/2.0/machinery/contribute#adding-a-new-class.. I'm here to help you if you have any questions.

gorbatiy87 commented 5 years ago

Thanks, nice guide I'll try and will contact you later.

KMiNT21 commented 4 years ago

Any success? The same problem with EasyCap - images only, no video in /etc/opt/kerberosio/h264.