Livefeed video is not moving

asked 2015-10-03 01:52:13 -0500

SCBEAR gravatar image

I am using the TS351 and RC305 Vtx set with EasyCap capture card to transmit the video i captured back to the computer for processing. However the video in the video window always stop after some time. image description

So halfway doing the livefeed, the screen just stuck there and it is not moving anymore. It may work after i re-launch my program. I wonder what is actually the problem, the easycap does not seem to be lagging as seen from the Honestech TVR software. The Vtx set was working fine before.

Is my code too long and heavy, that the while loop is unable to process that fast? or is there other problems?

my code is attached. It is damn long... ya.. it is to detect a specified colour and is working fine with video files

I am using OPENCV 3.0.0 C++ on Windows 8 64 bit system, on Microsoft Visual Studio 2013

//objectTrackingTutorial.cpp

//Written by  Kyle Hounslow 2013

//Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software")
//, to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 
//and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

//The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
//IN THE SOFTWARE.

#include <sstream>
#include <string>
#include <iostream>
#include <vector>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <stdlib.h>
#include <stdio.h>

using namespace cv;
using namespace std;
//initial min and max HSV filter values.
//these will be changed using trackbars

int H_MIN = 0;
int H_MAX = 256;
int S_MIN = 0;
int S_MAX = 256;
int V_MIN = 0;
int V_MAX = 256; //original*/



//default capture width and height
const int FRAME_WIDTH = 640;
const int FRAME_HEIGHT = 480;
//max number of objects to be detected in frame
const int MAX_NUM_OBJECTS=50;
//minimum and maximum object area
const int MIN_OBJECT_AREA = 20*20;
const int MAX_OBJECT_AREA = FRAME_HEIGHT*FRAME_WIDTH/1.5;
//names that will appear at the top of each window
const string windowName = "Original Image";
const string windowName1 = "HSV Image";
const string windowName2 = "Thresholded Image";
const string windowName3 = "After Morphological Operations";
const string trackbarWindowName = "Trackbars";

//Declare variable for Brightness and Contrast control
int iSliderValue1 = 50;
int iSliderValue2 = 50;

void B_C(){
    //Create a window
    namedWindow("Brightness & Contrast", CV_WINDOW_AUTOSIZE);

    //Create trackbar for Brightness
    createTrackbar("Brightness ...
(more)
edit retag flag offensive close merge delete

Comments

  • you don't need 2 waitKey() calls, just go for int key = waitKey(30); (and please , avoid all deprecated cv* functions)

  • try some other programs, like vlc or graphedt(from dshow sdk)

  • what size are those images ? maybe reducing the resolution helps
berak gravatar imageberak ( 2015-10-03 02:07:24 -0500 )edit