Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
ashift.c File Reference
#include "bauhaus/bauhaus.h"
#include "common/bilateral.h"
#include "common/colorspaces_inline_conversions.h"
#include "common/debug.h"
#include "common/imagebuf.h"
#include "common/interpolation.h"
#include "common/math.h"
#include "common/opencl.h"
#include "control/control.h"
#include "develop/develop.h"
#include "develop/imageop.h"
#include "develop/imageop_gui.h"
#include "develop/tiling.h"
#include "dtgtk/button.h"
#include "dtgtk/expander.h"
#include "dtgtk/resetlabel.h"
#include "gui/draw.h"
#include "gui/gtk.h"
#include "gui/presets.h"
#include "iop/iop_api.h"
#include "libs/modulegroups.h"
#include "gui/guides.h"
#include <assert.h>
#include <gtk/gtk.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include "ashift_lsd.c"
#include "ashift_nmsimplex.c"
+ Include dependency graph for ashift.c:

Data Structures

struct  dt_iop_ashift_params1_t
 
struct  dt_iop_ashift_params2_t
 
struct  dt_iop_ashift_params3_t
 
struct  dt_iop_ashift_params4_t
 
struct  dt_iop_ashift_params_t
 
struct  dt_iop_ashift_line_t
 
struct  dt_iop_ashift_points_idx_t
 
struct  dt_iop_ashift_fit_params_t
 
struct  dt_iop_ashift_cropfit_params_t
 
struct  dt_iop_ashift_gui_data_t
 
struct  dt_iop_ashift_data_t
 
struct  dt_iop_ashift_global_data_t
 

Macros

#define ROTATION_RANGE   10
 
#define ROTATION_RANGE_SOFT   180
 
#define LENSSHIFT_RANGE   1.0
 
#define LENSSHIFT_RANGE_SOFT   2.0
 
#define SHEAR_RANGE   0.2
 
#define SHEAR_RANGE_SOFT   0.5
 
#define MIN_LINE_LENGTH   5
 
#define MAX_TANGENTIAL_DEVIATION   30
 
#define LSD_SCALE   0.99
 
#define LSD_SIGMA_SCALE   0.6
 
#define LSD_QUANT   2.0
 
#define LSD_ANG_TH   22.5
 
#define LSD_LOG_EPS   0.0
 
#define LSD_DENSITY_TH   0.7
 
#define LSD_N_BINS   1024
 
#define LSD_GAMMA   0.45
 
#define RANSAC_RUNS   400
 
#define RANSAC_EPSILON   2
 
#define RANSAC_EPSILON_STEP   1
 
#define RANSAC_ELIMINATION_RATIO   60
 
#define RANSAC_OPTIMIZATION_STEPS   5
 
#define RANSAC_OPTIMIZATION_DRY_RUNS   50
 
#define RANSAC_HURDLE   5
 
#define MINIMUM_FITLINES   2
 
#define NMS_EPSILON   1e-3
 
#define NMS_SCALE   1.0
 
#define NMS_ITERATIONS   400
 
#define NMS_CROP_EPSILON   100.0
 
#define NMS_CROP_SCALE   0.5
 
#define NMS_CROP_ITERATIONS   100
 
#define NMS_ALPHA   1.0
 
#define NMS_BETA   0.5
 
#define NMS_GAMMA   2.0
 
#define DEFAULT_F_LENGTH   28.0
 
#define SQR(a)   ((a) * (a))
 
#define MAX_SAVED_LINES   50
 
#define MAT3SWAP(a, b)   { float (*tmp)[3] = (a); (a) = (b); (b) = tmp; }
 

Typedefs

typedef enum dt_iop_ashift_method_t dt_iop_ashift_method_t
 
typedef enum dt_iop_ashift_homodir_t dt_iop_ashift_homodir_t
 
typedef enum dt_iop_ashift_linetype_t dt_iop_ashift_linetype_t
 
typedef enum dt_iop_ashift_fitting_t dt_iop_ashift_fitting_t
 
typedef enum dt_iop_ashift_linecolor_t dt_iop_ashift_linecolor_t
 
typedef enum dt_iop_ashift_fitaxis_t dt_iop_ashift_fitaxis_t
 
typedef enum dt_iop_ashift_nmsresult_t dt_iop_ashift_nmsresult_t
 
typedef enum dt_iop_ashift_enhance_t dt_iop_ashift_enhance_t
 
typedef enum dt_iop_ashift_mode_t dt_iop_ashift_mode_t
 
typedef enum dt_iop_ashift_crop_t dt_iop_ashift_crop_t
 
typedef enum dt_iop_ashift_bounding_t dt_iop_ashift_bounding_t
 
typedef enum dt_iop_ashift_jobcode_t dt_iop_ashift_jobcode_t
 
typedef struct dt_iop_ashift_params1_t dt_iop_ashift_params1_t
 
typedef struct dt_iop_ashift_params2_t dt_iop_ashift_params2_t
 
typedef struct dt_iop_ashift_params3_t dt_iop_ashift_params3_t
 
typedef struct dt_iop_ashift_params4_t dt_iop_ashift_params4_t
 
typedef struct dt_iop_ashift_params_t dt_iop_ashift_params_t
 
typedef struct dt_iop_ashift_line_t dt_iop_ashift_line_t
 
typedef struct dt_iop_ashift_points_idx_t dt_iop_ashift_points_idx_t
 
typedef struct dt_iop_ashift_fit_params_t dt_iop_ashift_fit_params_t
 
typedef struct dt_iop_ashift_cropfit_params_t dt_iop_ashift_cropfit_params_t
 
typedef struct dt_iop_ashift_gui_data_t dt_iop_ashift_gui_data_t
 
typedef struct dt_iop_ashift_data_t dt_iop_ashift_data_t
 
typedef struct dt_iop_ashift_global_data_t dt_iop_ashift_global_data_t
 

Enumerations

enum  dt_iop_ashift_method_t {
  ASHIFT_METHOD_NONE = 0 ,
  ASHIFT_METHOD_AUTO ,
  ASHIFT_METHOD_QUAD ,
  ASHIFT_METHOD_LINES
}
 
enum  dt_iop_ashift_homodir_t {
  ASHIFT_HOMOGRAPH_FORWARD ,
  ASHIFT_HOMOGRAPH_INVERTED
}
 
enum  dt_iop_ashift_linetype_t {
  ASHIFT_LINE_IRRELEVANT = 0 ,
  ASHIFT_LINE_RELEVANT = 1 << 0 ,
  ASHIFT_LINE_DIRVERT = 1 << 1 ,
  ASHIFT_LINE_SELECTED = 1 << 2 ,
  ASHIFT_LINE_VERTICAL_NOT_SELECTED = ASHIFT_LINE_RELEVANT | ASHIFT_LINE_DIRVERT ,
  ASHIFT_LINE_HORIZONTAL_NOT_SELECTED = ASHIFT_LINE_RELEVANT ,
  ASHIFT_LINE_VERTICAL_SELECTED = ASHIFT_LINE_RELEVANT | ASHIFT_LINE_DIRVERT | ASHIFT_LINE_SELECTED ,
  ASHIFT_LINE_HORIZONTAL_SELECTED = ASHIFT_LINE_RELEVANT | ASHIFT_LINE_SELECTED ,
  ASHIFT_LINE_MASK = ASHIFT_LINE_RELEVANT | ASHIFT_LINE_DIRVERT | ASHIFT_LINE_SELECTED
}
 
enum  dt_iop_ashift_fitting_t {
  ASHIFT_FITTING_ALL = 0 ,
  ASHIFT_FITTING_LENS_ROTATION = 1 ,
  ASHIFT_FITTING_ROTATION = 2 ,
  ASHIFT_FITTING_LENS = 3
}
 
enum  dt_iop_ashift_linecolor_t {
  ASHIFT_LINECOLOR_GREY = 0 ,
  ASHIFT_LINECOLOR_GREEN = 1 ,
  ASHIFT_LINECOLOR_RED = 2 ,
  ASHIFT_LINECOLOR_BLUE = 3 ,
  ASHIFT_LINECOLOR_YELLOW = 4
}
 
enum  dt_iop_ashift_fitaxis_t {
  ASHIFT_FIT_NONE = 0 ,
  ASHIFT_FIT_ROTATION = 1 << 0 ,
  ASHIFT_FIT_LENS_VERT = 1 << 1 ,
  ASHIFT_FIT_LENS_HOR = 1 << 2 ,
  ASHIFT_FIT_SHEAR = 1 << 3 ,
  ASHIFT_FIT_LINES_VERT = 1 << 4 ,
  ASHIFT_FIT_LINES_HOR = 1 << 5 ,
  ASHIFT_FIT_LENS_BOTH = ASHIFT_FIT_LENS_VERT | ASHIFT_FIT_LENS_HOR ,
  ASHIFT_FIT_LINES_BOTH = ASHIFT_FIT_LINES_VERT | ASHIFT_FIT_LINES_HOR ,
  ASHIFT_FIT_VERTICALLY = ASHIFT_FIT_ROTATION | ASHIFT_FIT_LENS_VERT | ASHIFT_FIT_LINES_VERT ,
  ASHIFT_FIT_HORIZONTALLY = ASHIFT_FIT_ROTATION | ASHIFT_FIT_LENS_HOR | ASHIFT_FIT_LINES_HOR ,
  ASHIFT_FIT_BOTH ,
  ASHIFT_FIT_VERTICALLY_NO_ROTATION = ASHIFT_FIT_LENS_VERT | ASHIFT_FIT_LINES_VERT ,
  ASHIFT_FIT_HORIZONTALLY_NO_ROTATION = ASHIFT_FIT_LENS_HOR | ASHIFT_FIT_LINES_HOR ,
  ASHIFT_FIT_BOTH_NO_ROTATION ,
  ASHIFT_FIT_BOTH_SHEAR ,
  ASHIFT_FIT_ROTATION_VERTICAL_LINES = ASHIFT_FIT_ROTATION | ASHIFT_FIT_LINES_VERT ,
  ASHIFT_FIT_ROTATION_HORIZONTAL_LINES = ASHIFT_FIT_ROTATION | ASHIFT_FIT_LINES_HOR ,
  ASHIFT_FIT_ROTATION_BOTH_LINES = ASHIFT_FIT_ROTATION | ASHIFT_FIT_LINES_VERT | ASHIFT_FIT_LINES_HOR ,
  ASHIFT_FIT_FLIP = ASHIFT_FIT_LENS_VERT | ASHIFT_FIT_LENS_HOR | ASHIFT_FIT_LINES_VERT | ASHIFT_FIT_LINES_HOR
}
 
enum  dt_iop_ashift_nmsresult_t {
  NMS_SUCCESS = 0 ,
  NMS_NOT_ENOUGH_LINES = 1 ,
  NMS_DID_NOT_CONVERGE = 2 ,
  NMS_INSANE = 3
}
 
enum  dt_iop_ashift_enhance_t {
  ASHIFT_ENHANCE_NONE = 0 ,
  ASHIFT_ENHANCE_EDGES = 1 << 0 ,
  ASHIFT_ENHANCE_DETAIL = 1 << 1 ,
  ASHIFT_ENHANCE_HORIZONTAL = 0x100 ,
  ASHIFT_ENHANCE_VERTICAL = 0x200
}
 
enum  dt_iop_ashift_mode_t {
  ASHIFT_MODE_GENERIC = 0 ,
  ASHIFT_MODE_SPECIFIC = 1
}
 
enum  dt_iop_ashift_crop_t {
  ASHIFT_CROP_OFF = 0 ,
  ASHIFT_CROP_LARGEST = 1 ,
  ASHIFT_CROP_ASPECT = 2
}
 
enum  dt_iop_ashift_bounding_t {
  ASHIFT_BOUNDING_OFF = 0 ,
  ASHIFT_BOUNDING_SELECT = 1 ,
  ASHIFT_BOUNDING_DESELECT = 2
}
 
enum  dt_iop_ashift_jobcode_t {
  ASHIFT_JOBCODE_NONE = 0 ,
  ASHIFT_JOBCODE_GET_STRUCTURE = 1 ,
  ASHIFT_JOBCODE_FIT = 2 ,
  ASHIFT_JOBCODE_GET_STRUCTURE_LINES = 3 ,
  ASHIFT_JOBCODE_GET_STRUCTURE_QUAD = 4 ,
  ASHIFT_JOBCODE_DO_CROP = 5
}
 

Functions

const char * name ()
 
const char * aliases ()
 
const char ** description (struct dt_iop_module_t *self)
 
int flags ()
 
int default_group ()
 
int operation_tags ()
 
int operation_tags_filter ()
 
int default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
int legacy_params (dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version)
 
dt_iop_ashift_params_t_get_ashift_params (dt_iop_module_t *self)
 
static void vec3prodn (float *dst, const float *const v1, const float *const v2)
 
static void vec3norm (float *dst, const float *const v)
 
static void vec3lnorm (float *dst, const float *const v)
 
static float vec3scalar (const float *const v1, const float *const v2)
 
static int vec3isnull (const float *const v)
 
static void _clear_shadow_crop_box (dt_iop_ashift_gui_data_t *g)
 
static void homography (float *homograph, const float angle, const float shift_v, const float shift_h, const float shear, const float f_length_kb, const float orthocorr, const float aspect, const int width, const int height, dt_iop_ashift_homodir_t dir)
 
static int isneutral (const dt_iop_ashift_data_t *data)
 
int distort_transform (dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, float *const restrict points, size_t points_count)
 
int distort_backtransform (dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, float *points, size_t points_count)
 
void distort_mask (struct dt_iop_module_t *self, struct dt_dev_pixelpipe_iop_t *piece, const float *const in, float *const out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
 
void modify_roi_out (struct dt_iop_module_t *self, struct dt_dev_pixelpipe_iop_t *piece, dt_iop_roi_t *roi_out, const dt_iop_roi_t *roi_in)
 
void modify_roi_in (struct dt_iop_module_t *self, struct dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *const roi_out, dt_iop_roi_t *roi_in)
 
static void rgb2grey256 (const float *const in, double *const out, const int width, const int height)
 
static void edge_enhance_1d (const double *in, double *out, const int width, const int height, dt_iop_ashift_enhance_t dir)
 
static int edge_enhance (const double *in, double *out, const int width, const int height)
 
static void XYZ_to_sRGB (const dt_aligned_pixel_t XYZ, dt_aligned_pixel_t sRGB)
 
static void sRGB_to_XYZ (const dt_aligned_pixel_t sRGB, dt_aligned_pixel_t XYZ)
 
static int detail_enhance (const float *const in, float *const out, const int width, const int height)
 
static void gamma_correct (const float *const in, float *const out, const int width, const int height)
 
static int line_detect (float *in, const int width, const int height, const int x_off, const int y_off, const float scale, dt_iop_ashift_line_t **alines, int *lcount, int *vcount, int *hcount, float *vweight, float *hweight, dt_iop_ashift_enhance_t enhance, const int is_raw)
 
static int _get_structure (dt_iop_module_t *module, dt_iop_ashift_enhance_t enhance)
 
static void swap (int *a, int *b)
 
static int quickperm (int *a, int *p, const int N, int *i)
 
static void shuffle (int *a, const int N)
 
static int fact (const int n)
 
static void ransac (const dt_iop_ashift_line_t *lines, int *index_set, int *inout_set, const int set_count, const float total_weight, const int xmin, const int xmax, const int ymin, const int ymax)
 
static int _remove_outliers (dt_iop_module_t *module)
 
static double logit (double x, double min, double max)
 
static double ilogit (double L, double min, double max)
 
static double model_fitness (double *params, void *data)
 
static dt_iop_ashift_nmsresult_t nmsfit (dt_iop_module_t *module, dt_iop_ashift_params_t *p, dt_iop_ashift_fitaxis_t dir)
 
static void crop_constraint (double *params, int pcount)
 
static double crop_fitness (double *params, void *data)
 
static void do_crop (dt_iop_module_t *self, dt_iop_ashift_params_t *p)
 
static void _draw_retrieve_line_type (dt_iop_ashift_line_t *line)
 
static void _draw_basic_line (dt_iop_ashift_line_t *line, float x1, float y1, float x2, float y2, dt_iop_ashift_linetype_t type)
 
static void _gui_update_structure_states (dt_iop_module_t *self, gboolean enable)
 
static void _draw_save_lines_to_params (dt_iop_module_t *self)
 
static gboolean _draw_retrieve_lines_from_params (dt_iop_module_t *self, dt_iop_ashift_method_t method)
 
static int _do_clean_structure (dt_iop_module_t *module, dt_iop_ashift_params_t *p, gboolean save_drawn)
 
static int _do_get_structure_auto (dt_iop_module_t *self, dt_iop_ashift_params_t *p, dt_iop_ashift_enhance_t enhance)
 
static void _do_get_structure_lines (dt_iop_module_t *self)
 
static void _do_get_structure_quad (dt_iop_module_t *self)
 
static void do_fit (dt_iop_module_t *module, dt_iop_ashift_params_t *p, dt_iop_ashift_fitaxis_t dir)
 
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)
 
static void _get_near (const float *points, dt_iop_ashift_points_idx_t *points_idx, const int lines_count, float pzx, float pzy, float delta, gboolean multiple)
 
static void _get_bounded_inside (const float *points, dt_iop_ashift_points_idx_t *points_idx, const int points_lines_count, float pzx, float pzy, float pzx2, float pzy2, dt_iop_ashift_bounding_t mode)
 
static uint64_t _get_lines_hash (const dt_iop_ashift_line_t *lines, const int lines_count)
 
static int update_colors (struct dt_iop_module_t *self, dt_iop_ashift_points_idx_t *points_idx, int points_lines_count)
 
static int get_points (struct dt_iop_module_t *self, const dt_iop_ashift_line_t *lines, const int lines_count, const int lines_version, float **points, float **extremas, dt_iop_ashift_points_idx_t **points_idx, int *points_lines_count, float scale)
 
static int call_distort_transform (dt_develop_t *dev, dt_dev_pixelpipe_t *pipe, struct dt_iop_module_t *self, float *points, size_t points_count)
 
void gui_post_expose (struct dt_iop_module_t *self, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery)
 
static void _update_lines_count (const dt_iop_ashift_line_t *lines, const int lines_count, int *vertical_count, int *horizontal_count)
 
static int _draw_near_point (const float x, const float y, const float *points, const int limit)
 
static void _draw_recompute_line_length (dt_iop_ashift_line_t *line)
 
int mouse_moved (struct dt_iop_module_t *self, double x, double y, double pressure, int which)
 
int button_pressed (struct dt_iop_module_t *self, double x, double y, double pressure, int which, int type, uint32_t state)
 
int button_released (struct dt_iop_module_t *self, double x, double y, int which, uint32_t state)
 
int scrolled (struct dt_iop_module_t *self, double x, double y, int up, uint32_t state)
 
void _make_controls_sensitive (dt_iop_module_t *self, const gboolean sensitive)
 
void gui_changed (dt_iop_module_t *self, GtkWidget *w, void *previous)
 
void gui_reset (struct dt_iop_module_t *self)
 
static void fitting_option_changed (GtkWidget *widget, gpointer user_data)
 
static void cropmode_callback (GtkWidget *widget, gpointer user_data)
 
static int _event_fit_v_button_clicked (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static int _event_fit_h_button_clicked (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static int _event_fit_both_button_clicked (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static int _event_structure_auto_clicked (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static int _event_structure_quad_clicked (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static int _event_structure_lines_clicked (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static void _enter_edit_mode (GtkToggleButton *button, struct dt_iop_module_t *self)
 
static void _event_commit_clicked (GtkButton *button, dt_iop_module_t *self)
 
static void _event_process_after_preview_callback (gpointer instance, gpointer user_data)
 
void commit_params (struct dt_iop_module_t *self, dt_iop_params_t *p1, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
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 reload_defaults (dt_iop_module_t *module)
 
void init_global (dt_iop_module_so_t *module)
 
void cleanup_global (dt_iop_module_so_t *module)
 
static gboolean _event_draw (GtkWidget *widget, cairo_t *cr, dt_iop_module_t *self)
 
void gui_init (struct dt_iop_module_t *self)
 
void gui_cleanup (struct dt_iop_module_t *self)
 

Macro Definition Documentation

◆ DEFAULT_F_LENGTH

#define DEFAULT_F_LENGTH   28.0

◆ LENSSHIFT_RANGE

#define LENSSHIFT_RANGE   1.0

◆ LENSSHIFT_RANGE_SOFT

#define LENSSHIFT_RANGE_SOFT   2.0

◆ LSD_ANG_TH

#define LSD_ANG_TH   22.5

◆ LSD_DENSITY_TH

#define LSD_DENSITY_TH   0.7

◆ LSD_GAMMA

#define LSD_GAMMA   0.45

◆ LSD_LOG_EPS

#define LSD_LOG_EPS   0.0

◆ LSD_N_BINS

#define LSD_N_BINS   1024

◆ LSD_QUANT

#define LSD_QUANT   2.0

◆ LSD_SCALE

#define LSD_SCALE   0.99

◆ LSD_SIGMA_SCALE

#define LSD_SIGMA_SCALE   0.6

◆ MAT3SWAP

#define MAT3SWAP (   a,
 
)    { float (*tmp)[3] = (a); (a) = (b); (b) = tmp; }

◆ MAX_SAVED_LINES

#define MAX_SAVED_LINES   50

◆ MAX_TANGENTIAL_DEVIATION

#define MAX_TANGENTIAL_DEVIATION   30

◆ MIN_LINE_LENGTH

#define MIN_LINE_LENGTH   5

◆ MINIMUM_FITLINES

#define MINIMUM_FITLINES   2

◆ NMS_ALPHA

#define NMS_ALPHA   1.0

◆ NMS_BETA

#define NMS_BETA   0.5

◆ NMS_CROP_EPSILON

#define NMS_CROP_EPSILON   100.0

◆ NMS_CROP_ITERATIONS

#define NMS_CROP_ITERATIONS   100

◆ NMS_CROP_SCALE

#define NMS_CROP_SCALE   0.5

◆ NMS_EPSILON

#define NMS_EPSILON   1e-3

◆ NMS_GAMMA

#define NMS_GAMMA   2.0

◆ NMS_ITERATIONS

#define NMS_ITERATIONS   400

◆ NMS_SCALE

#define NMS_SCALE   1.0

◆ RANSAC_ELIMINATION_RATIO

#define RANSAC_ELIMINATION_RATIO   60

◆ RANSAC_EPSILON

#define RANSAC_EPSILON   2

◆ RANSAC_EPSILON_STEP

#define RANSAC_EPSILON_STEP   1

◆ RANSAC_HURDLE

#define RANSAC_HURDLE   5

◆ RANSAC_OPTIMIZATION_DRY_RUNS

#define RANSAC_OPTIMIZATION_DRY_RUNS   50

◆ RANSAC_OPTIMIZATION_STEPS

#define RANSAC_OPTIMIZATION_STEPS   5

◆ RANSAC_RUNS

#define RANSAC_RUNS   400

◆ ROTATION_RANGE

#define ROTATION_RANGE   10

◆ ROTATION_RANGE_SOFT

#define ROTATION_RANGE_SOFT   180

◆ SHEAR_RANGE

#define SHEAR_RANGE   0.2

◆ SHEAR_RANGE_SOFT

#define SHEAR_RANGE_SOFT   0.5

◆ SQR

#define SQR (   a)    ((a) * (a))

Typedef Documentation

◆ dt_iop_ashift_bounding_t

◆ dt_iop_ashift_crop_t

◆ dt_iop_ashift_cropfit_params_t

◆ dt_iop_ashift_data_t

◆ dt_iop_ashift_enhance_t

◆ dt_iop_ashift_fit_params_t

◆ dt_iop_ashift_fitaxis_t

◆ dt_iop_ashift_fitting_t

◆ dt_iop_ashift_global_data_t

◆ dt_iop_ashift_gui_data_t

◆ dt_iop_ashift_homodir_t

◆ dt_iop_ashift_jobcode_t

◆ dt_iop_ashift_line_t

◆ dt_iop_ashift_linecolor_t

◆ dt_iop_ashift_linetype_t

◆ dt_iop_ashift_method_t

◆ dt_iop_ashift_mode_t

◆ dt_iop_ashift_nmsresult_t

◆ dt_iop_ashift_params1_t

◆ dt_iop_ashift_params2_t

◆ dt_iop_ashift_params3_t

◆ dt_iop_ashift_params4_t

◆ dt_iop_ashift_params_t

◆ dt_iop_ashift_points_idx_t

Enumeration Type Documentation

◆ dt_iop_ashift_bounding_t

Enumerator
ASHIFT_BOUNDING_OFF 
ASHIFT_BOUNDING_SELECT 
ASHIFT_BOUNDING_DESELECT 

◆ dt_iop_ashift_crop_t

Enumerator
ASHIFT_CROP_OFF 
ASHIFT_CROP_LARGEST 
ASHIFT_CROP_ASPECT 

◆ dt_iop_ashift_enhance_t

Enumerator
ASHIFT_ENHANCE_NONE 
ASHIFT_ENHANCE_EDGES 
ASHIFT_ENHANCE_DETAIL 
ASHIFT_ENHANCE_HORIZONTAL 
ASHIFT_ENHANCE_VERTICAL 

◆ dt_iop_ashift_fitaxis_t

Enumerator
ASHIFT_FIT_NONE 
ASHIFT_FIT_ROTATION 
ASHIFT_FIT_LENS_VERT 
ASHIFT_FIT_LENS_HOR 
ASHIFT_FIT_SHEAR 
ASHIFT_FIT_LINES_VERT 
ASHIFT_FIT_LINES_HOR 
ASHIFT_FIT_LENS_BOTH 
ASHIFT_FIT_LINES_BOTH 
ASHIFT_FIT_VERTICALLY 
ASHIFT_FIT_HORIZONTALLY 
ASHIFT_FIT_BOTH 
ASHIFT_FIT_VERTICALLY_NO_ROTATION 
ASHIFT_FIT_HORIZONTALLY_NO_ROTATION 
ASHIFT_FIT_BOTH_NO_ROTATION 
ASHIFT_FIT_BOTH_SHEAR 
ASHIFT_FIT_ROTATION_VERTICAL_LINES 
ASHIFT_FIT_ROTATION_HORIZONTAL_LINES 
ASHIFT_FIT_ROTATION_BOTH_LINES 
ASHIFT_FIT_FLIP 

◆ dt_iop_ashift_fitting_t

Enumerator
ASHIFT_FITTING_ALL 
ASHIFT_FITTING_LENS_ROTATION 
ASHIFT_FITTING_ROTATION 
ASHIFT_FITTING_LENS 

◆ dt_iop_ashift_homodir_t

Enumerator
ASHIFT_HOMOGRAPH_FORWARD 
ASHIFT_HOMOGRAPH_INVERTED 

◆ dt_iop_ashift_jobcode_t

Enumerator
ASHIFT_JOBCODE_NONE 
ASHIFT_JOBCODE_GET_STRUCTURE 
ASHIFT_JOBCODE_FIT 
ASHIFT_JOBCODE_GET_STRUCTURE_LINES 
ASHIFT_JOBCODE_GET_STRUCTURE_QUAD 
ASHIFT_JOBCODE_DO_CROP 

◆ dt_iop_ashift_linecolor_t

Enumerator
ASHIFT_LINECOLOR_GREY 
ASHIFT_LINECOLOR_GREEN 
ASHIFT_LINECOLOR_RED 
ASHIFT_LINECOLOR_BLUE 
ASHIFT_LINECOLOR_YELLOW 

◆ dt_iop_ashift_linetype_t

Enumerator
ASHIFT_LINE_IRRELEVANT 
ASHIFT_LINE_RELEVANT 
ASHIFT_LINE_DIRVERT 
ASHIFT_LINE_SELECTED 
ASHIFT_LINE_VERTICAL_NOT_SELECTED 
ASHIFT_LINE_HORIZONTAL_NOT_SELECTED 
ASHIFT_LINE_VERTICAL_SELECTED 
ASHIFT_LINE_HORIZONTAL_SELECTED 
ASHIFT_LINE_MASK 

◆ dt_iop_ashift_method_t

Enumerator
ASHIFT_METHOD_NONE 
ASHIFT_METHOD_AUTO 
ASHIFT_METHOD_QUAD 
ASHIFT_METHOD_LINES 

◆ dt_iop_ashift_mode_t

Enumerator
ASHIFT_MODE_GENERIC 
ASHIFT_MODE_SPECIFIC 

◆ dt_iop_ashift_nmsresult_t

Enumerator
NMS_SUCCESS 
NMS_NOT_ENOUGH_LINES 
NMS_DID_NOT_CONVERGE 
NMS_INSANE 

Function Documentation

◆ _clear_shadow_crop_box()

static void _clear_shadow_crop_box ( dt_iop_ashift_gui_data_t g)
static

Referenced by do_crop().

◆ _do_clean_structure()

static int _do_clean_structure ( dt_iop_module_t module,
dt_iop_ashift_params_t p,
gboolean  save_drawn 
)
static

◆ _do_get_structure_auto()

◆ _do_get_structure_lines()

◆ _do_get_structure_quad()

◆ _draw_basic_line()

◆ _draw_near_point()

static int _draw_near_point ( const float  x,
const float  y,
const float *  points,
const int  limit 
)
static

◆ _draw_recompute_line_length()

static void _draw_recompute_line_length ( dt_iop_ashift_line_t line)
static

◆ _draw_retrieve_line_type()

◆ _draw_retrieve_lines_from_params()

◆ _draw_save_lines_to_params()

◆ _enter_edit_mode()

◆ _event_commit_clicked()

◆ _event_draw()

static gboolean _event_draw ( GtkWidget *  widget,
cairo_t *  cr,
dt_iop_module_t self 
)
static

◆ _event_fit_both_button_clicked()

◆ _event_fit_h_button_clicked()

◆ _event_fit_v_button_clicked()

◆ _event_process_after_preview_callback()

◆ _event_structure_auto_clicked()

◆ _event_structure_lines_clicked()

◆ _event_structure_quad_clicked()

◆ _get_ashift_params()

◆ _get_bounded_inside()

static void _get_bounded_inside ( const float *  points,
dt_iop_ashift_points_idx_t points_idx,
const int  points_lines_count,
float  pzx,
float  pzy,
float  pzx2,
float  pzy2,
dt_iop_ashift_bounding_t  mode 
)
static

◆ _get_lines_hash()

static uint64_t _get_lines_hash ( const dt_iop_ashift_line_t lines,
const int  lines_count 
)
static

◆ _get_near()

static void _get_near ( const float *  points,
dt_iop_ashift_points_idx_t points_idx,
const int  lines_count,
float  pzx,
float  pzy,
float  delta,
gboolean  multiple 
)
static

◆ _get_structure()

◆ _gui_update_structure_states()

static void _gui_update_structure_states ( dt_iop_module_t self,
gboolean  enable 
)
static

◆ _make_controls_sensitive()

void _make_controls_sensitive ( dt_iop_module_t self,
const gboolean  sensitive 
)

◆ _remove_outliers()

◆ _update_lines_count()

static void _update_lines_count ( const dt_iop_ashift_line_t lines,
const int  lines_count,
int *  vertical_count,
int *  horizontal_count 
)
static

◆ aliases()

const char * aliases ( )

◆ button_pressed()

◆ button_released()

◆ call_distort_transform()

static int call_distort_transform ( dt_develop_t dev,
dt_dev_pixelpipe_t pipe,
struct dt_iop_module_t self,
float *  points,
size_t  points_count 
)
static

◆ cleanup_global()

◆ cleanup_pipe()

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

◆ commit_params()

◆ crop_constraint()

static void crop_constraint ( double params,
int  pcount 
)
static

References M_PI.

Referenced by do_crop().

◆ crop_fitness()

◆ cropmode_callback()

◆ default_colorspace()

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

References IOP_CS_RGB.

◆ default_group()

int default_group ( )

References IOP_GROUP_REPAIR.

Referenced by test_default_group().

◆ description()

◆ detail_enhance()

static int detail_enhance ( const float *const  in,
float *const  out,
const int  width,
const int  height 
)
static

◆ distort_backtransform()

◆ distort_mask()

◆ distort_transform()

◆ do_crop()

◆ do_fit()

◆ edge_enhance()

static int edge_enhance ( const double in,
double out,
const int  width,
const int  height 
)
static

◆ edge_enhance_1d()

static void edge_enhance_1d ( const double in,
double out,
const int  width,
const int  height,
dt_iop_ashift_enhance_t  dir 
)
static

References ASHIFT_ENHANCE_HORIZONTAL, height, kernel(), and width.

Referenced by edge_enhance().

◆ fact()

static int fact ( const int  n)
static

References fact().

Referenced by fact(), and ransac().

◆ fitting_option_changed()

static void fitting_option_changed ( GtkWidget *  widget,
gpointer  user_data 
)
static

◆ flags()

◆ gamma_correct()

static void gamma_correct ( const float *const  in,
float *const  out,
const int  width,
const int  height 
)
static

References height, LSD_GAMMA, and width.

Referenced by line_detect().

◆ get_points()

◆ gui_changed()

◆ gui_cleanup()

◆ gui_init()

◆ gui_post_expose()

◆ gui_reset()

◆ gui_update()

◆ homography()

static void homography ( float *  homograph,
const float  angle,
const float  shift_v,
const float  shift_h,
const float  shear,
const float  f_length_kb,
const float  orthocorr,
const float  aspect,
const int  width,
const int  height,
dt_iop_ashift_homodir_t  dir 
)
static

◆ ilogit()

static double ilogit ( double  L,
double  min,
double  max 
)
inlinestatic

Referenced by model_fitness(), and nmsfit().

◆ init_global()

◆ init_pipe()

◆ isneutral()

◆ legacy_params()

int legacy_params ( dt_iop_module_t self,
const void *const  old_params,
const int  old_version,
void new_params,
const int  new_version 
)

◆ line_detect()

◆ logit()

static double logit ( double  x,
double  min,
double  max 
)
inlinestatic

References eps.

Referenced by nmsfit().

◆ model_fitness()

◆ modify_roi_in()

◆ modify_roi_out()

◆ mouse_moved()

◆ name()

const char * name ( )

◆ nmsfit()

static dt_iop_ashift_nmsresult_t nmsfit ( dt_iop_module_t module,
dt_iop_ashift_params_t p,
dt_iop_ashift_fitaxis_t  dir 
)
static

◆ operation_tags()

int operation_tags ( )

References IOP_TAG_DISTORT.

◆ operation_tags_filter()

int operation_tags_filter ( )

◆ process()

◆ quickperm()

static int quickperm ( int *  a,
int *  p,
const int  N,
int *  i 
)
static

References FALSE, N, swap(), and TRUE.

Referenced by ransac().

◆ ransac()

static void ransac ( const dt_iop_ashift_line_t lines,
int *  index_set,
int *  inout_set,
const int  set_count,
const float  total_weight,
const int  xmin,
const int  xmax,
const int  ymin,
const int  ymax 
)
static

◆ reload_defaults()

◆ rgb2grey256()

static void rgb2grey256 ( const float *const  in,
double *const  out,
const int  width,
const int  height 
)
static

References height, and width.

Referenced by line_detect().

◆ scrolled()

◆ shuffle()

static void shuffle ( int *  a,
const int  N 
)
static

References N, and swap().

Referenced by ransac().

◆ sRGB_to_XYZ()

static void sRGB_to_XYZ ( const dt_aligned_pixel_t  sRGB,
dt_aligned_pixel_t  XYZ 
)
static

Referenced by detail_enhance().

◆ swap()

static void swap ( int *  a,
int *  b 
)
inlinestatic

Referenced by quickperm(), and shuffle().

◆ update_colors()

◆ vec3isnull()

static int vec3isnull ( const float *const  v)
inlinestatic

References eps.

Referenced by crop_fitness(), and ransac().

◆ vec3lnorm()

static void vec3lnorm ( float *  dst,
const float *const  v 
)
inlinestatic

References f().

Referenced by _draw_basic_line(), line_detect(), and model_fitness().

◆ vec3norm()

static void vec3norm ( float *  dst,
const float *const  v 
)
inlinestatic

References f().

Referenced by ransac().

◆ vec3prodn()

static void vec3prodn ( float *  dst,
const float *const  v1,
const float *const  v2 
)
inlinestatic

◆ vec3scalar()

static float vec3scalar ( const float *const  v1,
const float *const  v2 
)
inlinestatic

Referenced by line_detect(), model_fitness(), and ransac().

◆ XYZ_to_sRGB()

static void XYZ_to_sRGB ( const dt_aligned_pixel_t  XYZ,
dt_aligned_pixel_t  sRGB 
)
static

Referenced by detail_enhance().