Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to upload image from buffer with curl?
    text
    copied!<p>I'm succesfully capturing frames with software described in <a href="http://thinkrpi.wordpress.com/2013/05/22/opencvpi-cam-step-6-video/" rel="nofollow">Pierre Raufast blog</a>. I tried to upload image buffer using IplImage structures or raw buffer (please look at <code>buffer</code> and <code>dstImage</code> in <code>video_buffer_callback</code> function in this <a href="http://raufast.org/download/camcv_vid0.c" rel="nofollow">source code</a>). I'm using modified code from libcurl <a href="http://curl.haxx.se/libcurl/c/postit2.html" rel="nofollow">example</a>.</p> <pre><code>cvMatBuff = cvEncodeImage(".jpg", py, 0); /* Fill in the file upload field from buffer */ curl_formadd(&amp;formpost, &amp;lastptr, CURLFORM_COPYNAME, "file", CURLFORM_BUFFER, "nowy.jpg", CURLFORM_BUFFERPTR, cvMatBuff, CURLFORM_END); curl = curl_easy_init(); </code></pre> <p>Unfortunately after execution I'm getting 500 error from my flask application.</p> <pre><code>192.168.0.16 - - [17/Nov/2013 21:02:22] "POST /faces HTTP/1.1" 500 - ---------------------------------------- Exception happened during processing of request from ('192.168.0.16', 48537) Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock self.process_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request self.finish_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__ self.handle() File "/home/usr/flask/lib/python2.7/site-packages/werkzeug/serving.py", line 200, in handle rv = BaseHTTPRequestHandler.handle(self) File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle self.handle_one_request() File "/home/usr/flask/lib/python2.7/site-packages/werkzeug/serving.py", line 235, in handle_one_request return self.run_wsgi() File "/home/usr/flask/lib/python2.7/site-packages/werkzeug/serving.py", line 194, in run_wsgi traceback.plaintext) File "/home/usr/flask/lib/python2.7/site-packages/werkzeug/utils.py", line 71, in __get__ value = self.func(obj) File "/home/usr/flask/lib/python2.7/site-packages/werkzeug/debug/tbtools.py", line 359, in plaintext return u'\n'.join(self.generate_plaintext_traceback()) File "/home/usr/flask/lib/python2.7/site-packages/werkzeug/debug/tbtools.py", line 353, in generate_plaintext_traceback frame.function_name UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 17: ordinal not in range(128) </code></pre> <p>My server side code works fine when I'm uploading image from file by:</p> <pre><code>curl -F "file=@./medium.jpg" http://localhost:5000/faces </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload