random patchys...
This commit is contained in:
parent
14256b1476
commit
dd9ac7c948
1
.gitignore
vendored
1
.gitignore
vendored
@ -38,6 +38,7 @@ v4l2/capture
|
||||
v4l2/grabvidseq
|
||||
v4l2/*.o
|
||||
v4l2/*.ppm
|
||||
v4l2/*.png
|
||||
v4l2/video-infos
|
||||
v4l2/nc-camcontrol
|
||||
|
||||
|
@ -233,8 +233,8 @@ par défaut du make.
|
||||
Pour le moment, la procédure d'installation est un peu rude,
|
||||
pour ne pas dire clairement sommaire.
|
||||
Si le résultat de l'étape compilation vous semble correct,
|
||||
vous pouvez copier les deux fichiers \texttt{floatimg.h} et \texttt{libfloatimg.a}
|
||||
dans un emplacement approprié, par exemple
|
||||
vous pouvez copier les deux fichiers \texttt{floatimg.h} et
|
||||
\texttt{libfloatimg.a} dans un emplacement approprié, par exemple
|
||||
\texttt{/usr/local/include} et \texttt{/usr/local/lib}.
|
||||
|
||||
Le script \texttt{install.sh}, à la racine du projet, est censé
|
||||
@ -353,6 +353,14 @@ documentés dans ce document, et les autres sont dangereux à
|
||||
toucher. Les types d'images actuellement gérés sont les trois grands
|
||||
classiques : gray, rgb et rgba. et expliquées quelques lignes plus haut.
|
||||
|
||||
Comme vous allez le voir plus loin, il y a plein de fonctions qui
|
||||
prennent en argument deux images: une source et une destination.
|
||||
|
||||
\begin{lstlisting}
|
||||
int fimg_images_compatible(FloatImg *a, FloatImg *b);
|
||||
\end{lstlisting}
|
||||
|
||||
|
||||
C'est bien beau d'être enfin résident en mémoire centrale, mais
|
||||
pouvoir aussi exister à long terme en étant stocké dans la matrice
|
||||
est tout aussi pertinent. Il y a deux opérations qui supportent le
|
||||
|
@ -2,7 +2,7 @@
|
||||
* floatimg.h
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION 97
|
||||
#define FIMG_VERSION 98
|
||||
|
||||
/*
|
||||
* in memory descriptor
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash -v
|
||||
|
||||
cp libfloatimg.a /usr/local/lib
|
||||
cp floatimg.h /usr/local/include
|
||||
|
@ -13,7 +13,7 @@ extern int verbosity; /* must be declared around main() */
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* floating imgs MUST be allocated before calling this func.
|
||||
* floating resultat img MUST be allocated before calling this func.
|
||||
*/
|
||||
int fimg_mk_gray_from(FloatImg *src, FloatImg *dst, int k)
|
||||
{
|
||||
|
@ -13,6 +13,9 @@
|
||||
extern int verbosity; /* must be declared around main() */
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/*
|
||||
* return 0 if images are compatibles
|
||||
*/
|
||||
int fimg_images_compatible(FloatImg *a, FloatImg *b)
|
||||
{
|
||||
#if DEBUG_LEVEL > 1
|
||||
|
@ -77,6 +77,9 @@ if (flag) {
|
||||
}
|
||||
puts("usage :");
|
||||
puts("\tfimg2pnm [flags] infile.fimg outfile.pnm");
|
||||
puts("flags :");
|
||||
puts("\t-g\tconvert to gray");
|
||||
puts("\t-v\tenhance your verbosity");
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int main(int argc, char *argv[])
|
||||
|
32
v4l2/README.md
Normal file
32
v4l2/README.md
Normal file
@ -0,0 +1,32 @@
|
||||
# Images en virgule flottante, video 4 linux
|
||||
|
||||
## grabvidseq
|
||||
|
||||
```
|
||||
tth@lubitel:~/Devel/FloatImg/v4l2$ ./grabvidseq -h
|
||||
options :
|
||||
-d /dev/? select video device
|
||||
-g convert to gray
|
||||
-n NNN how many frames ?
|
||||
-O ./ set Output dir
|
||||
-o bla.xxx set output filename
|
||||
-p NN.N period in seconds
|
||||
-r 90 rotate picture
|
||||
-s WxH size of capture
|
||||
-c mode contrast enhancement
|
||||
-u try upscaling...
|
||||
-v increase verbosity
|
||||
```
|
||||
|
||||
## video-infos
|
||||
|
||||
```
|
||||
Options :
|
||||
-e N examine that, please
|
||||
-d select the video device
|
||||
-K set the K parameter
|
||||
-l list video devices
|
||||
-T bla add a title
|
||||
-v increase verbosity
|
||||
```
|
||||
|
@ -2,10 +2,6 @@
|
||||
capture video
|
||||
-------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
<paulk-leonov> tth: en faisant de la revue de patch sur V4L2, j'apprends
|
||||
@ -13,3 +9,5 @@
|
||||
le premier concerne le champ flags de la structure de l'ioctl enum_fmt
|
||||
et le second le champ flag de la structure de g_fmt.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
12
v4l2/essai.sh
Executable file
12
v4l2/essai.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -----------------------------------------------------
|
||||
|
||||
TMPF="tmp.fimg"
|
||||
CAM="/dev/video0"
|
||||
|
||||
# -----------------------------------------------------
|
||||
|
||||
./grabvidseq -d $CAM -n 10000 -vv -p 0 -r 90
|
||||
|
||||
# -----------------------------------------------------
|
@ -100,27 +100,28 @@ int r, fd = -1;
|
||||
unsigned int i, n_buffers;
|
||||
char *dev_name = "/dev/video0";
|
||||
|
||||
FILE *fout;
|
||||
// XXX FILE *fout;
|
||||
struct buffer *buffers;
|
||||
|
||||
int foo, bar;
|
||||
double period = 10.0; /* delai entre les captures */
|
||||
int nbre_capt = 1; /* nombre de captures */
|
||||
int foo;
|
||||
double period = 10.0; /* delai entre les captures */
|
||||
int nbre_capt = 1; /* nombre de captures */
|
||||
int opt;
|
||||
int width = 640;
|
||||
int height = 480;
|
||||
double t_final, maxvalue;
|
||||
int to_gray = 0;
|
||||
int upscaling = 0;
|
||||
int contrast = 0;
|
||||
char *dest_dir = "."; /* no trailing slash */
|
||||
int contrast = CONTRAST_NONE;
|
||||
int rotfactor = 0; /* only 0 or 90 here */
|
||||
char *dest_dir = "."; /* no trailing slash */
|
||||
char *outfile = "out.pnm";
|
||||
|
||||
#if SAVE_AS_CUMUL
|
||||
FloatImg cumul;
|
||||
FloatImg cumul, tmpfimg, *to_save;
|
||||
#endif
|
||||
|
||||
while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:s:uv")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:r:s:uv")) != -1) {
|
||||
switch(opt) {
|
||||
case 'c': contrast = fimg_id_contraste(optarg);
|
||||
if (contrast < 0) {
|
||||
@ -143,10 +144,15 @@ while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:s:uv")) != -1) {
|
||||
}
|
||||
period *= 1e6;
|
||||
break;
|
||||
case 'r': rotfactor = atoi(optarg); break;
|
||||
case 's': parse_WxH(optarg, &width, &height);
|
||||
break;
|
||||
case 'u': upscaling = 1; break;
|
||||
case 'v': verbosity++; break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "option '%c' is wtf\n", opt);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,6 +161,7 @@ if (verbosity > 1) {
|
||||
fprintf(stderr, "grabing %d picz\n", nbre_capt);
|
||||
fprintf(stderr, "period is %.3f milliseconds\n", period/1e3);
|
||||
fprintf(stderr, "framesize is %dx%d\n", width, height);
|
||||
fprintf(stderr, "destdir is '%s'\n", dest_dir);
|
||||
if (upscaling) fprintf(stderr, "upscaling is on\n");
|
||||
}
|
||||
|
||||
@ -233,6 +240,8 @@ else {
|
||||
fimg_clear(&cumul);
|
||||
cumul.fval = 255.0;
|
||||
cumul.count = 0;
|
||||
|
||||
to_save = &cumul;
|
||||
#endif
|
||||
|
||||
|
||||
@ -327,6 +336,7 @@ if (to_gray) {
|
||||
foo = fimg_to_gray(&cumul);
|
||||
}
|
||||
|
||||
|
||||
#if SAVE_AS_CUMUL
|
||||
// save cumul to file
|
||||
if (verbosity) fprintf(stderr, "saving cumul to '%s'\n", outfile);
|
||||
@ -357,6 +367,18 @@ switch (contrast) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* XXX warning, new from coronahome 26 mars 2020 */
|
||||
if (90 == rotfactor) {
|
||||
memset(&tmpfimg, 0, sizeof(FloatImg));
|
||||
foo = fimg_rotate_90(&cumul, &tmpfimg, 0);
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, "dump rot90 %p\n", &tmpfimg);
|
||||
foo = fimg_save_as_png(&tmpfimg, "rot90.png", 0);
|
||||
}
|
||||
to_save = &tmpfimg;
|
||||
}
|
||||
|
||||
|
||||
foo = format_from_extension(outfile);
|
||||
switch (foo) {
|
||||
case FILE_TYPE_FIMG:
|
||||
@ -373,6 +395,9 @@ switch (foo) {
|
||||
break;
|
||||
}
|
||||
// free buffers
|
||||
|
||||
|
||||
|
||||
fimg_destroy(&cumul);
|
||||
#endif
|
||||
|
||||
|
@ -16,7 +16,7 @@ char *str_ctrl_type(int type);
|
||||
char *str_buf_type(int type);
|
||||
char *str_fourcc(uint32_t fcc); /* NOT REENTRANT */
|
||||
|
||||
void pr_ctrl_id(uint32_t id);
|
||||
void pr_ctrl_id(uint32_t id); /* bit dissector */
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user