Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
colortransfer.c File Reference
#include "common/colorspaces.h"
#include "common/imagebuf.h"
#include "common/points.h"
#include "control/control.h"
#include "develop/develop.h"
#include "develop/imageop.h"
#include "gui/gtk.h"
#include "iop/iop_api.h"
#include <gtk/gtk.h>
#include <inttypes.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
+ Include dependency graph for colortransfer.c:

Data Structures

struct  dt_iop_colortransfer_params_t
 
struct  dt_iop_colortransfer_gui_data_t
 
struct  dt_iop_colortransfer_data_t
 

Macros

#define HISTN   (1 << 11)
 
#define MAXN   5
 

Typedefs

typedef float float2[2]
 
typedef enum dt_iop_colortransfer_flag_t dt_iop_colortransfer_flag_t
 
typedef struct dt_iop_colortransfer_params_t dt_iop_colortransfer_params_t
 
typedef struct dt_iop_colortransfer_gui_data_t dt_iop_colortransfer_gui_data_t
 
typedef struct dt_iop_colortransfer_data_t dt_iop_colortransfer_data_t
 

Enumerations

enum  dt_iop_colortransfer_flag_t {
  ACQUIRE = 0 ,
  ACQUIRE2 = 1 ,
  ACQUIRE3 = 2 ,
  ACQUIRED = 3 ,
  APPLY = 4 ,
  NEUTRAL = 5
}
 

Functions

const char * name ()
 
int default_group ()
 
int flags ()
 
const char * deprecated_msg ()
 
int default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
static void capture_histogram (const float *col, const dt_iop_roi_t *roi, int *hist)
 
static void invert_histogram (const int *hist, float *inv_hist)
 
static void get_cluster_mapping (const int n, float2 *mi, float2 *mo, int *mapio)
 
static void get_clusters (const float *col, const int n, float2 *mean, float *weight)
 
static int get_cluster (const float *col, const int n, float2 *mean)
 
static void kmeans (const float *col, const dt_iop_roi_t *const roi, const int n, float2 *mean_out, float2 *var_out)
 
void process (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
 
void init_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void cleanup_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void gui_update (struct dt_iop_module_t *self)
 
void gui_init (struct dt_iop_module_t *self)
 

Macro Definition Documentation

◆ HISTN

#define HISTN   (1 << 11)

color transfer somewhat based on the glorious paper ‘color transfer between images’ by erik reinhard, michael ashikhmin, bruce gooch, and peter shirley, 2001. chosen because it officially cites the playboy.

workflow:

  • open the target image, press acquire button
  • right click store as preset
  • open image you want to transfer the color to
  • right click and apply the preset

◆ MAXN

#define MAXN   5

Typedef Documentation

◆ dt_iop_colortransfer_data_t

◆ dt_iop_colortransfer_flag_t

◆ dt_iop_colortransfer_gui_data_t

◆ dt_iop_colortransfer_params_t

◆ float2

typedef float float2[2]

Enumeration Type Documentation

◆ dt_iop_colortransfer_flag_t

Enumerator
ACQUIRE 
ACQUIRE2 
ACQUIRE3 
ACQUIRED 
APPLY 
NEUTRAL 

Function Documentation

◆ capture_histogram()

static void capture_histogram ( const float *  col,
const dt_iop_roi_t roi,
int *  hist 
)
static

References dt_iop_roi_t::height, HISTN, and dt_iop_roi_t::width.

Referenced by process().

◆ cleanup_pipe()

void cleanup_pipe ( struct dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

◆ default_colorspace()

int default_colorspace ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

References IOP_CS_LAB.

◆ default_group()

int default_group ( )

References IOP_GROUP_COLOR.

◆ deprecated_msg()

const char * deprecated_msg ( )

◆ flags()

◆ get_cluster()

static int get_cluster ( const float *  col,
const int  n,
float2 mean 
)
static

References dist().

Referenced by kmeans(), and process().

◆ get_cluster_mapping()

static void get_cluster_mapping ( const int  n,
float2 mi,
float2 mo,
int *  mapio 
)
static

References dist().

Referenced by process().

◆ get_clusters()

static void get_clusters ( const float *  col,
const int  n,
float2 mean,
float *  weight 
)
static

References dist(), and weight().

Referenced by process().

◆ gui_init()

◆ gui_update()

◆ init_pipe()

◆ invert_histogram()

static void invert_histogram ( const int *  hist,
float *  inv_hist 
)
static

References HISTN.

Referenced by process().

◆ kmeans()

static void kmeans ( const float *  col,
const dt_iop_roi_t *const  roi,
const int  n,
float2 mean_out,
float2 var_out 
)
static
Todo:
: check params here:

References dt_points_get(), get_cluster(), dt_iop_roi_t::height, Lab(), and dt_iop_roi_t::width.

Referenced by process().

◆ name()

const char * name ( )

◆ process()