0

I have a 4K USB Camera connected to a Raspberry Pi 3 and the same model of camera on a RPi 4. After capturing the image via OpenCV:

cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
cap.set(cv2.CAP_PROP_FOURCC, fourcc)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 3840)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 2160)
ret, frame = cap.read()
cv2.imwrite('result.jpg', frame)

Zoomed In Image, 20x100 px

This is a 20px on 100px part of the image on the RPi3, on the RPi4 it looks better. Whats the cause of those weird blocks auf pixel which have hard borders? Might it be a problem with the drivers? The RPi3 has no internet, so no apt-get update has been done. Is it a compression problem? Might v4l2-compliance be of use?

Vertago
  • 315
  • 2
  • 16
  • Your code appears to save a JPEG and you say it is 20x100, yet you show a 1048x135 pixel PNG which isn't even in the same ratio? In answer to your question, 8x8 blocks are the minimum coding unit or macro blocks of JPEG. https://en.wikipedia.org/wiki/JPEG#Block_splitting – Mark Setchell Apr 20 '21 at 13:55
  • Thanks, that might be part of it. I zoomed in on the jpg to illustrate the problem. I can test it tomorrow. What confused me is that other JPGs i have dont have that problem or have way better gradients between those macro blocks than this one. – Vertago Apr 20 '21 at 14:53
  • switching to png somehow made it even worse. – Vertago Apr 21 '21 at 05:12

0 Answers0