Fork of https://gitlab.com/megapixels-org/Megapixels

Kristian Vos 95ae684d9f Pass color/forward matrices to libdng пре 2 недеља
config 5f270c1ef0 Remove unneeded files пре 1 година
data 9e4b760b77 ui: Add button with camera status. пре 2 месеци
src 95ae684d9f Pass color/forward matrices to libdng пре 2 недеља
tools 38bbee0841 camera_test: add bridge support (MR 31) пре 1 година
.clang-format 772db36877 Make clang-format more aggressive пре 3 година
.editorconfig 101abe33cd Add editorconfig пре 4 година
.gitignore db131f2cb0 Chosen project name пре 4 година
.gitlab-ci.yml e524c4f885 Add libpulse-simple dependency to CI пре 6 месеци
CMakeLists.txt ccf0314b62 Make the video recording button an icon пре 4 месеци
LICENSE db131f2cb0 Chosen project name пре 4 година
README.md 88b9ca9e50 Explain dependencies for video recording. пре 2 месеци
clang-format.sh f66fcc5a71 Update to clang-format 14 пре 2 година
develop.sh 2a328e4f2d Add helper script for setting up a full megapixels system on a phone пре 2 месеци
medianame.h fcba2b33c2 Add support files that will be used for video recording. пре 6 месеци
meson.build 1a27c4b15b Added debayer_packed.frag to meson.build and gresource.xml пре 4 месеци
meson_options.txt edd1de7a9e Add meson option for the tiff cfa pattern bug пре 3 година
movie.sh.in 48a4b8db2a Get rid of fragile recursive rm, move cleanup to mpegize. This way пре 6 месеци
movie_audio_rec.c 00f40b52df Audio recording fixes пре 6 месеци
mpegize.py 8ba6d0b96b mpegize: fix dng mode пре 2 месеци

README.md

Megapixels

A GTK4 camera application that knows how to deal with the media request api. It uses opengl to debayer the raw sensor data for the preview.

Chat: #megapixels:brixit.nl on Matrix

Building

Before building this, build and install libmegapixels, libdng and postprocessd.

$ meson build
$ cd build
$ ninja
$ sudo ninja install
$ sudo glib-compile-schemas /usr/local/share/glib-2.0/schemas

Post processing

Megapixels only captures raw frames and stores .dng files. It captures a 5 frame burst and saves it to a temporary location. Then the postprocessing script is run which will generate the final .jpg file and writes it into the pictures directory. Megapixels looks for the post processing script in the following locations:

  • ./postprocess.sh
  • $XDG_CONFIG_DIR/megapixels/postprocess.sh
  • ~/.config/megapixels/postprocess.sh
  • /etc/megapixels/postprocess.sh
  • /usr/share/megapixels/postprocess.sh

The bundled postprocess.sh script will copy the first frame of the burst into the picture directory as an DNG file. If dcraw and imagemagick are installed it will generate a JPG and also write that to the picture directory. It supports either the full dcraw or dcraw_emu from libraw.

It is possible to write your own post processing pipeline by providing your own postprocess.sh script at one of the above locations. The first argument to the script is the directory containing the temporary burst files and the second argument is the final path for the image without an extension. For more details see postprocess.sh in this repository.

Video recording

Video recording needs gstreamer framework, dcraw and imagemagick. You may need to "sudo apt install dcraw imagemagick".

Developing

Megapixels is developed at: https://gitlab.com/megapixels-org/megapixels

Source code organization

  • camera_config.c describes how cameras are configured. Contains no state.
  • main.c contains the entry point and UI portion of the application.
  • quickpreview.c implements fast preview functionality, including debayering, color correction, rotation, etc.
  • io_pipeline.c implements all IO interaction with V4L2 devices in a separate thread to prevent blocking.
  • process_pipeline.c implements all process done on captured images, including launching post-processing.
  • pipeline.c Generic threaded message passing implementation based on glib, used to implement the pipelines.
  • camera.c V4L2 abstraction layer to make working with cameras easier.
  • device.c V4L2 abstraction layer for devices.

The primary image pipeline consists of the main application, the IO pipeline and the process pipeline. The main application sends commands to the IO pipeline, which in turn talks to the process pipeline, which then talks to the main application. This way neither IO nor processing blocks the main application and races are generally avoided.

Tests are located in tests/.