Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
[submodule "src/external/lua-scripts"]
path = src/external/lua-scripts
url = https://github.com/darktable-org/lua-scripts.git
[submodule "src/external/opencv"]
path = src/external/opencv
url = https://github.com/opencv/opencv.git
1 change: 1 addition & 0 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ src/develop/masks/group.c
src/develop/masks/masks.c
src/develop/masks/masks.c
src/develop/masks/path.c
src/develop/masks/point.c
src/develop/pixelpipe_hb.c
src/develop/tiling.c
src/dtgtk/culling.c
Expand Down
13 changes: 9 additions & 4 deletions src/CMakeLists.txt
Copy link

@Rational-pi Rational-pi Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are having troubles building just some modules of OpenCV i did this some time ago
it is so long to build all the modules i found it useful
https://gitlab.com/RationalPI/paintpp/-/blob/master/easyCV.cmake

then where you need OpenCV:
BuildOpenCV(${CMAKE_BUILD_TYPE} ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/opencv-4.2.0 ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/builds/OpenCV)
target_include_directories(PaintPP PUBLIC ${OpenCV_INCLUDE_DIRS})
target_link_libraries(PaintPP ${OpenCV_LIBS})

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thanks! I'll give it a look because right now it is compiling using my local installation of opencv instead of the one being built by myself. I have problems with the local build as it crashes my graphics driver during inference. I still don't know exactly how we will build OpenCV into Darktable, but this looks like a good start. Thanks again!

Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ FILE(GLOB SOURCE_FILES
"develop/masks/group.c"
"develop/masks/masks.c"
"develop/masks/path.c"
"develop/masks/point.c"
"develop/object_detection.cpp"
"develop/pixelpipe.c"
"develop/tensor_box.c"
"develop/tiling.c"
"dtgtk/button.c"
"dtgtk/culling.c"
Expand Down Expand Up @@ -158,8 +161,8 @@ FILE(GLOB SOURCE_FILES
"views/view.c"
)

FILE(GLOB HEADER_FILES "*.h" "common/*.h" "external/OpenCL/CL/*.h" "control/*.h" "iop/*.h" "libs/*.h" "views/*.h")

FILE(GLOB HEADER_FILES "*.h" "common/*.h" "external/OpenCL/CL/*.h" "control/*.h" "iop/*.h" "libs/*.h" "views/*.h")
set_source_files_properties(develop/object_detection.cpp PROPERTIES LANGUAGE CXX)
if(APPLE)
list(APPEND SOURCE_FILES "osx/osx.mm")
list(APPEND HEADER_FILES "osx/osx.h")
Expand Down Expand Up @@ -933,6 +936,9 @@ if(USE_XMLLINT)
add_dependencies(generate_preferences validate_darktableconfig_xml generate_conf)
endif(USE_XMLLINT)

find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )

#
# build libdarktable
#
Expand Down Expand Up @@ -964,15 +970,14 @@ endif()
target_link_libraries(lib_darktable PUBLIC ${STATIC_LIBS})
target_link_libraries(lib_darktable PRIVATE whereami)
target_link_libraries(lib_darktable PUBLIC ${LIBS})

target_link_libraries(lib_darktable PUBLIC ${OpenCV_LIBS} )
unset(LIBS)
unset(STATIC_LIBS)
unset(LIB_DEPS)

add_library(lib_darktable_imageio_rawspeed STATIC imageio/imageio_rawspeed.cc)
target_link_libraries(lib_darktable_imageio_rawspeed PRIVATE rawspeed)
target_link_libraries(lib_darktable PRIVATE lib_darktable_imageio_rawspeed)

#
# Install lib_darktable
#
Expand Down
2 changes: 1 addition & 1 deletion src/develop/blend.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ extern const dt_introspection_type_enum_tuple_t dt_develop_combine_masks_names[]
extern const dt_introspection_type_enum_tuple_t dt_develop_feathering_guide_names[];
extern const dt_introspection_type_enum_tuple_t dt_develop_invert_mask_names[];

