<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Cherrion</title>
    <description>The latest articles on DEV Community by Cherrion (@cherrion).</description>
    <link>https://dev.to/cherrion</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4138468%2F544bc403-88aa-4b01-8455-d0207df30776.jpg</url>
      <title>DEV Community: Cherrion</title>
      <link>https://dev.to/cherrion</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cherrion"/>
    <language>en</language>
    <item>
      <title>Zero-copy video stream for Python</title>
      <dc:creator>Cherrion</dc:creator>
      <pubDate>Wed, 23 Sep 2026 05:40:13 +0000</pubDate>
      <link>https://dev.to/cherrion/zero-copy-video-stream-for-python-klj</link>
      <guid>https://dev.to/cherrion/zero-copy-video-stream-for-python-klj</guid>
      <description>&lt;p&gt;OpenCV-Python is a python library widely used for camera capture and real-time video stream process. However, the pipeline includes many creations and destructions of numpy arrays, which significantly increases the memory consumption. Thus, this article aims to put forward a paradigm that deals with video stream efficiently and elegantly.&lt;/p&gt;

&lt;p&gt;The pipeline includes two parts: the python frontend providing python API and the high-performance backend providing camera data. FFmpeg, OpenCV(C++) and similar libs can all work as backend.&lt;/p&gt;

&lt;p&gt;The pipeline is simple: firstly create an memory space (numpy array), and provide its buffer to the backend. Then the backend update the buffer with the latest frame. This architecture is efficient enough as the memory sapce is allocated once, after which it is just updated instead of destroyed or recreated.&lt;/p&gt;

&lt;p&gt;The implementation can be very simple. We can initialize a camera (CapCapture) to get real-time frames. And then we can encapsulate the Mat object into numpy.ndarray with pybind11. For Python programmers, they just need to receive the array, and update when needed, and read the array. This array can be set as read-only, and copied only if the programmer explicitly writes.&lt;/p&gt;

</description>
      <category>python</category>
      <category>cpp</category>
      <category>computervision</category>
    </item>
  </channel>
</rss>
