Commit Graph

480 Commits

Author SHA1 Message Date
Adrià Arrufat
ca7fd9d1ad
Actually load rgb_alpha images. (#2942)
This should've been added in #2925.

The only doubt I have around the function name:

- `load_rgb_alpha_image`: following the `rgb_alpha_pixel` in dlib
- `load_rgba_image`: shorter and maybe nicer?
2024-04-03 19:26:02 -04:00
Adrià Arrufat
d5909ed977
allow reading and writing rgb-alpha images in Python (#2925) 2024-03-05 20:17:36 -05:00
Adrià Arrufat
9a30c6d48f
Add JXL support (#2917)
* WIP: preparation for JPEG XL support

* jxl: add loading support

* update jxl abstract

* add support for saving jxl (lossless not working)

* everything works except setting lossless explicitly

* remove unused header

* fix wrong quality logic

* remove debugging statements

* fix lossless encoding

* improve support for grayscale images

* use JXL instead of JPEGXL everywhere

* oops do not make libjxl a requirement

* update years

* silence some warnings

* simplify loader fast path logic

* allow python to save jxl and webp

* update error message with supported formats

* Allow setting image quality in Python

The setting is ignored where it does not make sense.

* round quality in JPEG saver

* improve error message in CMake

* add jxl support to imglab

* add Davis's suggestion

Co-authored-by: Davis E. King <davis685@gmail.com>

* Apply suggestions from code review

Co-authored-by: Davis E. King <davis685@gmail.com>

* make sure grayscale is 8 bit

* update abstract: JPEG XL can store grayscale images

* add more methods to query basic info from JXL

* documentation formatting

* Apply Davis' suggestions

---------

Co-authored-by: Davis E. King <davis685@gmail.com>
2024-03-04 07:56:31 -05:00
Adrià Arrufat
8fc180545c
Python: Add grayscale overloads to get_face_chip (#2820)
Closes #2736.
2023-07-10 08:25:58 -04:00
Adrià Arrufat
edc6645150
Add insert_image_chip (#2781)
* Add insert_image_chip to Python bindings

* Use interpolation

* remove commented code

* Add C++ implementation

* Fix compile error and improve variable namings

* Fix signed warning
2023-04-21 23:55:11 -04:00
Adrià Arrufat
c21c9c92b5
Update widgets and draw_string on images to use convert_to_utf32 (#2769)
* Remove convert_to_utf32 from imglab by updating widgets methods

* Use convert_to_utf32 in draw_string for images

* Add an overload of draw_string for string literals
2023-04-13 08:48:49 -04:00
Adrià Arrufat
07f7425170
Unify all conversions to UTF-32 (#2737)
* Improve UTF-8 support for draw_string

* Add ugly hack to make it work

* Unify all convert_utf8_to_utf32 implementations

* Rename convert_utf8_to_utf32 to convert_to_utf32

* Remove code related to GCC 4, since it's no longer supported

* Format is_combining_char according to dlib codestyle and remove pragmas

* Rename convert_utf8_to_utf32 to convert_to_utf32

* Complete the convert_to_utf32 function

* Fix build on untested OS

* Try to fix compilation in Windows

* Update docs and replace typedef with using

* Add back especialized conversions to UTF-32

* Add requires clause to convert_to_utf32

* Update dlib/unicode/unicode_abstract.h

---------

Co-authored-by: Davis E. King <davis685@gmail.com>
2023-04-12 23:08:00 -04:00
Adrià Arrufat
004b2fe6fe
Fix imglab changing the current dir too soon (#2761) 2023-04-07 08:08:27 -04:00
Davis King
15b2851318 improve docs 2023-03-22 22:02:30 -04:00
cchadowitz-pf
3c0b3620af
Added bottom_up_cluster to python api (#2739)
* Added bottom_up_cluster to python api

* Update tools/python/src/face_recognition.cpp

Co-authored-by: Adrià Arrufat <1671644+arrufat@users.noreply.github.com>

* Update tools/python/src/face_recognition.cpp

Co-authored-by: Adrià Arrufat <1671644+arrufat@users.noreply.github.com>

---------

Co-authored-by: Davis E. King <davis685@gmail.com>
Co-authored-by: Adrià Arrufat <1671644+arrufat@users.noreply.github.com>
2023-03-11 08:16:48 -05:00
Adrià Arrufat
eb5de0d534
Add support for loading custom label fonts in imglab (#2733) 2023-02-23 22:34:06 -05:00
Davis King
3d5fb6fc7f Add an informative comment 2022-11-08 21:50:19 -05:00
pfeatherstone
dd1ec1fcff
Miscellaneous cleanup and refresh (#2661)
* - moved for_each_in_tuple() to algs.h. Seems like a better place
- took the opportunity to deprecated the old type traits and make them aliases to things in the standard library

* - made bools() constexpr

* - removed ugly template recursion version of for_each_in_tuple(). Recursion is bad and is one of the reasons why buid times are so long.
- Use generic lambdas. Much better.

* - missing include

* - just make old deprecates stuff aliases to standard library things
- use switch_() for compile time branching. It's awesome. It means less code and less templates.

* - fixed make_compile_time_integer_range. Didn't realize it counted like Matlab. Very weird

* - nice example usage of switch_(). it will be trivially updated to if constexpr() in a couple years when dlib requires C++17

* - deduce return type
- use generic lambdas

* - for some reason these have to specify the return type. I don't understand. Will fix in a bit.

* - yet another template recursion removed. Better compile times in theory. Every little helps

* whoops

* use decay_t

* - type traits go in type_traits.h
- things found in <utility> go in utility.h
- algs.h doesn't contain any type traits. It just includes type_traits.h

* only need type_traits.h header

* use fold expressions if possible

* use is_any from type_traits.h

* - moved is_convertible to type_traits.h. Also make it an alias for std::is_convertible

* moved is_convertible

* use type traits in standard library

* - use standard library

* use standard library

* MSVC bug workaround

* missing dlib namespace

* fix typo

* - reverting back compile_time_integer_list and make_compile_time_integer_range

* - making sure nothing uses compile_time_integer_list or make_compile_time_integer_range

* - added pop_front for index_sequence
- making sure nothing uses compile_time_integer_list or make_compile_time_integer_range
- use auto

* - use integer_sequence

* - added docs for get_type_id(tag)

* - use __type_pack_element if available

* - hmm, reverting, some pre-processors break here. Don't know why.

Co-authored-by: pf <pf@me>
2022-09-19 08:18:39 -04:00
Adrià Arrufat
65bce59a15
Update Pybind11 to v2.10.0 (#2660)
* Update Pybind11 to v2.10.0

* Update numpy_image to work with latest Pybind11

* I don't know why I have to do this now...

* Try to make macOS use Python3... Really?

* Try to make macOS use Python3... Again

* Try to make macOS use Python3... Once more

* Install dependencies with pip3
2022-09-05 15:59:19 -04:00
Davis King
29288e5d89 Make C++14 and CMake 3.8.0 the new minimum required versions 2022-07-31 17:45:18 -04:00
Davis King
a517aaa0bb remove broken python tests 2022-07-12 19:51:19 -04:00
Davis King
0f1d8e964f Fix assert having wrong condition 2022-06-06 22:01:59 -04:00
Adrià Arrufat
8ceb91fb44
Do not build WebP features if WebP is not available (#2582) 2022-04-29 08:38:21 -04:00
Adrià Arrufat
a7ae55b785
Add WebP support to imglab (#2580)
* Add WebP support to imglab

* Change order in if/else statements for image saving
2022-04-28 20:06:33 -04:00
Ryan_Huang
7e942ba989
Update __init__.py.in (#2515) 2022-02-18 08:50:55 -05:00
Davis King
7c8ca22580 minor cleanup 2021-11-14 14:09:57 -05:00
Davis King
a77b361f89 Make test python builds nice 2021-11-14 14:05:47 -05:00
Addam Dominec
569de81464
expose momentum_filter to Python (#2457) 2021-11-14 13:34:00 -05:00
Adrià Arrufat
16500906b0
YOLO loss (#2376) 2021-07-29 20:05:54 -04:00
Akshay Naresh Modi
286ca71e1a
Release GIL before detecting faces (#2252)
* Allow the face detector to be run concurrently.

* Use img_view instead of numpy_image

Co-authored-by: Akshay Modi <amodi@netflix.com>
2020-12-13 14:57:41 -05:00
Adrià Arrufat
b6bf8aefee
Add support for matrix serialization to python API (#2241)
* Add support for matrix serialization to python API

* add double to function names
2020-11-21 17:09:06 -05:00
Frankie Robertson
d7644ef2b7
Expose get_face_chip_details to Python (#2238) 2020-11-21 17:07:28 -05:00
Davis King
0419b81689 Let python users give up to 35 parameters when using the global optimizer. 2020-09-25 07:41:57 -04:00
Davis King
8910445a7a fix some spelling and grammar errors 2020-08-07 15:41:42 -04:00
Davis King
71b303d883 Improve the error a user gets when trying to build the pyhton extention on windows but they didn't install visual C++. 2020-06-27 20:08:39 -04:00
Davis King
f8887d8cbb fix paths 2020-06-17 21:29:10 -04:00
Davis King
2a3cb83afc Make dlib/__init__.py know the paths to cuda that cmake used. Use those
paths instead of relying on CUDA_PATH to be set.
2020-06-17 20:17:10 -04:00
Davis King
7fe355e0ec Oops, put import statements after path adjustment 2020-06-07 16:59:40 -04:00
Davis King
7fcb6c285d Add an __init__.py file so we can add paths to CUDA libs on windows. 2020-06-07 16:42:44 -04:00
Davis King
3a53c78ad2 increment imglab version 2020-02-29 09:34:36 -05:00
Davis King
9a33669610 A little bit of cleanup and docs. Also added missing mutex lock. 2020-02-29 09:33:00 -05:00
martin
4ff365a530
imglab: chinese ("automatic") clustering, keyboard shortcuts for zooming (#2007)
* imglab: add support for using chinese whispers for more automatic clustering

* widgets: refactor out zooming from wheel handling

* tools/imglab/src/metadata_editor.cpp

imglab: add keyboard shortcuts for zooming
2020-02-29 09:31:28 -05:00
Hye Sung Jung
443021882c
fix spelling errors (#1985) 2020-01-28 21:02:41 -05:00
Mischan Toosarani-Hausberger
efd4e27488 dpoint mutates x-coord in y-property (see #1794) (#1866) 2019-08-24 11:13:00 -04:00
Davis King
48b9bf3f93 Fixed cmake warning 2019-07-19 07:12:27 -04:00
mchelem
5d64de24b3 Fix setting a point's y coordinate changes x instead (Python bindings) (#1795)
* Add point assignment test

* Fix setting points y coordinate changes x instead (issue #1794)
2019-06-08 06:08:45 -04:00
Davis King
6de82e2417 Added methods for getting keyboard and mouse clicks to image_window's pyhton API. 2019-06-01 09:29:43 -07:00
Davis King
2dd970a1fb Fixed compiler warnings 2019-04-14 11:19:06 -04:00
Davis King
ae406bf4c1 Make dlib.full_object_detection take list of dlib.point or dlib.points. 2019-03-19 08:13:49 -04:00
Davis King
a0dc35edb0 updated python docs 2019-03-18 21:38:45 -04:00
Kapil Sachdeva
f7f6f67618 Add python api that generates desciptor(s) from the aligned image(s) (#1667)
* Add python api that generates desciptor(s) from the aligned image(s)

* Remove asserts from face_recognition.py example/tutorial

* In batch_compute_face_descriptors_from_aligned_images, use for-in loop to simplify the code

Improvde the document on binding methods and the error message if the aligned image is not of size 150x150
2019-02-25 20:10:04 -05:00
Branko Kokanovic
41a87e5926 Exposing chinese_whispers directly, closes #1642 (#1644)
* Exposing chinese_whispers directly

* Addressing comments

* Changed description
* Added support for distance weights
* Added tests

* Improving test to check returned results
2019-02-07 06:59:04 -08:00
Miks Miķelsons
e73d3adc0e Add padding argument support for Python compute_face_descriptor methods (#1578) 2018-12-05 07:18:40 -05:00
Davis King
3e9d361f89 Minor changes to avoid bugs in some compilers. 2018-11-20 15:36:07 -05:00
Davis E. King
ba361d73ab
Avoid compiler bug 2018-11-09 09:40:18 -05:00