Ask Your Question

Gosha_DE's profile - activity

2019-02-26 20:05:53 -0600 received badge  Notable Question (source)
2018-01-27 11:11:44 -0600 received badge  Popular Question (source)
2015-10-26 11:43:08 -0600 commented answer FPS for USB WEB cam

to EDIT2 Average FPS:6.74127 :( driveer? but webcam7 capture file with 25 fps.

2015-10-26 04:14:05 -0600 commented answer FPS for USB WEB cam

I tested (with VideoCapture cap(0 + CV_CAP_DSHOW); and cap.set(CV_CAP_PROP_FPS,25); without writer.write(frame); and imshow("MyVideo", frame);) on another computer/cam ...

notebook with int web - 7fps

ws with ather usb cam -18fps

win8 tablet -19fps

win8 tablet (with VideoCapture cap(0 + CV_CAP_DSHOW); cap.set(CV_CAP_PROP_FPS,25); writer.write(frame); and imshow("MyVideo", frame );-15fps (waitKey(1))

2015-10-26 03:24:29 -0600 answered a question FPS for USB WEB cam

well. thank you.

1) i capture in minute and see "cout << cc << endl;" - 408. 408/60=6.8fps and cap.avi played with acceleration.

2) without writer.write(frame);, with imshow("MyVideo", frame); i have 480 frame per minute = 7.7fps without writer.write(frame); and imshow("MyVideo", frame); i have 8fps

Sistem idle in task manager - 98%

3)with VideoCapture cap(0 + CV_CAP_DSHOW); and cap.set(CV_CAP_PROP_FPS,25); without writer.write(frame); and imshow("MyVideo", frame); i have 8.1fps

I do not understand... :(

   VideoCapture cap(0 + CV_CAP_DSHOW); // open the video file for reading
    if ( !cap.isOpened() )  // if not success, exit program
    {
         cout << "Cannot open the video file" << endl;
         return -1;
    }

    cap.set(CV_CAP_PROP_FPS,25);
    double fps = cap.get(CV_CAP_PROP_FPS); //get the frames per seconds of the video
    cout << "Frame per seconds : " << fps << endl;
    namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo"
    int cc=0;
    while(1)
    {
        Mat frame;
        bool bSuccess = cap.read(frame); // read a new frame from video
         if (!bSuccess) //if not success, break loop
        {
                        cout << "Cannot read the frame from video file" << endl;
                       break;
        }
       cc++;
        if(waitKey(1) == 32) 
       {
                cout << "esc key is pressed by user" << endl; 
                cout << cc << endl; 
                waitKey(10000) ;
                 break; 
       }
    }
2015-10-26 03:24:00 -0600 commented question FPS for USB WEB cam

i have namedWindow("MyVideo",CV_WINDOW_AUTOSIZE);, but not imshow("MyVideo", frame);. i see gray window. and waitKey work.

2015-10-23 11:25:39 -0600 received badge  Editor (source)
2015-10-23 11:25:12 -0600 asked a question FPS for USB WEB cam

Please help me. I'am beginer? :(

For this code (win 7) i have only about 6.8 FPS. i need 25. How to сapture at higher FPS. thank you.

cap.get(CV_CAP_PROP_FPS)=0

int main() 
    {
        VideoCapture cap(0); // open the video file for reading

        if ( !cap.isOpened() )  // if not success, exit program
        {
             cout << "Cannot open the video file" << endl;
             return -1;
        }

        double fps = cap.get(CV_CAP_PROP_FPS); //get the frames per seconds of the video
        if (fps==0) 
        {
            fps=25;   
        }

        cout << "Frame per seconds : " << fps << endl;
        CvSize size = cvSize( cap.get( CV_CAP_PROP_FRAME_WIDTH), cap.get(  CV_CAP_PROP_FRAME_HEIGHT));
        VideoWriter writer = VideoWriter("cap.avi",CV_FOURCC('M','J','P','G'), fps, size, 1);

        int cc=0;

        while(1)
        {
            Mat frame;

            bool bSuccess = cap.read(frame); // read a new frame from video

            if (!bSuccess) //if not success, break loop
            {
                            cout << "Cannot read the frame from video file" << endl;
                           break;
            }
            writer.write(frame);

            cc++;

            if(waitKey(1) == 27) 

           {
                    cout << "esc key is pressed by user" << endl; 
                    cout << cc << endl; 
                    waitKey(10000) ;
                     break; 
           }
        }
        writer.release();
        return 0;
    }
2015-09-18 12:03:54 -0600 asked a question second VideoWriter: not write frames.

I want to write two files simultaneously (VideoWriter). C# win7.

      class VideoCaptureClass
     { 
        ...    
        public void StartVideo(int vcam, string UrlCam, int videonum)
        { 
              ...
              cap = new VideoCapture(UrlCam);  
              writer1 = new VideoWriter(outputFilename, "PIM1",capture1.Fps, dsize); 
              ...
        } 
        ... 
        public void Run()
        { 
                     ...
                     cap.Read(_image1); 
                     writer1.Write(_image1);
                     ...
        }

in mainform:

        capture.StartVideo(Globals.vcam1, Globals.UrlCam1, 1);
        capture2.StartVideo(Globals.vcam2, Globals.UrlCam2, 2);            
        TSK = Task.Factory.StartNew(capture.Run);
        TSK2 = Task.Factory.StartNew(capture2.Run);

As a result, only one file is written , and the second is left empty ( header only ) ...

i see capture._image1 and capture2._image1. Both Both are readed correctly. :( i probe ip-cam and web-cam. The result is the same.

whether OpenCV write 2 media file ? How to do it?