# JPEG streaming over rpc sometimes blurry / look sub-sampled

**URL:** <https://forums.openmv.io/t/jpeg-streaming-over-rpc-sometimes-blurry-look-sub-sampled/7596>\
**Category:** OpenMV Boards\
**Created:** [October 19, 2022, 9:19am UTC](https://forums.openmv.io/t/jpeg-streaming-over-rpc-sometimes-blurry-look-sub-sampled/7596 "2022-10-19T09:19:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Billu](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@Billu](https://forums.openmv.io/u/Billu)\
**Post date:** [October 19, 2022, 9:19am UTC](https://forums.openmv.io/t/jpeg-streaming-over-rpc-sometimes-blurry-look-sub-sampled/7596/1 "2022-10-19T09:19:13Z")

</div>

Hi,

First of all, thanks a lot for all the hard and soft development you did guys, it’s amazing how many things we can achieve with your cameras for such a cheap price!

My current problem concerns the OpenMV H7 cam (OV7725 sensor I guess)

I have downloaded your code to send jpeg streaming over rpc protocol, in such a way that I can receive the streaming in Python environnement and display images using pygame.

Problem is, for unknown reasons (I suspect it happen when the scene moves), sometimes the streaming gets blurry, then sharp, then blurry again, blinking blurry / sharp and sometimes it stabilizes itself. From what I read on the forum, it may due to some horse power of the STM32 which is not fast enough in certain conditions to keep image quality when objects move, thus downsampling the resolution in the streaming. Is it true?

Whatever the reason, I need to keep image quality constant, even if i have to : - lowering the exposure time  
-lowering the jped compression factor

- limiting the frame rate ? (even if sensor.set\_framerate does not seem to work…)

Any suggestions to solve that problem?  
Thanks a lot in advance,  
Jules

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [October 19, 2022, 6:43pm UTC](https://forums.openmv.io/t/jpeg-streaming-over-rpc-sometimes-blurry-look-sub-sampled/7596/2 "2022-10-19T18:43:44Z")

</div>

We have a dynamic jpeg quality compression algorithm. It tries to increase the quality as much as it can until there’s an overflow, and then it lowers the quality.

You can force the quality of the image by adding a img.compress(quality=90) at the end of your loop to force the jpeg quality.

---

<div class="post-metadata">

**Author:** ![Billu](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@Billu](https://forums.openmv.io/u/Billu)\
**Post date:** [October 19, 2022, 9:48pm UTC](https://forums.openmv.io/t/jpeg-streaming-over-rpc-sometimes-blurry-look-sub-sampled/7596/3 "2022-10-19T21:48:56Z")

</div>

Hi,

Jpeg compression quality factor is already set at 90 in the callback process, every time. (I’m not on my code currently but the command is something like sensor.snapshot().compress(quality=90).bytearray(). )

Not sure, but it appears that my problem occurs on Raspberry Pi 4 but not when camera is plugged to a laptop. Could it come from the RPI USB bus?

Jules

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [October 19, 2022, 10:23pm UTC](https://forums.openmv.io/t/jpeg-streaming-over-rpc-sometimes-blurry-look-sub-sampled/7596/4 "2022-10-19T22:23:51Z")

</div>

If the quality is fixed at 90 then it will stay at that level. Not sure what could be wrong then.
