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")
    
    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?