#define DEVELOP_MASKS_NB_SHAPES 5
#define DEVELOP_MASKS_NB_SHAPES 6

/** blend gui data */
typedef struct dt_iop_gui_blend_data_t
Expand Down
8 changes: 8 additions & 0 deletions src/develop/blend_gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -2831,6 +2831,14 @@ void dt_iop_gui_init_masks(GtkWidget *blendw, dt_iop_module_t *module)
FALSE, 0, 0,
dtgtk_cairo_paint_masks_brush, abox);

bd->masks_type[5] = DT_MASKS_POINT;
bd->masks_shapes[5] = dt_iop_togglebutton_new(module, "blend`shapes",
N_("add point"),
N_("add multiple points"),
G_CALLBACK(_blendop_masks_add_shape),
FALSE, 0, 0,
dtgtk_cairo_paint_masks_ai, abox);

bd->masks_type[1] = DT_MASKS_PATH;
bd->masks_shapes[1] = dt_iop_togglebutton_new(module, "blend`shapes",
N_("add path"),
Expand Down
4 changes: 3 additions & 1 deletion src/develop/masks.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ typedef enum dt_masks_type_t
DT_MASKS_GRADIENT = 1 << 4,
DT_MASKS_ELLIPSE = 1 << 5,
DT_MASKS_BRUSH = 1 << 6,
DT_MASKS_NON_CLONE = 1 << 7
DT_MASKS_NON_CLONE = 1 << 7,
DT_MASKS_POINT = 1 << 8,
} dt_masks_type_t;

/**masts states */
Expand Down Expand Up @@ -441,6 +442,7 @@ extern const dt_masks_functions_t dt_masks_functions_brush;
extern const dt_masks_functions_t dt_masks_functions_path;
extern const dt_masks_functions_t dt_masks_functions_gradient;
extern const dt_masks_functions_t dt_masks_functions_group;
extern const dt_masks_functions_t dt_masks_functions_point;

/** init dt_masks_form_gui_t struct with default values */
void dt_masks_init_form_gui(dt_masks_form_gui_t *gui);
Expand Down
14 changes: 13 additions & 1 deletion src/develop/masks/masks.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,8 @@ dt_masks_form_t *dt_masks_create(dt_masks_type_t type)
form->functions = &dt_masks_functions_gradient;
else if(type & DT_MASKS_GROUP)
form->functions = &dt_masks_functions_group;
else if(type & DT_MASKS_POINT)
form->functions = &dt_masks_functions_point;

if(form->functions && form->functions->sanitize_config)
form->functions->sanitize_config(type);
Expand Down Expand Up @@ -1263,7 +1265,8 @@ void dt_masks_events_post_expose(dt_iop_module_t *module,
// add preview when creating a circle, ellipse and gradient
if(!(((form->type & DT_MASKS_CIRCLE)
|| (form->type & DT_MASKS_ELLIPSE)
|| (form->type & DT_MASKS_GRADIENT))
|| (form->type & DT_MASKS_GRADIENT)
|| (form->type & DT_MASKS_POINT))
&& gui->creation))
dt_masks_gui_form_test_create(form, gui, module);

Expand Down Expand Up @@ -1711,6 +1714,9 @@ void dt_masks_iop_value_changed_callback(GtkWidget *widget,
// add a brush shape
_menu_add_shape(module, DT_MASKS_BRUSH);
}
else if(val == -2000128) {
_menu_add_shape(module, DT_MASKS_POINT);
}
else if(val < 0)
{
// use same shapes as another iop
Expand Down Expand Up @@ -2561,6 +2567,12 @@ void dt_masks_calculate_source_pos_value(dt_masks_form_gui_t *gui,
x += xpos;
y += ypos;
}
else if(mask_type & DT_MASKS_POINT)
{
dt_masks_functions_point.initial_source_pos(iwidth, iheight, &x, &y);
x += xpos;
y += ypos;
}
#endif
else
dt_print(DT_DEBUG_ALWAYS, "[dt_masks_calculate_source_pos_value]"
Expand Down
Loading