Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/126.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 为打开的cv读取彩信流_C++_Visual Studio_Opencv_Mms - Fatal编程技术网

C++ 为打开的cv读取彩信流

C++ 为打开的cv读取彩信流,c++,visual-studio,opencv,mms,C++,Visual Studio,Opencv,Mms,有没有办法通过open cv读取彩信流以进行直接分析 我试着用C++做一个小项目。我不知道如何将彩信插入opencv 我想我需要在VisualStudio中添加一个库 彩信流中只有视频即时信息读取: mms://s3ewm.castup.net/991450009-52.wmv?ct=IL&rg=BZ&aid=145&tkn=20120201230602&ts=0&cu=FC1B06E9-7ABE-4B1C-9B2A-7A5C6019E99F 更新: 我

有没有办法通过open cv读取彩信流以进行直接分析

我试着用C++做一个小项目。我不知道如何将彩信插入opencv

我想我需要在VisualStudio中添加一个库

彩信流中只有视频即时信息读取:

mms://s3ewm.castup.net/991450009-52.wmv?ct=IL&rg=BZ&aid=145&tkn=20120201230602&ts=0&cu=FC1B06E9-7ABE-4B1C-9B2A-7A5C6019E99F
更新:

我找到了这个链接:

有人收到了带有vlc软件包的彩信

struct ctx
{
   IplImage* image;
   HANDLE mutex;
   uchar*    pixels;
};

void *lock(void *data, void**p_pixels)
{
    struct ctx *ctx = (struct ctx*)data;
    WaitForSingleObject(ctx->mutex, INFINITE);
     *p_pixels = ctx->pixels;   
    return NULL;

}
void display(void *data, void *id){
   (void) data;
   assert(id == NULL);
}
void unlock(void *data, void *id, void *const *p_pixels){
   struct ctx *ctx = (struct ctx*)data;
   /* VLC just rendered the video, but we can also render stuff */
   uchar *pixels = (uchar*)*p_pixels;
   cvShowImage("image", ctx->image);
   ReleaseMutex(ctx->mutex);
   assert(id == NULL); /* picture identifier, not needed here */
}

int main()
{
   cvNamedWindow("image", CV_WINDOW_AUTOSIZE);
   libvlc_media_t* media = NULL;
   libvlc_media_player_t* mediaPlayer = NULL;
   char const* vlc_argv[] = {"--plugin-path", "C:\\Users\\Oscar\\Documents\\libvlc\\vlc-1.1.4"};
   libvlc_instance_t* instance = libvlc_new(2,vlc_argv);
   mediaPlayer = libvlc_media_player_new(instance);
   media = libvlc_media_new_path(instance, "mms://81.89.49.210/musicbox");

   struct ctx* context = ( struct ctx* )malloc( sizeof( *context ) );
   context->mutex = CreateMutex(NULL, FALSE,NULL);
   context->image = cvCreateImage(cvSize(VIDEO_WIDTH, VIDEO_HEIGHT), IPL_DEPTH_8U, 4);
        context->pixels = (unsigned char *)context->image->imageData;

   libvlc_media_player_set_media( mediaPlayer, media);
   libvlc_video_set_callbacks(mediaPlayer, lock, unlock, display, context);
        libvlc_video_set_format(mediaPlayer, "RV32", VIDEO_WIDTH, VIDEO_HEIGHT, VIDEO_WIDTH*4);
   libvlc_media_player_play(mediaPlayer);


   while(1)
   {
   }
   return 0;
}