Compare commits
	
		
			3 Commits
		
	
	
		
			785b521d4f
			...
			3778e75399
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3778e75399 | |||
| d3dfd6de0a | |||
| ffda756fde | 
@ -97,7 +97,6 @@ FimgFilter3x3	hipass = {
 | 
			
		||||
	1.0,	0.0
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
switch (typef) {
 | 
			
		||||
	case 0:		pfiltre = &lowpass;		break;
 | 
			
		||||
	case 1:		pfiltre = &hipass;		break;
 | 
			
		||||
@ -248,11 +247,13 @@ switch (idFx) {
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case CR_qsortrgb:
 | 
			
		||||
		// fprintf(stderr, "!!! %d !!!\n", idFx);
 | 
			
		||||
		// retval = fimg_qsort_rgb_b(image, image, 0);
 | 
			
		||||
		retval = trier_les_pixels(image);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case CR_multidots:
 | 
			
		||||
		retval = plot_multidots(image, 42);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case CR_message:
 | 
			
		||||
		fprintf(stderr, "### msg from pid %d, fval=%f ###\n",
 | 
			
		||||
						getpid(), fval);
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,7 @@
 | 
			
		||||
26	rndblks		1	1.0
 | 
			
		||||
27	shiftln0	1	1.0
 | 
			
		||||
28	qsortrgb	2	1.0
 | 
			
		||||
42	nothing		42	3.14159
 | 
			
		||||
30	multidots	100	1.333
 | 
			
		||||
42	nothing		42	3.1415926
 | 
			
		||||
99	message		1	1.0
 | 
			
		||||
-1	end		1	1.0
 | 
			
		||||
 | 
			
		||||
@ -31,8 +31,8 @@ convert -delay 200 /tmp/fstack*.png foo.gif
 | 
			
		||||
essai_singlepass ()
 | 
			
		||||
{
 | 
			
		||||
MP4="/home/tth/Essais/FondageDePlomb/foo.mp4"
 | 
			
		||||
INPUT="/home/tth/Essais/FondageDePlomb/capture/00???.fimg"
 | 
			
		||||
FILTRE="trinitron"
 | 
			
		||||
INPUT="/home/tth/Essais/FondageDePlomb/capture/02[0123]??.fimg"
 | 
			
		||||
FILTRE="multidots:liss3x3:liss3x3"
 | 
			
		||||
OUTDIR="/tmp/x8/"
 | 
			
		||||
 | 
			
		||||
echo '********* essai single *********'
 | 
			
		||||
 | 
			
		||||
@ -120,6 +120,24 @@ for (y=0; y<8; y++) {
 | 
			
		||||
return 0;
 | 
			
		||||
}
 | 
			
		||||
/*   --------------------------------------------------------------   */
 | 
			
		||||
int plot_multidots(FloatImg *picture, int notused)
 | 
			
		||||
{
 | 
			
		||||
int		pass, szimg, osrc, odst;
 | 
			
		||||
 | 
			
		||||
szimg = picture->width * picture->height;
 | 
			
		||||
 | 
			
		||||
for (pass=0; pass<szimg/32; pass++) {
 | 
			
		||||
 | 
			
		||||
	osrc = rand() % szimg;
 | 
			
		||||
	odst = rand() % szimg;
 | 
			
		||||
	picture->R[odst] = (picture->R[osrc] + picture->R[odst]) / 2.0;
 | 
			
		||||
	picture->G[odst] = (picture->G[osrc] + picture->G[odst]) / 2.0;
 | 
			
		||||
	picture->B[odst] = (picture->B[osrc] + picture->B[odst]) / 2.0;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
return 0;
 | 
			
		||||
}
 | 
			
		||||
int random_blocks(FloatImg *picture, int percent)
 | 
			
		||||
{
 | 
			
		||||
int		x, y;
 | 
			
		||||
@ -212,16 +230,26 @@ for (y=BB; y<h-BB; y++) {
 | 
			
		||||
return 0;
 | 
			
		||||
}
 | 
			
		||||
/*   --------------------------------------------------------------   */
 | 
			
		||||
static void shifter(float *fs, float *fd, int w, int nbr)
 | 
			
		||||
static void shifter(float *fs, float *fd, int stp, int largeur)
 | 
			
		||||
{
 | 
			
		||||
int	krkr;
 | 
			
		||||
int	xpos;
 | 
			
		||||
 | 
			
		||||
for (krkr=0; krkr<nbr; krkr++) {
 | 
			
		||||
	fd[krkr] = fs[(krkr+w)%nbr];
 | 
			
		||||
/* move the pixels */
 | 
			
		||||
for (xpos=0; xpos<largeur; xpos++) {
 | 
			
		||||
	fd[xpos] = fs[(xpos+stp)%largeur];
 | 
			
		||||
	}
 | 
			
		||||
/* take your sixpack, film at 11 */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void smooth_line(float *fs, float *fd, int sz)
 | 
			
		||||
{
 | 
			
		||||
int	xpos;
 | 
			
		||||
for (xpos=1; xpos<(sz-1); xpos++) {
 | 
			
		||||
	fd[xpos] = (fs[xpos-1]+fs[xpos]+fs[xpos+1]) / 3.0;
 | 
			
		||||
	}
 | 
			
		||||
fd[0] = fd[sz-1] = 0.0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int multilines_shift_0(FloatImg *picz, int step, int nombre)
 | 
			
		||||
{
 | 
			
		||||
float		*buffline, *sptr;
 | 
			
		||||
@ -242,15 +270,18 @@ for (idx=0; idx<nombre; idx++) {
 | 
			
		||||
 | 
			
		||||
	sptr = picz->R + (ypos * picz->width);
 | 
			
		||||
	shifter(sptr, buffline, step, picz->width);
 | 
			
		||||
	memcpy(sptr, buffline, picz->width*sizeof(float));
 | 
			
		||||
	smooth_line(buffline, sptr, picz->width);
 | 
			
		||||
	// XXX memcpy (sptr, buffline, picz->width*sizeof(float));
 | 
			
		||||
 | 
			
		||||
	sptr = picz->G + (ypos * picz->width);
 | 
			
		||||
	shifter(sptr, buffline, step, picz->width);
 | 
			
		||||
	memcpy(sptr, buffline, picz->width*sizeof(float));
 | 
			
		||||
	smooth_line(buffline, sptr, picz->width);
 | 
			
		||||
	// XXX memcpy (sptr, buffline, picz->width*sizeof(float));
 | 
			
		||||
 | 
			
		||||
	sptr = picz->B + (ypos * picz->width);
 | 
			
		||||
	shifter(sptr, buffline, step, picz->width);
 | 
			
		||||
	memcpy(sptr, buffline, picz->width*sizeof(float));
 | 
			
		||||
	smooth_line(buffline, sptr, picz->width);
 | 
			
		||||
	// XXX memcpy (sptr, buffline, picz->width*sizeof(float));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
return 0;
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
int do_something(FloatImg *pimg, int notused);
 | 
			
		||||
int plot_multidots(FloatImg *picture, int notused);
 | 
			
		||||
 | 
			
		||||
int kill_a_random_line(FloatImg *pvictime, float level, int bits);
 | 
			
		||||
int kill_a_few_lines(FloatImg *who, float fval, int number);
 | 
			
		||||
 | 
			
		||||
@ -89,7 +89,7 @@ for (idx=0; idx<nombre; idx++) {
 | 
			
		||||
 | 
			
		||||
if (method) {
 | 
			
		||||
	/* and now, we can massage all our datas */
 | 
			
		||||
	// fprintf(stderr, "sorting %d ...\n", method);
 | 
			
		||||
	fprintf(stderr, "sorting method = %d ...\n", method);
 | 
			
		||||
	qsort(idxvalues, nombre, sizeof(IdxValue), cmp_idxvalues);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -128,7 +128,7 @@ IdxValue	*idx_values;			/* gni? */
 | 
			
		||||
fprintf(stderr, "  interpolate from '%s' to '%s' with %d steps.\n",
 | 
			
		||||
			pattern, outdir, Nsteps);
 | 
			
		||||
 | 
			
		||||
if (negative) fprintf(stderr, "%s: negative on\n", __func__);
 | 
			
		||||
if (negative) fprintf(stderr, "%s: negative ON\n", __func__);
 | 
			
		||||
 | 
			
		||||
memset(&globbuf, 0, sizeof(glob_t));
 | 
			
		||||
foo = glob(pattern, 0, NULL, &globbuf);
 | 
			
		||||
 | 
			
		||||
@ -153,7 +153,7 @@ puts("\t-F\tdefine:the:filter:chain");
 | 
			
		||||
puts("\t-g\tinput glob pattern");
 | 
			
		||||
puts("\t-i\tinfile.fimg");
 | 
			
		||||
puts("\t-L\tlist available filters");
 | 
			
		||||
puts("\t-o\tinfile.xxx");
 | 
			
		||||
puts("\t-o\toutfile.xxx");
 | 
			
		||||
puts("\t-O\t/output/directory");
 | 
			
		||||
puts("\t-s\tdo single test");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							@ -30,10 +30,14 @@ Bien entendu, avant tout, il faut installer quelques outils et
 | 
			
		||||
dépendances. Je vais tenter de les lister dans le plus grand
 | 
			
		||||
désordre (à la sauce Debian) :
 | 
			
		||||
 | 
			
		||||
- libtiff-dev
 | 
			
		||||
- libpnglite-dev
 | 
			
		||||
- liblo-dev
 | 
			
		||||
- libv4l2-dev
 | 
			
		||||
```
 | 
			
		||||
apt  install  libtiff-dev
 | 
			
		||||
apt  install  libpnglite-dev
 | 
			
		||||
apt  install  liblo-dev
 | 
			
		||||
apt  install  libv4l2-dev
 | 
			
		||||
apt  install  libcfitsio-dev
 | 
			
		||||
apt  install  libnetpbm-dev
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Certains outils externes sont aussi utiles :
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -106,8 +106,9 @@ char                            *dev_name = "/dev/video0";
 | 
			
		||||
struct buffer                   *buffers;
 | 
			
		||||
 | 
			
		||||
int		foo;
 | 
			
		||||
double		period = 10.0;			/* delai entre les captures */
 | 
			
		||||
int		nbre_capt = 1;			/* nombre de captures */
 | 
			
		||||
double		period = 10.0;		/* delai entre les captures
 | 
			
		||||
					   en secondes */
 | 
			
		||||
int		nbre_capt = 1;		/* nombre de captures */
 | 
			
		||||
int		opt;
 | 
			
		||||
int		width = 640;
 | 
			
		||||
int		height = 480;
 | 
			
		||||
@ -144,7 +145,6 @@ while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:r:s:uv")) != -1) {
 | 
			
		||||
						optarg);
 | 
			
		||||
					exit(1);
 | 
			
		||||
					}
 | 
			
		||||
				period *= 1e6;
 | 
			
		||||
				break;
 | 
			
		||||
		case 'r':	rotfactor = atoi(optarg);	break;
 | 
			
		||||
		case 's':	parse_WxH(optarg, &width, &height);
 | 
			
		||||
@ -162,7 +162,7 @@ if (verbosity > 1) {
 | 
			
		||||
	fprintf(stderr, "*** GrabVidSeq (%s, %s) libv %d, pid=%d\n",
 | 
			
		||||
				__DATE__, __TIME__, FIMG_VERSION, getpid());
 | 
			
		||||
	fprintf(stderr, "grabing %d picz, ", nbre_capt);
 | 
			
		||||
	fprintf(stderr, "period is %.3f milliseconds\n", period/1e3);
 | 
			
		||||
	fprintf(stderr, "period is %.3f seconds\n", period);
 | 
			
		||||
	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");
 | 
			
		||||
@ -277,7 +277,7 @@ for (i = 0; i < nbre_capt; i++) {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if(verbosity > 1) {
 | 
			
		||||
		fprintf(stderr, "%6d / %6d      %9.3f\n", i, nbre_capt,
 | 
			
		||||
		fprintf(stderr, "%6d / %6d      %9.3f\r", i, nbre_capt,
 | 
			
		||||
						fimg_timer_get(0));
 | 
			
		||||
		fflush(stderr);
 | 
			
		||||
		}
 | 
			
		||||
@ -309,15 +309,15 @@ for (i = 0; i < nbre_capt; i++) {
 | 
			
		||||
			out_name);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (nbre_capt > 1 && period > 1.0) {
 | 
			
		||||
		usleep(period);
 | 
			
		||||
	if (nbre_capt > 1 && period > 0.001) {
 | 
			
		||||
		/* suspend execution for
 | 
			
		||||
		   microsecond intervals */
 | 
			
		||||
		usleep((int)(period*1E6));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	xioctl(fd, VIDIOC_QBUF, &buf);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
fflush(stdout);
 | 
			
		||||
 | 
			
		||||
if (verbosity) {
 | 
			
		||||
	t_final = fimg_timer_get(0);
 | 
			
		||||
	fprintf(stderr, "pid %d : elapsed %.3g s -> %.2f fps\n", getpid(),
 | 
			
		||||
@ -398,8 +398,6 @@ switch (foo) {
 | 
			
		||||
	}
 | 
			
		||||
	// free buffers
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
fimg_destroy(&cumul);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user