社区
新手乐园
帖子详情
HOWTO:实现从http读取并显示图像?
听海拉拉
2010-08-26 11:40:20
Hi ALL,
比如有一个web site http://127.0.0.1:8080/?action=stream&ignored.mjpg。要从上面读取jpeg的图像,并显示出来。
而且不断的读取,成视频流。
用c++怎么实现呢?或者MFC也行。
谢谢
...全文
92
3
打赏
收藏
HOWTO:实现从http读取并显示图像?
Hi ALL, 比如有一个web site http://127.0.0.1:8080/?action=stream&ignored.mjpg。要从上面读取jpeg的图像,并显示出来。 而且不断的读取,成视频流。 用c++怎么实现呢?或者MFC也行。 谢谢
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
听海拉拉
2010-08-26
打赏
举报
回复
[Quote=引用 1 楼 binghuazh 的回复:]
搞个缓存,播放图片从缓存去数据,http读过来把数据扔缓存里面,注意同步
图片控件就是Picture啊 Image都有,mfc的
http就用socket send recv回来
gl
[/Quote]
有空帮忙改改
tks
// HttpTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "HttpTest.h"
#include <wininet.h>
#include <highgui.h>
#include <cv.h>
#pragma comment(lib, "Wininet.lib")
#pragma comment(lib, "jpeg.lib")
#pragma comment(lib,"CxImage.lib")
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
void Download(char url[]);
CWinApp theApp;
using namespace std;
//BYTE * lpBmpData; //保存图像文件像素数据
//LONG ImageWidth; //图像宽度
//LONG ImageHeight; //图像高度
//PBITMAPINFO info; //文件信息头
//IplImage * temp;
//IplImage * pImg;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
//cout<<"nihao"<<endl;
char url[1000] = "http://192.168.131.129:8080/?action=snapshot";
while(1)
{
try
{
cout<<"目标地址 URL:"<<url<<endl;
Download(url);
cout<<"已经显示"<<endl;
}
catch(char *e)
{
cout<<e<<endl<<endl;
}
}
return nRetCode;
}
void Download(char url[])
{
char buffer[100000];
DWORD bytes_read;
HINTERNET internet= InternetOpen("HTTP Downloader",INTERNET_OPEN_TYPE_PRECONFIG,
NULL,NULL, NULL);
if( !internet )
throw "InternetOpen error!";
HINTERNET file_handle = InternetOpenUrl(internet, url, NULL, 0, INTERNET_FLAG_RELOAD, 0);
if( !file_handle)
throw "InternetOpenUrl error! - Maybe you should add Http:// or Ftp://";
BOOL b = InternetReadFile(file_handle,buffer,100000,&bytes_read);
if(!b)
throw "InternetReadFile error!";
buffer[bytes_read]=0;
InternetCloseHandle(internet);
}
听海拉拉
2010-08-26
打赏
举报
回复
tks
blingpro
2010-08-26
打赏
举报
回复
搞个缓存,播放图片从缓存去数据,http读过来把数据扔缓存里面,注意同步
图片控件就是Picture啊 Image都有,mfc的
http就用socket send recv回来
gl
【Spark专场】Deep Dive: How Spark Uses Memory
当今,企业”上云”节奏正在加速,特别是在以...另一方面,利用基于云计算之上的大数据、人工智能等新技术,企业又可以以较小的成本、更高效地挖掘出提升企业业务的数据与方法,
实现
云、数、智的自然融合和协力发展。
opencv学习笔记——【OpenCV3】
图像
的
读取
、
显示
与保存
显示
通过函数cv::imshow()来
实现
;而保存则通过cv::imwrite()来
实现
。 1、图片的
读取
,通过函数cv::imread()
读取
。 第一个参数为图片文件的相对路径或绝对路径(注意:路径一定要正确,同时也要确保文件的格式正确...
DCMTK
读取
多帧
图像
,不需要全部
读取
像素数据,即可处理数据
Howto
: Access multi-frame images without loading complete pixel data Here's an example that shows how to access the individual frames of a large multi-frame image (for visualization purposes) wi...
cv mat保存图片_【OpenCV3】
图像
的
读取
、
显示
与保存
显示
通过函数cv::imshow()来
实现
;而保存则通过cv::imwrite()来
实现
。1、图片的
读取
,通过函数cv::imread()
读取
。第一个参数为图片文件的相对路径或绝对路径(注意:路径...
nodejs
读取
图片返回,nodejs - 如何
读取
和输出jpg
图像
?
I've been trying to find an example of how to read a jpeg image and then show the image.var
http
= require('
http
'), fs = require('fs');
http
.createServer(function (req, res) {res.writeHead(200, {'Conte...
新手乐园
33,311
社区成员
41,784
社区内容
发帖
与我相关
我的任务
新手乐园
C/C++ 新手乐园
复制链接
扫一扫
分享
社区描述
C/C++ 新手乐园
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章