two new operators (mini & maxi)
This commit is contained in:
@@ -66,7 +66,6 @@ for (idx=0; idx<nbiter; idx++) {
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* ---------------------------------------------------------------- */
|
||||
/*
|
||||
* A * B -> D
|
||||
*/
|
||||
@@ -94,3 +93,53 @@ for (idx=0; idx<nbiter; idx++) {
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
int fimg_minimum(FloatImg *a, FloatImg *b, FloatImg *d)
|
||||
{
|
||||
int idx, nbiter;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d);
|
||||
#endif
|
||||
|
||||
if (3 != a->type || 3 != b->type || 3 != d->type) {
|
||||
fprintf(stderr, "%s : got a bad type fimg\n", __func__);
|
||||
return -8;
|
||||
}
|
||||
|
||||
nbiter = a->width * a->height * 3;
|
||||
|
||||
for (idx=0; idx<nbiter; idx++) {
|
||||
if (a->R[idx] > b->R[idx])
|
||||
d->R[idx] = a->R[idx];
|
||||
else
|
||||
d->R[idx] = b->R[idx];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
int fimg_maximum(FloatImg *a, FloatImg *b, FloatImg *d)
|
||||
{
|
||||
int idx, nbiter;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d);
|
||||
#endif
|
||||
|
||||
if (3 != a->type || 3 != b->type || 3 != d->type) {
|
||||
fprintf(stderr, "%s : got a bad type fimg\n", __func__);
|
||||
return -8;
|
||||
}
|
||||
|
||||
nbiter = a->width * a->height * 3;
|
||||
|
||||
for (idx=0; idx<nbiter; idx++) {
|
||||
if (a->R[idx] < b->R[idx])
|
||||
d->R[idx] = a->R[idx];
|
||||
else
|
||||
d->R[idx] = b->R[idx];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
10
lib/runme.sh
10
lib/runme.sh
@@ -1,13 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
../v4l2/grabvidseq -s 960x720 -n 10000 -p 0.193 \
|
||||
-vv -g -c none \
|
||||
../v4l2/grabvidseq -s 960x720 -n 100 -p 0.193 \
|
||||
-vv -c none \
|
||||
-o original.fimg
|
||||
|
||||
make t && ./t
|
||||
|
||||
for picz in original power2 squareroot cos_01
|
||||
../tools/fimgops original.fimg cos_01.fimg mini minimum.fimg
|
||||
../tools/fimgops original.fimg cos_01.fimg maxi maximum.fimg
|
||||
|
||||
|
||||
for picz in original power2 squareroot cos_01 minimum maximum
|
||||
do
|
||||
|
||||
echo _______________________ ${picz}
|
||||
|
||||
Reference in New Issue
Block a user