[shotwell/wip/gtk4: 144/154] Enable face-tagging unconditionally




commit e35002a163923f1f4184575b1a68e8ab2df1cc71
Author: Jens Georg <mail jensge org>
Date:   Mon May 9 09:06:46 2022 +0200

    Enable face-tagging unconditionally

 meson.build                                          |  2 +-
 src/AppDirs.vala                                     |  4 ----
 src/Commands.vala                                    |  3 ---
 src/Dialogs.vala                                     |  4 ----
 src/Photo.vala                                       |  2 --
 src/PhotoPage.vala                                   |  8 --------
 src/Resources.vala                                   |  2 --
 src/SearchFilter.vala                                |  5 +----
 src/faces/Face.vala                                  |  6 +-----
 src/faces/FaceDetect.vala                            |  2 ++
 src/faces/FacePage.vala                              |  4 ----
 src/faces/FaceShape.vala                             |  5 +----
 src/faces/Faces.vala                                 | 20 --------------------
 src/faces/FacesBranch.vala                           |  4 ----
 src/faces/FacesTool.vala                             |  5 ++---
 src/library/LibraryWindow.vala                       | 13 +------------
 src/main.vala                                        |  6 ------
 src/meson.build                                      | 18 ++++++++----------
 src/searches/SavedSearchDialog.vala                  |  2 --
 src/searches/SearchBoolean.vala                      | 18 ++++++------------
 src/util/ui.vala                                     |  2 --
 .../shotwell-facedetect/facedetect-opencv.cpp        |  2 ++
 22 files changed, 25 insertions(+), 112 deletions(-)
---
diff --git a/meson.build b/meson.build
index f4fe1194..05e3a72a 100644
--- a/meson.build
+++ b/meson.build
@@ -94,7 +94,7 @@ if get_option('udev') and gudev.found()
 endif
 
 if get_option('face_detection')
-  add_global_arguments(['--define=ENABLE_FACES'], language : 'vala')
+  add_global_arguments(['--define=ENABLE_FACE_DETECTION'], language : 'vala')
 
   if get_option('face_detection_helper_bus') == 'private'
       add_global_arguments(['--define=FACEDETECT_BUS_PRIVATE'], language : 'vala')
diff --git a/src/AppDirs.vala b/src/AppDirs.vala
index f82fe4f4..b303958d 100644
--- a/src/AppDirs.vala
+++ b/src/AppDirs.vala
@@ -258,14 +258,12 @@ class AppDirs {
         return subdir;
     }
     
-#if ENABLE_FACES
     public static File get_resources_dir() {
         File? install_dir = get_install_dir();
         
         return (install_dir != null) ? install_dir.get_child("share").get_child("shotwell")
             : get_lib_dir();
     }
-#endif
     
     public static File get_lib_dir() {
         File? install_dir = get_install_dir();
@@ -366,7 +364,6 @@ class AppDirs {
         return f;
     }
 
-#if ENABLE_FACES
     public static File get_facedetect_bin() {
         const string filename = "shotwell-facedetect";
         File f = 
AppDirs.get_libexec_dir().get_parent().get_child("subprojects").get_child(filename).get_child (filename);
@@ -392,7 +389,6 @@ class AppDirs {
 
         return get_data_subdir("data"); //get_child("openface.nn4.small2.v1.t7");
     }
-#endif
 
 }
 
diff --git a/src/Commands.vala b/src/Commands.vala
index d14469da..e92e3a46 100644
--- a/src/Commands.vala
+++ b/src/Commands.vala
@@ -2514,7 +2514,6 @@ public class FlagUnflagCommand : MultipleDataSourceAtOnceCommand {
     }
 }
 
-#if ENABLE_FACES
 public class RemoveFacesFromPhotosCommand : SimpleProxyableCommand {
     private Gee.Map<MediaSource, string> map_source_geometry = new Gee.HashMap<MediaSource, string>();
     
@@ -2750,5 +2749,3 @@ public class ModifyFacesCommand : SingleDataSourceCommand {
         get_command_manager().reset();
     }
 }
-
-#endif
diff --git a/src/Dialogs.vala b/src/Dialogs.vala
index 931276c6..606f7a2c 100644
--- a/src/Dialogs.vala
+++ b/src/Dialogs.vala
@@ -53,8 +53,6 @@ public async bool confirm_warn_developer_changed(int number) {
     return result == Gtk.ResponseType.YES;
 }
 
