Compare commits
No commits in common. "47de778e60d852b9333709212c8a0d3e765fa9b1" and "d11ecd0e3fe22b4d74ea28d10fa37db16e7a8ce2" have entirely different histories.
47de778e60
...
d11ecd0e3f
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* FloatImg library from tTh - ugly code inside
|
* FloatImg library from tTh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -12,10 +12,7 @@
|
|||||||
extern int verbosity;
|
extern int verbosity;
|
||||||
|
|
||||||
/* -------------------------------------------------------------- */
|
/* -------------------------------------------------------------- */
|
||||||
/*
|
|
||||||
* parameter mix is between 0.0 and 1.0 but other
|
|
||||||
* values give sometime good vibrations.
|
|
||||||
*/
|
|
||||||
int fimg_mix_rgb_gray(FloatImg *img, float mix)
|
int fimg_mix_rgb_gray(FloatImg *img, float mix)
|
||||||
{
|
{
|
||||||
int x, y, p;
|
int x, y, p;
|
||||||
@ -27,8 +24,7 @@ if (FIMG_TYPE_RGB != img->type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (y=0; y<img->height; y++) {
|
for (y=0; y<img->height; y++) {
|
||||||
p = y * img->width; /* first pixel of the row */
|
p = y * img->width;
|
||||||
|
|
||||||
for (x=0; x<img->width; x++) {
|
for (x=0; x<img->width; x++) {
|
||||||
|
|
||||||
gr = (img->R[p] + img->G[p] + img->R[p]) / 3.0;
|
gr = (img->R[p] + img->G[p] + img->R[p]) / 3.0;
|
||||||
@ -46,21 +42,17 @@ return 0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------- */
|
/* -------------------------------------------------------------- */
|
||||||
/*
|
|
||||||
* The third parameter was a six value array with min and max
|
|
||||||
* values maybe computed by the 'fimg_get_minmax_rgb' function.
|
|
||||||
*/
|
|
||||||
int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6])
|
int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6])
|
||||||
{
|
{
|
||||||
int sz, idx;
|
int sz, idx;
|
||||||
|
|
||||||
if (FIMG_TYPE_RGB != s->type) {
|
sz = s->width * s->height;
|
||||||
|
|
||||||
|
if (FIMG_TYPE_RGB != img->type) {
|
||||||
fprintf(stderr, "%s bad type\n", __func__);
|
fprintf(stderr, "%s bad type\n", __func__);
|
||||||
return -6;
|
return -6;
|
||||||
}
|
}
|
||||||
|
|
||||||
sz = s->width * s->height;
|
|
||||||
|
|
||||||
for (idx=0; idx<sz; idx++) {
|
for (idx=0; idx<sz; idx++) {
|
||||||
d->R[idx] = s->R[idx] - coefs[0];
|
d->R[idx] = s->R[idx] - coefs[0];
|
||||||
d->G[idx] = s->G[idx] - coefs[2];
|
d->G[idx] = s->G[idx] - coefs[2];
|
||||||
|
Loading…
Reference in New Issue
Block a user