<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.stereopi.com/app.php/feed/topic/1306" />

	<title>StereoPi Forum</title>
	<subtitle>StereoPi Forum</subtitle>
	<link href="https://forum.stereopi.com/index.php" />
	<updated>2022-05-31T22:07:28+00:00</updated>

	<author><name><![CDATA[StereoPi Forum]]></name></author>
	<id>https://forum.stereopi.com/app.php/feed/topic/1306</id>

		<entry>
		<author><name><![CDATA[Realizator]]></name></author>
		<updated>2022-05-31T22:07:28+00:00</updated>

		<published>2022-05-31T22:07:28+00:00</published>
		<id>https://forum.stereopi.com/viewtopic.php?p=3158#p3158</id>
		<link href="https://forum.stereopi.com/viewtopic.php?p=3158#p3158"/>
		<title type="html"><![CDATA[Re: Size and framerate]]></title>

		
		<content type="html" xml:base="https://forum.stereopi.com/viewtopic.php?p=3158#p3158"><![CDATA[
asdf, I got your aim.<br>If you'll forward all "raw" images to your beefier PC over network, this will be the next bottleneck. The network bandwidth to be taken into account for the RAW video stream.<br><br>You can't use H264 encoding to do this (resolution exceeds RPi GPU encoder limit), but can try MJPEG. With both encodings you'll have a data loss (tiny details). I don't know your image perfection requirements, but maybe the highest MJPEG quality and maximum bitrate (like 50 Mbit) can help you (and allow using raspivid instead of raspiyuv).<br><br>Another "tricky" way is to use... HDMI output. You can use HDMI capture device to get HDMI output to your computer. But this should be 4K-enabled HDMI capture, which is not cheap.<br><br>I like this kind of tasks - when you are working at the maximum of hardware abilities. <img class="smilies" src="https://forum.stereopi.com/images/smilies/icon_e_smile.gif" width="15" height="17" alt=":-)" title="Smile"> Remember you can overclock GPU encoder part if you face it's limit (heatsink is a must in this case).<p>Statistics: Posted by <a href="https://forum.stereopi.com/memberlist.php?mode=viewprofile&amp;u=2">Realizator</a> — Tue May 31, 2022 10:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[asdf]]></name></author>
		<updated>2022-05-31T21:55:38+00:00</updated>

		<published>2022-05-31T21:55:38+00:00</published>
		<id>https://forum.stereopi.com/viewtopic.php?p=3157#p3157</id>
		<link href="https://forum.stereopi.com/viewtopic.php?p=3157#p3157"/>
		<title type="html"><![CDATA[Re: Size and framerate]]></title>

		
		<content type="html" xml:base="https://forum.stereopi.com/viewtopic.php?p=3157#p3157"><![CDATA[
Thank you for your quick response. I did what you recommended and, indeed, it looks like Python is the bottleneck here, as a program written in C is way quicker than my Python script.<br><div class="codebox"><p>Code: </p><pre><code>#include &lt;stdio.h&gt;#include &lt;stdlib.h&gt;#include &lt;unistd.h&gt;#include &lt;time.h&gt;int main() {    char *buffer = malloc(1024 * 1632 * 2 * 3);    clock_t start_time = clock();    int i;    int n_frames = 10;    int n_bytes;    for (i = 0; i &lt; n_frames; i = i + 1) {        clock_t begin = clock();        n_bytes = 0;        while (1) {            n_bytes = n_bytes + read(0, &amp;buffer[n_bytes], 1024 * 1632 * 2 * 3 - n_bytes);            if (n_bytes &gt;= 1024 * 1632 * 2 * 3)                break;        }        clock_t end = clock();        double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;        printf("--- %f seconds ---\n", time_spent);    }    clock_t end_time = clock();    double framerate = n_frames / ((double)(end_time - start_time) / CLOCKS_PER_SEC);    printf("Framerate is %f\n", framerate);    return 0;}</code></pre></div>I compile and run it:<div class="codebox"><p>Code: </p><pre><code>gcc main.c -o mainraspividyuv -3d sbs  --rgb -w 3264 -h 1024 -fps 20 -t 0 -n -o - | ./main</code></pre></div>And the output is <div class="codebox"><p>Code: </p><pre><code>--- 0.097859 seconds ------ 0.034125 seconds ------ 0.033267 seconds ------ 0.034116 seconds ------ 0.033378 seconds ------ 0.032724 seconds ------ 0.033397 seconds ------ 0.033339 seconds ------ 0.032983 seconds ------ 0.034238 seconds ---Framerate is 24.986133</code></pre></div>As for your questions, I want to capture and stream images to a beefier machine which would do some processing, and I need them to be color, as the algorithms I'm using do not work with black and white images.<p>Statistics: Posted by <a href="https://forum.stereopi.com/memberlist.php?mode=viewprofile&amp;u=1080">asdf</a> — Tue May 31, 2022 9:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Realizator]]></name></author>
		<updated>2022-05-31T12:39:35+00:00</updated>

		<published>2022-05-31T12:39:35+00:00</published>
		<id>https://forum.stereopi.com/viewtopic.php?p=3144#p3144</id>
		<link href="https://forum.stereopi.com/viewtopic.php?p=3144#p3144"/>
		<title type="html"><![CDATA[Re: Size and framerate]]></title>

		
		<content type="html" xml:base="https://forum.stereopi.com/viewtopic.php?p=3144#p3144"><![CDATA[
Hi asdf,<br><br>You can face a few botlenecks with high resolutions, that's truth. To localize your bottleneck I'd start with checking of the real raspividyuv output FPS first before piping to Python. You can use display output to check, if you are getting 20 FPS requested or lower.<br>The next step is checking Pythin part. Are you going to use the whole YUV image or just the greyscale part (using 'luma" option) to save memory bandwidth?<br><br>What's your final aim? Is this just a processing, or saving/livestreaming the result? And what's the target resolution/FPS?<p>Statistics: Posted by <a href="https://forum.stereopi.com/memberlist.php?mode=viewprofile&amp;u=2">Realizator</a> — Tue May 31, 2022 12:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[asdf]]></name></author>
		<updated>2022-05-30T23:03:44+00:00</updated>

		<published>2022-05-30T23:03:44+00:00</published>
		<id>https://forum.stereopi.com/viewtopic.php?p=3141#p3141</id>
		<link href="https://forum.stereopi.com/viewtopic.php?p=3141#p3141"/>
		<title type="html"><![CDATA[Size and framerate]]></title>

		
		<content type="html" xml:base="https://forum.stereopi.com/viewtopic.php?p=3141#p3141"><![CDATA[
I'm trying to capture high resolution frames from the Stereopi, reading the output of raspividyuv as suggested in <a href="https://medium.com/stereopi/opencv-comparing-the-speed-of-c-and-python-code-on-the-raspberry-pi-for-stereo-vision-75961fe0b1a3" class="postlink">this medium post</a>. However, the framerate is terribly slow at 3264 x 1024 (1632 x 1024 per side). This is the code I'm running:<br><div class="codebox"><p>Code: </p><pre><code>import sysimport numpy as npimport cv2import timeheight = 1024width = 1632 * 2n_channels = 3n_frames = 10t0 = time.time()for _ in range(n_frames):    start_time = time.time()    bytes = sys.stdin.buffer.read(width * height * n_channels)    frame = np.frombuffer(bytes, dtype=np.uint8, count=width * height * n_channels).reshape(height, width, n_channels)    left_frame = frame[:, :width // 2]    right_frame = frame[:, width // 2:]    print("--- %s seconds ---" % (time.time() - start_time))dt = time.time() - t0print("Framerate is %f" % (n_frames / dt))</code></pre></div><br>The execution line is <br><div class="codebox"><p>Code: </p><pre><code>raspividyuv -3d sbs --rgb -w 3264 -h 1024 -fps 20 -t 0 -n -o - | python main.py</code></pre></div><br>And the output is <div class="codebox"><p>Code: </p><pre><code>--- 0.08326101303100586 seconds ------ 0.09539151191711426 seconds ------ 0.09400773048400879 seconds ------ 0.09419560432434082 seconds ------ 0.09409403800964355 seconds ------ 0.09410309791564941 seconds ------ 0.09404730796813965 seconds ------ 0.09309720993041992 seconds ------ 0.09331631660461426 seconds ------ 0.0949711799621582 seconds ---Framerate is 10.729000</code></pre></div>As you can see, the code doesn't do anything with the images, not even using cv2.imshow()<br><br>Is this the correct approach to getting such big images? I wasn't even able to use Picamera with such resolution. I know you also can use the mmal api directly, but I wasn't able to find any examples of that.<p>Statistics: Posted by <a href="https://forum.stereopi.com/memberlist.php?mode=viewprofile&amp;u=1080">asdf</a> — Mon May 30, 2022 11:03 pm</p><hr />
]]></content>
	</entry>
	</feed>