-#if ENABLE_FACES   
-
 public async bool confirm_delete_face(Face face) {
     int count = face.get_sources_count();
     string msg = ngettext(
@@ -66,8 +64,6 @@ public async bool confirm_delete_face(Face face) {
         Resources.DELETE_FACE_TITLE);
 }
 
-#endif
-
 }
 
 namespace ExportUI {
diff --git a/src/Photo.vala b/src/Photo.vala
index c758d0c9..89b0e0d7 100644
--- a/src/Photo.vala
+++ b/src/Photo.vala
@@ -5262,7 +5262,6 @@ public class LibraryPhoto : Photo, Flaggable, Monitorable {
             }
         }
         
-#if ENABLE_FACES
         // Attach faces.
         Gee.Collection<Face>? faces = Face.global.fetch_for_source(this);
         if (faces != null) {
@@ -5276,7 +5275,6 @@ public class LibraryPhoto : Photo, Flaggable, Monitorable {
                 }
              }
         }
-#endif
         
         return dupe;
     }
diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala
index e63031cc..440cce20 100644
--- a/src/PhotoPage.vala
+++ b/src/PhotoPage.vala
@@ -396,9 +396,7 @@ public abstract class EditingHostPage : SinglePhotoPage {
     private Gtk.ToggleButton redeye_button = null;
     private Gtk.ToggleButton adjust_button = null;
     private Gtk.ToggleButton straighten_button = null;
-#if ENABLE_FACES
     private Gtk.ToggleButton faces_button = null;
-#endif
     private Gtk.Button enhance_button = null;
     private Gtk.Scale zoom_slider = null;
     private Gtk.Button prev_button = new Gtk.Button.with_label(Resources.PREVIOUS_LABEL);
@@ -491,12 +489,10 @@ public abstract class EditingHostPage : SinglePhotoPage {
         enhance_button.clicked.connect(on_enhance);
         toolbar.append (enhance_button);
         
-#if ENABLE_FACES
         // faces tool
         insert_faces_button(toolbar);
         faces_button = new Gtk.ToggleButton();
         //face_button
-#endif
 
         // separator to force next/prev buttons to right side of toolbar
         var separator = new Gtk.Separator(Gtk.Orientation.VERTICAL);
@@ -2307,9 +2303,7 @@ public class LibraryPhotoPage : EditingHostPage {
         }
     }
 
-#if ENABLE_FACES
     private Gtk.ToggleButton faces_button = null;
-#endif
     private CollectionPage? return_page = null;
     private bool return_to_collection_on_release = false;
     private LibraryPhotoPageViewFilter filter = new LibraryPhotoPageViewFilter();
@@ -3118,7 +3112,6 @@ public class LibraryPhotoPage : EditingHostPage {
         });
     }
 
-#if ENABLE_FACES       
     private void on_faces_toggled() {
         on_tool_button_toggled(faces_button, FacesTool.factory);
     }
@@ -3135,6 +3128,5 @@ public class LibraryPhotoPage : EditingHostPage {
         faces_button.toggled.connect(on_faces_toggled);
         toolbar.append(faces_button);
     }
-#endif
 }
 
diff --git a/src/Resources.vala b/src/Resources.vala
index c5c009b9..c7ba9a8d 100644
--- a/src/Resources.vala
+++ b/src/Resources.vala
@@ -398,7 +398,6 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
         return _("Delete Search “%s”").printf(name);
     }
 
-#if ENABLE_FACES
     public static string rename_face_exists_message(string name) {
         return _("Unable to rename face to “%s” because the face already exists.").printf(name);
     }
@@ -442,7 +441,6 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
     public string delete_face_label(string name) {
         return _("Delete Face “%s”").printf(name);
     }
