weixin_38401074 2018-06-27 14:07 采纳率: 0%
浏览 1727
已结题

opencv imencode 出现断言

// 获取视频文件  
VideoCapture cap(1);
if (!cap.isOpened())
{
    AfxMessageBox("打开摄像头失败!!!");
}
// 获取视频总帧数  
long totalFrameNumber = cap.get(CV_CAP_PROP_FRAME_COUNT);

Mat frame;
cap.read(frame);
Framemem = sizeof(frame);
vector<unsigned char> inImage;
imencode(".jpg", frame, inImage);
size_t datalen = inImage.size();
char *msgImage = new char[datalen];
for (int i = 0; i<datalen; i++)
{
    msgImage[i] = inImage[i];
}
总是在imencode 出现断言,0x01E30A14 (opencv_world300.dll) (controller.exe 中)处有未经处理的异常:  0xC0000005:  读取位置 0x0CE5B000 时发生访问冲突。
求解决
  • 写回答

1条回答 默认 最新

  • qq_42515944 2018-06-28 00:17
    关注

    Configuring Nginx
    We want to allow users to download files at the following location: "/files/file_name/". file_name represents the file to download.

    We start from a classic nginx proxy configuration proxying requests to our web application.

    upstream proxy_app {
    server 127.0.0.1:7000;
    }

    server {
    listen 80;
    server_name example.com;

    rewrite_log on;
    access_log      /var/log/nginx/access.log;
    error_log       /var/log/nginx/error.log debug;
    
    client_max_body_size 4G;
    keepalive_timeout 5;
    
    root /var/www;
    
    location / {
        # checks for static file, if not found proxy to app
        try_files $uri/index.html $uri.html $uri @forward_to_app;
    }
    
    location @forward_to_app {
        include /etc/nginx/proxy_params;
        proxy_pass      http://proxy_app;
    }
    

    }

    The idea here is to add an internal directive to URLs for private files and a couple proxy headers.

    $ diff -u prev /etc/nginx/conf.d/default
    ...

    • location /files/(.*)/ {
    • internal;
    • alias /path/to/your/private/files/$1/;
    • }

      location @forward_to_app {
      include /etc/nginx/proxy_params;
      proxy_pass http://proxy_app;

    •   proxy_set_header X-Sendfile-Type   X-Accel-Redirect;
      
    •   proxy_set_header X-Accel-Mapping   /path/to/your/private/files/=/files/(.*)/;
      

      ...

    Configuring the Web application
    Django
    We were serving PDF files through Django here. To have the files served by nginx instead, we return an HttpResponse with an empty body and add a X-Accel-Redirect header. For example:

    ...
    response = HttpResponse()
    response['Content-Type'] = 'application/pdf'
    response['Content-Disposition'] = 'attachment; filename=%s.pdf' % (file_name, )
    response['X-Accel-Redirect'] = '/files/%s' % (file_name, )
    return response

    Rails
    Working with Rails is about the same though a bit different. All the magic happens in the Rack::sendfile middleware. We only need to configure the appropriate x_sendfile_header then call send_file as usual.

    In config/environments/production.rb:

    # Set header to use.
    config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
    

    In the controller:

    # In case of PDF file
    send_file(
        path,
        :disposition => 'inline',
        :type => "application/pdf")
    
    评论

报告相同问题?

悬赏问题

  • ¥15 vue3加ant-design-vue无法渲染出页面
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序