Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable AWB when using libcamera jpeg mode #578

Merged
merged 1 commit into from Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions indi_allsky/camera/libcamera.py
Expand Up @@ -157,8 +157,8 @@ def setCcdExposure(self, exposure, sync=False, timeout=None):
'--nopreview',
'--encoding', '{0:s}'.format(image_type),
'--quality', '100',
'--denoise', 'off',
'--awbgains', '1,1', # disable awb
#'--denoise', 'off',
#'--awbgains', '1,1', # enable awb in jpg mode
'--gain', '{0:d}'.format(self._ccd_gain),
'--shutter', '{0:d}'.format(exposure_us),
'--metadata', str(metadata_tmp_p),
Expand Down
5 changes: 4 additions & 1 deletion indi_allsky/flask/templates/config.html
Expand Up @@ -2050,7 +2050,10 @@
{{ form_config.LIBCAMERA__IMAGE_FILE_TYPE(class='form-control bg-secondary') }}
<div id="LIBCAMERA__IMAGE_FILE_TYPE-error" class="invalid-feedback text-danger" style="display: none;"></div>
</div>
<div class="col-sm-8">File type for libcamera acquistion. This has no effect when using indi.</div>
<div class="col-sm-8">
<div>File type for libcamera acquistion. This has no effect when using indi.</div>
<div>Auto White Balance is disabled in DNG mode</div>
</div>
</div>

<div class="form-group row">
Expand Down
12 changes: 10 additions & 2 deletions indi_allsky/image.py
Expand Up @@ -1428,21 +1428,29 @@ def add(self, filename, exposure, exp_date, exp_elapsed, camera_id):
image_bitpix = hdulist[0].header['BITPIX']
image_bayerpat = hdulist[0].header.get('BAYERPAT')

data = hdulist[0].data
#data = hdulist[0].data
elif filename_p.suffix in ['.jpg', '.jpeg']:
indi_rgb = False

data = cv2.imread(str(filename_p), cv2.IMREAD_UNCHANGED)

image_bitpix = 8
image_bayerpat = None

# create a new fits container
hdu = fits.PrimaryHDU(data)
hdulist = fits.HDUList([hdu])
elif filename_p.suffix in ['.png']:
indi_rgb = False

data = cv2.imread(str(filename_p), cv2.IMREAD_UNCHANGED)

image_bitpix = 8
image_bayerpat = None

# create a new fits container
hdu = fits.PrimaryHDU(data)
hdulist = fits.HDUList([hdu])
elif filename_p.suffix in ['.dng']:
if not rawpy:
filename_p.unlink()
Expand All @@ -1452,7 +1460,7 @@ def add(self, filename, exposure, exp_date, exp_elapsed, camera_id):
raw = rawpy.imread(str(filename_p))
data = raw.raw_image

# create a new fits container for DNG data
# create a new fits container
hdu = fits.PrimaryHDU(data)
hdulist = fits.HDUList([hdu])

Expand Down