-#endif
     
     private unowned string rating_label(Rating rating) {
         switch (rating) {
diff --git a/src/SearchFilter.vala b/src/SearchFilter.vala
index 3f2b3030..0d4fb539 100644
--- a/src/SearchFilter.vala
+++ b/src/SearchFilter.vala
@@ -223,9 +223,7 @@ public abstract class DefaultSearchViewFilter : SearchViewFilter {
             Gee.List<Tag>? tags = Tag.global.fetch_for_source(source);
             int tags_size = (tags != null) ? tags.size : 0;
  
-#if ENABLE_FACES           
             Gee.List<Face>? faces = Face.global.fetch_for_source(source);
-#endif
             
             foreach (unowned string word in get_search_filter_words()) {
                 if (media_keywords != null && media_keywords.contains(word))
@@ -249,7 +247,6 @@ public abstract class DefaultSearchViewFilter : SearchViewFilter {
                         continue;
                 }
                 
-#if ENABLE_FACES
                 if (faces != null) {
                     bool found = false;
                     foreach (Face f in faces) {
@@ -264,7 +261,7 @@ public abstract class DefaultSearchViewFilter : SearchViewFilter {
                     if (found)
                         continue;
                 }
-#endif                
+
                 // failed all tests (this even works if none of the Indexables have strings,
                 // as they fail the implicit AND test)
                 return false;
diff --git a/src/faces/Face.vala b/src/faces/Face.vala
index 934e95fa..2a2f66a9 100644
--- a/src/faces/Face.vala
+++ b/src/faces/Face.vala
@@ -346,20 +346,18 @@ public class Face : DataSource, ContainerSource, Proxyable, Indexable {
         global.add_many(faces);
         global.init_add_many_unlinked(unlinked);
 
-#if ENABLE_FACES       
         // Start the face detection background process
         // FaceTool talks to it over DBus
+#if ENABLE_FACE_DETECTION
         start_facedetect_process();
 #endif
     }
     
-#if ENABLE_FACES
     public static void terminate() {
         try {
             FaceDetect.interface.terminate();
         } catch(Error e) {}
     }
-#endif
     
     public static int compare_names(void *a, void *b) {
         Face *aface = (Face *) a;
@@ -377,14 +375,12 @@ public class Face : DataSource, ContainerSource, Proxyable, Indexable {
         return String.collated_equals(a, b);
     }
 
-#if ENABLE_FACES       
     private static void start_facedetect_process() {
         message("Launching facedetect process: %s", AppDirs.get_facedetect_bin().get_path());
         message("Using dnn from %s", AppDirs.get_openface_dnn_dir().get_path());
         // Start the watcher, process started via DBus service
         FaceDetect.init(AppDirs.get_openface_dnn_dir().get_path());
     }
-#endif
     
     // Returns a Face for the name, creating a new empty one if it does not already exist.
     // name should have already been prepared by prep_face_name.
diff --git a/src/faces/FaceDetect.vala b/src/faces/FaceDetect.vala
index 4bf6e6af..f11bc6ca 100644
--- a/src/faces/FaceDetect.vala
+++ b/src/faces/FaceDetect.vala
@@ -136,8 +136,10 @@ public class FaceDetect {
             interface = Bus.get_proxy_sync (BusType.SESSION, DBUS_NAME, DBUS_PATH);
             interface.load_net(net_file);
         } catch(IOError e) {
+            print("%s\n", e.message);
             AppWindow.error_message(ERROR_MESSAGE);
         } catch(DBusError e) {
+            print("%s\n", e.message);
             AppWindow.error_message(ERROR_MESSAGE);
         }
         connected = true;
diff --git a/src/faces/FacePage.vala b/src/faces/FacePage.vala
index 12e7c361..b995fb21 100644
--- a/src/faces/FacePage.vala
+++ b/src/faces/FacePage.vala
@@ -4,8 +4,6 @@
  * (version 2.1 or later).  See the COPYING file in this distribution.
  */
 
-#if ENABLE_FACES
-
 public class FacePage : CollectionPage {
     private Face face;
     
@@ -140,5 +138,3 @@ public class FacePage : CollectionPage {
         }
     }
 }
-
-#endif
diff --git a/src/faces/FaceShape.vala b/src/faces/FaceShape.vala
index a1764416..7beeb58d 100644
--- a/src/faces/FaceShape.vala
+++ b/src/faces/FaceShape.vala
@@ -4,8 +4,6 @@
  * (version 2.1 or later).  See the COPYING file in this distribution.
  */
 
-#if ENABLE_FACES
-
 public abstract class FaceShape : Object {
     public const string SHAPE_TYPE = null;
     
@@ -330,6 +328,7 @@ public class FaceRectangle : FaceShape {
     }
     
     protected override void paint() {
+        print ("Printing box...\n");
         canvas.draw_box(wide_black_ctx, box);
         canvas.draw_box(wide_white_ctx, box.get_reduced(1));
         canvas.draw_box(wide_white_ctx, box.get_reduced(2));
@@ -825,5 +824,3 @@ public class FaceRectangle : FaceShape {
         return Math.sqrt((center_x - x) * (center_x - x) + (center_y - y) * (center_y - y));
     }
 }
-
-#endif
diff --git a/src/faces/Faces.vala b/src/faces/Faces.vala
index 3f0623a7..595c3b6c 100644
--- a/src/faces/Faces.vala
+++ b/src/faces/Faces.vala
@@ -4,8 +4,6 @@
  * (version 2.1 or later).  See the COPYING file in this distribution.
  */
 
-#if ENABLE_FACES
-
 namespace Faces {
 
 public void init() throws Error {
@@ -17,21 +15,3 @@ public void terminate() {
 }
 
 }
-
-#else
-
-namespace Faces {
-
-public void init() throws Error {
-    // do nothing; this method is here only
-    // to make the unitizing mechanism happy
-}
-
-public void terminate() {
-    // do nothing; this method is here only
-    // to make the unitizing mechanism happy
-}
-
-}
-
-#endif
diff --git a/src/faces/FacesBranch.vala b/src/faces/FacesBranch.vala
index 0cd30803..d74af69c 100644
--- a/src/faces/FacesBranch.vala
+++ b/src/faces/FacesBranch.vala
@@ -4,8 +4,6 @@
  * (version 2.1 or later).  See the COPYING file in this distribution.
  */
 
-#if ENABLE_FACES
-
 public class Faces.Branch : Sidebar.Branch {
     private Gee.HashMap<Face, Faces.SidebarEntry> entry_map = new Gee.HashMap<Face, Faces.SidebarEntry>();
     
@@ -145,5 +143,3 @@ public class Faces.SidebarEntry : Sidebar.SimplePageEntry, Sidebar.RenameableEnt
         });
     }
 }
-
-#endif
diff --git a/src/faces/FacesTool.vala b/src/faces/FacesTool.vala
index dc4bb321..48d37e6a 100644
--- a/src/faces/FacesTool.vala
+++ b/src/faces/FacesTool.vala
@@ -4,7 +4,6 @@
  * (version 2.1 or later).  See the COPYING file in this distribution.
  */
 
-#if ENABLE_FACES
 public errordomain FaceShapeError {
     CANT_CREATE
 }
@@ -151,7 +150,9 @@ public class FacesTool : EditingTools.EditingTool {
             help_layout.append(help_text);
 
             response_layout = new Gtk.Box(Gtk.Orientation.HORIZONTAL, CONTROL_SPACING);
+            #if ENABLE_FACE_DETECTION
             response_layout.append(detection_button);
+            #endif
             response_layout.append(cancel_button);
             response_layout.append(ok_button);
 
@@ -967,5 +968,3 @@ public class FacesTool : EditingTools.EditingTool {
         face_detection.cancel();
     }
 }
-
-#endif
diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala
index 21beaa46..de8cc666 100644
--- a/src/library/LibraryWindow.vala
+++ b/src/library/LibraryWindow.vala
@@ -40,9 +40,7 @@ public class LibraryWindow : AppWindow {
         EVENTS,
         IMPORT_ROLL,
         FOLDERS,
-#if ENABLE_FACES   
         FACES,
-#endif
         TAGS
     }
     
@@ -109,9 +107,7 @@ public class LibraryWindow : AppWindow {
     private Library.Branch library_branch = new Library.Branch();
     private Tags.Branch tags_branch = new Tags.Branch();
     private Folders.Branch folders_branch = new Folders.Branch();
-#if ENABLE_FACES
     private Faces.Branch faces_branch = new Faces.Branch();    
-#endif
     private Events.Branch events_branch = new Events.Branch();
     private Camera.Branch camera_branch = new Camera.Branch();
     private Searches.Branch saved_search_branch = new Searches.Branch();
@@ -163,10 +159,7 @@ public class LibraryWindow : AppWindow {
         sidebar_tree.graft(library_branch, SidebarRootPosition.LIBRARY);
         sidebar_tree.graft(tags_branch, SidebarRootPosition.TAGS);
         sidebar_tree.graft(folders_branch, SidebarRootPosition.FOLDERS);
-#if ENABLE_FACES   
         sidebar_tree.graft(faces_branch, SidebarRootPosition.FACES);
-#endif
-
         sidebar_tree.graft(events_branch, SidebarRootPosition.EVENTS);
         sidebar_tree.graft(camera_branch, SidebarRootPosition.CAMERAS);
         sidebar_tree.graft(saved_search_branch, SidebarRootPosition.SAVED_SEARCH);
@@ -402,17 +395,13 @@ public class LibraryWindow : AppWindow {
             debug("No search entry found for rename");
     }
     
-#if ENABLE_FACES
     public void rename_face_in_sidebar(Face face) {
-    #if 0
         Faces.SidebarEntry? entry = faces_branch.get_entry_for_face(face);
         if (entry != null)
             sidebar_tree.rename_entry_in_place(entry);
         else
-            assert_not_reached();
-            #endif
+            debug("No face found for rename");
     }
-#endif
     
     protected override void on_quit() {
         Config.Facade.get_instance().set_library_window_state(maximized, dimensions);
diff --git a/src/main.vala b/src/main.vala
index 66ae7f36..0e32633a 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -103,10 +103,8 @@ void library_exec(string[] mounts) {
             + EventTable.get_instance().get_row_count()
             + TagTable.get_instance().get_row_count()
             + VideoTable.get_instance().get_row_count()
-#if ENABLE_FACES               
             + FaceTable.get_instance().get_row_count()
             + FaceLocationTable.get_instance().get_row_count()
-#endif
             + Upgrades.get_instance().get_step_count();
         if (grand_total > 5000) {
             progress_dialog = new ProgressDialog(null, _("Loading Shotwell"));
@@ -146,14 +144,12 @@ void library_exec(string[] mounts) {
     if (aggregate_monitor != null)
         aggregate_monitor.next_step("Tag.init");
     Tag.init(monitor);
-#if ENABLE_FACES       
     if (aggregate_monitor != null)
         aggregate_monitor.next_step("FaceLocation.init");
     FaceLocation.init(monitor);
     if (aggregate_monitor != null)
         aggregate_monitor.next_step("Face.init");
     Face.init(monitor);
-#endif
     
     MetadataWriter.init();
     DesktopIntegration.init();
@@ -219,10 +215,8 @@ void library_exec(string[] mounts) {
     Tombstone.terminate();
     ThumbnailCache.terminate();
     Video.terminate();
-#if ENABLE_FACES       
     Face.terminate();
     FaceLocation.terminate();
-#endif
 
     Library.app_terminate();
 }
diff --git a/src/meson.build b/src/meson.build
index 3d63238b..ac6c3ce4 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -22,16 +22,14 @@ shotwell_libs = [sw_graphics_processor]
 face_sources = []
 face_obj = ''
 
-if get_option('face_detection')
-  face_sources = [
-    'faces/FacesBranch.vala',
-                     'faces/FacePage.vala',
-                     'faces/FaceShape.vala',
-                     'faces/FaceDetect.vala',
-                     'faces/Faces.vala',
-                     'faces/FacesTool.vala'
-                     ]
-endif
+face_sources = [
+  'faces/FacesBranch.vala',
+                    'faces/FacePage.vala',
+                    'faces/FaceShape.vala',
+                    'faces/FaceDetect.vala',
+                    'faces/Faces.vala',
+                    'faces/FacesTool.vala'
+                    ]
 
 shotwell_deps = [gio, gee, sqlite, gtk, sqlite, posix, gphoto2,
                  gstreamer_pbu, gio_unix, gudev, gexiv2, gmodule,
diff --git a/src/searches/SavedSearchDialog.vala b/src/searches/SavedSearchDialog.vala
index a3e1c54e..247b0ce9 100644
--- a/src/searches/SavedSearchDialog.vala
+++ b/src/searches/SavedSearchDialog.vala
@@ -78,9 +78,7 @@ public class SavedSearchDialog : Gtk.Dialog {
                 case SearchCondition.SearchType.ANY_TEXT:
                 case SearchCondition.SearchType.EVENT_NAME:
                 case SearchCondition.SearchType.FILE_NAME:
-#if ENABLE_FACES
                 case SearchCondition.SearchType.FACE:
-#endif
                 case SearchCondition.SearchType.TAG:
                 case SearchCondition.SearchType.COMMENT:
                 case SearchCondition.SearchType.TITLE:
diff --git a/src/searches/SearchBoolean.vala b/src/searches/SearchBoolean.vala
index 2be83020..7a9f9cb0 100644
--- a/src/searches/SearchBoolean.vala
+++ b/src/searches/SearchBoolean.vala
@@ -52,9 +52,7 @@ public abstract class SearchCondition {
         TAG,
         EVENT_NAME,
         FILE_NAME,
-#if ENABLE_FACES   
         FACE,
-#endif
         MEDIA_TYPE,
         FLAG_STATE,
         MODIFIED_STATE,
@@ -65,9 +63,7 @@ public abstract class SearchCondition {
         
         public static SearchType[] as_array() {
             return { ANY_TEXT, TITLE, TAG, COMMENT, EVENT_NAME, FILE_NAME, 
-#if ENABLE_FACES   
             FACE, 
-#endif
             MEDIA_TYPE, FLAG_STATE, MODIFIED_STATE, RATING, DATE };
         }
         
@@ -98,10 +94,10 @@ public abstract class SearchCondition {
                 
                 case SearchType.FILE_NAME:
                     return "FILE_NAME";
-#if ENABLE_FACES                   
+
                 case SearchType.FACE:
                     return "FACE";
-#endif                
+
                 case SearchType.MEDIA_TYPE:
                     return "MEDIA_TYPE";
                 
@@ -140,10 +136,10 @@ public abstract class SearchCondition {
             
             else if (str == "FILE_NAME")
                 return SearchType.FILE_NAME;
-#if ENABLE_FACES               
+              
             else if (str == "FACE")
                 return SearchType.FACE;
-#endif            
+
             else if (str == "MEDIA_TYPE")
                 return SearchType.MEDIA_TYPE;
             
@@ -182,10 +178,10 @@ public abstract class SearchCondition {
                 
                 case SearchType.FILE_NAME:
                     return _("File name");
-#if ENABLE_FACES                   
+                 
                 case SearchType.FACE:
                     return _("Face");
-#endif                
+
                 case SearchType.MEDIA_TYPE:
                     return _("Media type");
                 
@@ -361,7 +357,6 @@ public class SearchConditionText : SearchCondition {
             ret |= string_match(text, String.remove_diacritics(source.get_basename().down()));
         }
 
-#if ENABLE_FACES
         if (SearchType.ANY_TEXT == search_type || SearchType.FACE == search_type) {
             Gee.List<Face>? face_list = Face.global.fetch_for_source(source);
             if (null != face_list) {
@@ -372,7 +367,6 @@ public class SearchConditionText : SearchCondition {
                 ret |= string_match(text, null); // for IS_NOT_SET
             }
         }
-#endif
 
         return (context == Context.DOES_NOT_CONTAIN) ? !ret : ret;
     }
diff --git a/src/util/ui.vala b/src/util/ui.vala
index b663d35a..840611a8 100644
--- a/src/util/ui.vala
+++ b/src/util/ui.vala
@@ -100,7 +100,6 @@ public bool has_only_key_modifier(Gdk.ModifierType field, Gdk.ModifierType mask)
         | Gdk.ModifierType.META_MASK)) == mask;
 }
 
-#if ENABLE_FACES
 bool is_pointer_over(Gtk.Window window) {
     #if 0
     var seat = window.get_display().get_default_seat();
@@ -117,5 +116,4 @@ bool is_pointer_over(Gtk.Window window) {
     #endif
     return false;
 }
-#endif
 
diff --git a/subprojects/shotwell-facedetect/facedetect-opencv.cpp 
b/subprojects/shotwell-facedetect/facedetect-opencv.cpp
index f844ac56..4a1845a3 100644
--- a/subprojects/shotwell-facedetect/facedetect-opencv.cpp
+++ b/subprojects/shotwell-facedetect/facedetect-opencv.cpp
@@ -14,11 +14,13 @@ std::vector<FaceRect> detectFaces(cv::String inputName, cv::String cascadeName,
 
        if (inputName.empty()) {
         std::cout << "error;You must specify the file to process." << std::endl;
+        return {};
        }
 
     cv::Mat img = cv::imread(inputName, 1);
        if (img.empty()) {
         std::cout << "error;Could not load the file to process. Filename: \"" << inputName << "\"" << 
std::endl;
+        return {};
        }
 
     std::vector<cv::Rect> faces;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]