#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <fcntl.h>
#include <math.h>
#include <asm/elphel/autoexp.h>
#include <asm/elphel/hist.h>
#include <sys/mman.h>
#include <asm/elphel/c313a.h>
#include "libpng/png.h"
Include dependency graph for pnghist.c:
Go to the source code of this file.
Data Structures | |
struct | key_value |
Defines | |
#define | HIST_SIZE 256 * 4 * 4 |
#define | HPNG_PLOT_BARS 1 |
#define | HPNG_CONNECT_DOTS 2 |
#define | HPNG_FILL_ZEROS 4 |
#define | HPNG_LIN_INTERP 8 |
#define | HPNG_RUN_SQRT 16 |
#define | QRY_MAXPARAMS 64 |
#define | HPNG_PLOT_BARS 1 |
#define | ERROR -1 |
#define | OK 0 |
Functions | |
int | unescape (char *, int) |
int | hexdigit (char) |
char * | paramValue (struct key_value *, char *) |
int | parseQuery (struct key_value *, char *) |
int | write_png (int height, int data[1024], int mode, int colors) |
int | main (int argc, char *argv[]) |
int | write_png (int png_height, int data[1536], int mode, int colors) |
Variables | |
char | copyQuery [4096] |
const char * | uri |
const char * | method |
const char * | query |
key_value | gparams [QRY_MAXPARAMS+1] |
autoexp_t | autoexp |
#define ERROR -1 |
#define HIST_SIZE 256 * 4 * 4 |
-----------------------------------------------------------------------------** pnghist.c
Copyright (C) 2006-2008 Elphel, Inc.
-----------------------------------------------------------------------------** This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. -----------------------------------------------------------------------------**
Definition at line 41 of file pnghist.c.
Referenced by main().
#define OK 0 |
int hexdigit | ( | char | ) |
Definition at line 25 of file unescape.c.
int main | ( | int | argc, | |
char * | argv[] | |||
) |
*************************************************************************** ! FILE NAME : autoexposure.c ! DESCRIPTION: Daemon to adjust camera exposure and white balance ! Copyright (C) 2008 Elphel, Inc. ! -----------------------------------------------------------------------------** ! This program is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program. If not, see <http://www.gnu.org/licenses/>. ! -----------------------------------------------------------------------------** ! !
array of histogram
colors 1 - r, 2 - g1, 4 - g2, 8 - b, 16 - w, 32 - g1+g2
enable requesting histogram calculation for the specified frame (0 - use/wait what available)
Sample from camvc.html http://192.168.0.9/pnghist.cgi?sqrt=1&scale=5&average=5&height=128&fillz=1&linterpz=0&draw=2&colors=41 FIXME: Some bump on low red - what is it?
instead of autoexp_fd
now try to mmap
Now find the index of the most recently available histogram (maybe will wait a little if it is not yet available for the current frame - use previous?)
wait for all histograms, not just Y (G1)
forward and cumulative histograms are needed
disable requesting histogram for the specified frame, rely on the available ones
request histograms for the previous frame
Ignore missing histograms here
cumul_hist_g[255] - total number of pixels for color G1
linear interpolation - also for high digital gains (near black with low gammas)
apply running average (if any)
calculate white if needed
calculate green if needed
now scale data
Definition at line 73 of file pnghist.c.
References a, copyQuery, histogram_stuct_t::cumul_hist_g, exit, fd_histogram_cache, gparams, hist, hist_index, HIST_SIZE, histogram_cache, HISTOGRAM_CACHE_NUMBER, HPNG_FILL_ZEROS, HPNG_LIN_INTERP, HPNG_RUN_SQRT, LSEEK_HIST_NEEDED, LSEEK_HIST_REQ_DIS, LSEEK_HIST_REQ_EN, LSEEK_HIST_WAIT_C, memcpy(), method, mode, paramValue(), parseQuery(), query, SEEK_CUR, SEEK_END, stderr, stdout, unescape(), uri, and write_png().
char* paramValue | ( | struct key_value * | , | |
char * | ||||
) |
int parseQuery | ( | struct key_value * | , | |
char * | ||||
) |
int unescape | ( | char * | , | |
int | ||||
) |
int write_png | ( | int | png_height, | |
int | data[1536], | |||
int | mode, | |||
int | colors | |||
) |
Definition at line 264 of file pnghist.c.
References d, ERROR, height, image, info_ptr, memset(), OK, palette, png_bytep, PNG_COLOR_TYPE_PALETTE, PNG_COMPRESSION_TYPE_BASE, png_create_info_struct(), png_create_write_struct(), png_destroy_write_struct(), png_error(), PNG_FILTER_TYPE_BASE, png_infopp_NULL, png_init_io(), PNG_INTERLACE_NONE, png_jmpbuf, PNG_LIBPNG_VER_STRING, PNG_MAX_PALETTE_LENGTH, png_set_IHDR(), png_set_interlace_handling(), png_set_PLTE(), png_set_sBIT(), png_set_text(), png_set_tRNS(), png_sizeof, PNG_TEXT_COMPRESSION_NONE, PNG_TEXT_COMPRESSION_zTXt, png_uint_32, PNG_UINT_32_MAX, png_write_end(), png_write_image(), png_write_info(), row_pointers, sig_bit, stdout, text_ptr, trans, and width.
int write_png | ( | int | height, | |
int | data[1024], | |||
int | mode, | |||
int | colors | |||
) |
Referenced by main().