revise calculation of JPEG buffer
This commit is contained in:
parent
d2b84ed5f8
commit
36d77ee7f0
1 changed files with 3 additions and 1 deletions
|
|
@ -1236,7 +1236,9 @@ class OV5640(_SCCB16CameraBase): # pylint: disable=too-many-instance-attributes
|
||||||
def capture_buffer_size(self) -> int:
|
def capture_buffer_size(self) -> int:
|
||||||
"""Return the size of capture buffer to use with current resolution & colorspace settings"""
|
"""Return the size of capture buffer to use with current resolution & colorspace settings"""
|
||||||
if self.colorspace == OV5640_COLOR_JPEG:
|
if self.colorspace == OV5640_COLOR_JPEG:
|
||||||
return self.width * self.height // self.quality
|
# This is somewhat arbirary but seems to work for a wide range of JPEG images
|
||||||
|
# the user can chose to further scale the buffer in the user code if necessary
|
||||||
|
return 2 * (self.width * self.height // self.quality)
|
||||||
if self.colorspace == OV5640_COLOR_GRAYSCALE:
|
if self.colorspace == OV5640_COLOR_GRAYSCALE:
|
||||||
return self.width * self.height
|
return self.width * self.height
|
||||||
return self.width * self.height * 2
|
return self.width * self.height * 2
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue