mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-17 00:23:14 +00:00
Add MocapNET
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
project( OpenCVTest )
|
||||
#cmake_minimum_required( VERSION 2.8.7 )
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
find_package(OpenCV REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
|
||||
|
||||
|
||||
|
||||
add_executable(OpenCVTest webcam.cpp)
|
||||
target_link_libraries(OpenCVTest rt dl m ${OpenCV_LIBRARIES} )
|
||||
set_target_properties(OpenCVTest PROPERTIES DEBUG_POSTFIX "D")
|
||||
|
||||
|
||||
set_target_properties(OpenCVTest PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#include "opencv2/opencv.hpp"
|
||||
/** @file webcam.cpp
|
||||
* @brief This is a simple test file to make sure your camera or video files can be opened using OpenCV
|
||||
* @author Ammar Qammaz (AmmarkoV)
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
using namespace cv;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char * webcam = 0;
|
||||
for (int i=0; i<argc; i++)
|
||||
{
|
||||
if (strcmp(argv[i],"--from")==0)
|
||||
{
|
||||
if (argc>i+1)
|
||||
{
|
||||
webcam = argv[i+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VideoCapture cap(webcam); // open the default camera
|
||||
if (webcam==0)
|
||||
{
|
||||
std::cerr<<"Trying to open webcam\n";
|
||||
cap.set(cv::CAP_PROP_FRAME_WIDTH,640); // In case of errors try CV_CAP_PROP_FRAME_WIDTH
|
||||
cap.set(cv::CAP_PROP_FRAME_HEIGHT,480); // In case of errors try CV_CAP_PROP_FRAME_HEIGHT
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr<<"Trying to open "<<webcam<<"\n";
|
||||
}
|
||||
|
||||
if (!cap.isOpened()) // check if succeeded to connect to the camera
|
||||
{
|
||||
std::cerr<<"Openning camera failed\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Mat edges;
|
||||
namedWindow("feed",1);
|
||||
for(;;)
|
||||
{
|
||||
Mat frame;
|
||||
cap >> frame;
|
||||
if ( (frame.size().width>0) && (frame.size().height>0) )
|
||||
{
|
||||
imshow("feed", frame);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr<<"Broken frame.. \n";
|
||||
}
|
||||
waitKey(1);
|
||||
}
|
||||
// the camera will be deinitialized automatically in VideoCapture destructor
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user