Commit Graph

8199 Commits

Author SHA1 Message Date
pfeatherstone eccb9675ff
[FFmpeg] added save_frame() and improved picking of codecs when not specified (#2800)
* WIP

* - pick best codec
- added save_frame()
- fixed example

* Add missing variable declaration

* added extensions
fixed tests

* attempt to set quality as high as possible. lower expected PSNR

* arrufat suggestion

* refactoring

---------

Co-authored-by: Your name <you@example.com>
Co-authored-by: pf <pf@me>
Co-authored-by: Adrià Arrufat <1671644+arrufat@users.noreply.github.com>
2023-05-24 07:46:30 -04:00
Adrià Arrufat b86871241b
Remove unneeded using namespace std (#2799) 2023-05-18 23:02:46 -04:00
pfeatherstone 5b9ab23cc0
[FFmpeg] added push(image_type) methods to encoder and muxer (#2797)
* added push() methods

* Update dlib/media/ffmpeg_muxer.h

* Update dlib/media/ffmpeg_muxer.h

---------

Co-authored-by: pf <pf@me>
Co-authored-by: Davis E. King <davis685@gmail.com>
2023-05-18 08:11:49 -04:00
pfeatherstone dab9aa1fa5
missing include (#2798)
Co-authored-by: pf <pf@me>
2023-05-18 08:03:15 -04:00
Juha Reunanen b6418e349e
Problem: CUDA error having `code: 716, reason: misaligned address` (#2796)
Why does this happen: `float` data should be aligned to 4 bytes [1], but this is not guaranteed when the truth data is `uint16_t` and is in the buffer before the weights data

Solution: re-arrange the buffer so that the weights data (type `float`) comes before the truth data (type `uint16_t`), essentially making it so that the `float` data is correctly aligned to 4 bytes

[1] https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#device-memory-accesses
2023-05-16 08:03:58 -04:00
pfeatherstone decdef12f5
[FFmpeg] decoding and demuxing improvements (#2784)
* typo

* - added compile time information to audio object. Not convinced this is needed actually. I'm perfectly happy just using the ffmpeg::frame object. I'm pretty sure I'm the only user who cares about audio.
- created resizing_args and resampling_args

* smaller videos for unit tests

* shorter videos for unit tests

* - decoder and demuxer: you now resize or resample at the time of read. therefore you don't set resizing or resampling parameters in constructor, but you pass them to read()
- added templated read() function
- simplified load_frame()

* inherit from resizing_args and resampling_args

* reorganised the tests to segragate decoding, demuxing, encoding and muxing as much as possible

* much more basic example

* demxing examples split

* examples

* fixing examples

* wip

* Fix load_frame()

* added frame - specific tests

* - makes sense to have a set_params() method rather than constructing a new object and moving. I mean, it works and it absolutely does the right thing, and in fact the same thing as calling set_params() now, but it can look a bit weird.

* notes on defaults and good pairings

* Update ffmpeg_demuxer.h

Watch out for `DLIB_ASSERT` statements. Maybe one of the unit tests should build with asserts enabled.

* Update ffmpeg_details.h

* Update ffmpeg_muxer.h

* WIP

* WIP

* - simplified details::resizer
- added frame::set_params()
- added frame::clear()
- forward packet directly into correct queue

* pick best codec if not specified

* added image data

* warn when we're choosing an appropriate codec

* test load_frame()

* - for some reason, you sometimes get warning messages about too many b-frames. Resetting pict_type suppresses this.
- you can move freshly decoded frames directly out.

* callback passed to push()

* I think it's prettier this way

* WIP

* full callback API for decoder

* updated tests

* updated example

* check the template parameter is callable and has 1 argument first before getting it's first argument

* Potential bug fix

* - write out the enable_if's explictly. It's fine. I think it's clear what's going on if someone cares
- guard push() with a boolean which asserts when recursion is detected

* pre-conditions on callbacks: no recursion

---------

Co-authored-by: pf <pf@me>
Co-authored-by: Your name <you@example.com>
2023-05-15 21:24:47 -04:00
Davis King adf8a3573e put patch level back to 99 2023-05-14 09:11:31 -04:00
Davis King 39749fba51 tag v19.24.2 2023-05-14 09:06:12 -04:00
Charles Galambos e2a0c3dfca
std::chrono::system_time on osx isn't in nanoseconds (#2795)
* Allow the scan parameters to be changed in a detector.

* Fix warning.

* Fix for clang on osx which std::chrono::system_time has a duration in microseconds not nanoseconds. ^

* Revert "Allow the scan parameters to be changed in a detector."

This reverts commit 2a5760aacf.

* Fix second instance.

* Static not needed when inline.

---------

Co-authored-by: Charles Galambos <charles@reactai.com>
Co-authored-by: Davis E. King <davis685@gmail.com>
2023-05-09 10:39:05 -04:00
pfeatherstone 775ac0799f
- moved is_detected in type_traits.h (#2794)
- fixed callable_traits
- added tests

Co-authored-by: pf <pf@me>
2023-05-08 22:39:15 -04:00
pfeatherstone 191d280d64
[Meta] added callable traits (#2790)
* added callable traits

* tests

* use compiler intrinsic if possible

* workaround for gcc < 7.5

* - added nargs
- bug fix - use std::decay_t
- added more tests.
- one of the unit tests show cases why this is cool

* docs

* more docs

* Update dlib/type_traits.h

* Update dlib/type_traits.h

---------

Co-authored-by: pf <pf@me>
Co-authored-by: Davis E. King <davis685@gmail.com>
2023-05-06 19:53:46 -04:00
pfeatherstone ff331517b9
[FFT] split FFT API into different layers (#2793)
* fft refactoring

* separate header for STL overloads

* ditto

---------

Co-authored-by: pf <pf@me>
2023-05-06 11:43:10 -04:00
Adrià Arrufat 48fdace271
Use dpoint instead of dlib::vector<double, 2> (#2782) 2023-04-22 09:19:58 -04:00
pfeatherstone 74a55fb5c9
FFMPEG : inline docs (#2778) 2023-04-22 07:51:42 -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
pfeatherstone d41571ea5a
10X speedup (#2779)
Co-authored-by: pf <pf@me>
2023-04-21 23:37:19 -04:00
Adrià Arrufat 49ac2eb3ae
Add draw solid polygon (#2775)
* Add initial version of a generic draw_solid_polygon

* Use image view to be truly generic

* Improve draw_solid_convex_polygon when antialias is disabled

* Remove unused parameter and fix documentation

* Use rectangle methods

* Remove redundant check

* Remove unused variable

* Update dlib/image_transforms/draw.h

---------

Co-authored-by: Davis E. King <davis685@gmail.com>
2023-04-21 23:36:02 -04:00
pfeatherstone 53c4be9026
FFmpeg : logging (#2774)
* added a couple more audio examples

* logging DONE

* bug fix on certain compilers

* use a C-style stack allocated array. This reduces heap allocations

* reduce stack string size. replace '\n' rather than remove

* - register_ffmpeg() doesn't need to return anything
- refactored loggers
- added verbose option

* bug fix

* unused variable warning

* Update docs

* Update docs

---------

Co-authored-by: pf <pf@me>
Co-authored-by: Adrià Arrufat <1671644+arrufat@users.noreply.github.com>
2023-04-19 08:32:19 -04:00
pfeatherstone 5f7026ab52
FFmpeg : improvements to ffmpeg::list() functions (#2773)
* added a couple more audio examples

* statically initialize all list_() functions where possible.

---------

Co-authored-by: pf <pf@me>
2023-04-15 09:28:38 -04:00
Adrià Arrufat b1fe026e06
Add ffmpeg load_frame (#2770)
* Add ffmpeg::load_frame

* Add ffmpeg::save_frame

* Check for supported encoders

* Add documentation

* Add pfeatherstone suggestions and enable only for RGB images

* Remove the pixel format setting, as it is not needed

* Fix formatting in error message

* Set pixel format in ffmpeg::save_frame

* Fix formatting

* Remove ffmpeg::save_frame
2023-04-14 08:18:25 -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
pfeatherstone 89fc01beb5
FFmpeg : examples (#2764)
* added a couple more audio examples

* Test for ODR violations and include config.h

* Test for ODR violations

---------

Co-authored-by: pf <pf@me>
2023-04-12 22:47:58 -04:00
Adrià Arrufat 20c6364bb5
Silence warning about unused variable (#2765)
* Removed unused variable

I was getting a warning about this.

* Silence unused variable otherwise
2023-04-12 22:40:54 -04:00
Adrià Arrufat 252d76f356
Fix outdated comment in self supervised learning example (#2768) 2023-04-12 22:33:34 -04:00
pfeatherstone 9148a47c7e
RTSP example (#2763) 2023-04-09 10:34:31 -04:00
pfeatherstone 7155daeeea
FFmpeg : muxing (#2755)
* muxing

* Add HSV support (#2758)

* Add HSV support

* Add tests

* Update dlib/pixel.h

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

* Add HSV struct and make more things const

---------

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

* Fix imglab changing the current dir too soon (#2761)

* A bit of cleanup

---------

Co-authored-by: pf <pf@me>
Co-authored-by: Adrià Arrufat <1671644+arrufat@users.noreply.github.com>
Co-authored-by: Davis E. King <davis685@gmail.com>
Co-authored-by: Davis King <davis@dlib.net>
2023-04-08 14:45:30 -04:00
Adrià Arrufat 004b2fe6fe
Fix imglab changing the current dir too soon (#2761) 2023-04-07 08:08:27 -04:00
Adrià Arrufat 4224951c38
Add HSV support (#2758)
* Add HSV support

* Add tests

* Update dlib/pixel.h

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

* Add HSV struct and make more things const

---------

Co-authored-by: Davis E. King <davis685@gmail.com>
2023-04-05 09:03:12 -04:00
Davis E. King 6893653428
Ubuntu 18.04 Actions runner image is deprecated, use newer image (#2759)
* Ubuntu 18.04 Actions runner image is deprecated, use newer image

See https://github.blog/changelog/2022-08-09-github-actions-the-ubuntu-18-04-actions-runner-image-is-being-deprecated-and-will-be-removed-by-12-1-22/

* make it really use gcc 7
2023-04-04 08:59:27 -04:00
pfeatherstone 937e07e90d
FFmpeg : encoding (#2754)
* docs

* callbacks for encoder

* shorter video

* shorter video

* added is_byte type trait

* leave muxer for next PR

* added overloads for set_layout() and get_layout() in details namespace

* unit test

* example

* build

* overloads for ffmpeg < 5

* Update examples/ffmpeg_video_encoding_ex.cpp

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

* Update dlib/media/ffmpeg_abstract.h

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

* Update dlib/media/ffmpeg_abstract.h

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

* Update dlib/media/ffmpeg_abstract.h

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

* Update dlib/media/ffmpeg_abstract.h

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

* Update dlib/media/ffmpeg_abstract.h

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

* as per suggestion

* remove requires clause

* Update examples/ffmpeg_video_encoding_ex.cpp

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

* Update dlib/media/ffmpeg_abstract.h

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

* Update dlib/media/ffmpeg_abstract.h

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

* Update dlib/media/ffmpeg_abstract.h

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

* Update dlib/media/ffmpeg_muxer.h

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

* use dlib::logger

* oops

* Update dlib/media/ffmpeg_muxer.h

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

* Update dlib/media/ffmpeg_demuxer.h

* Update dlib/media/ffmpeg_demuxer.h

* Update dlib/media/ffmpeg_abstract.h

---------

Co-authored-by: pf <pf@me>
Co-authored-by: Davis E. King <davis685@gmail.com>
Co-authored-by: Adrià Arrufat <1671644+arrufat@users.noreply.github.com>
2023-04-01 09:48:26 -04:00
pfeatherstone f586d0a552
FFMPEG : misc + ffmpeg5 support (#2746)
* - enhanced list_muxers()
- added fail() error handling helper function
- moved framerate setting to decoder_image_args

* docs

* oops

* - don't use std::endl, use `\n` instead
- use fail(). See, on average, it removes lines of code

* convenient constructor for demuxer

* ffmpeg5 support

* added docs for == -1

* oops

* grouping audio channel compatibility stuff together

* more compatibility stuff

* more channel abstractions

* build with ffmpeg 5

* install assembler

* cache the installation

* cmake doesn't like using ~ in filepath

* at some point this will work

* i think i need to change the key

* test FFmpeg-n5.1.3_try3 cache

* bug fix

* Update build_cpp.yml

Giving this another go

* Update build_cpp.yml

Disable building documentation and CLI tools

* Update CMakeLists.txt

Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included

* - use environment variables
- on ubuntu 18 gcc7, use ffmpeg 3.2.18

* correct way of dereferencing variables ?

* can't get variables to work

* Revert "can't get variables to work"

This reverts commit 5eef96a43e.

* Revert "correct way of dereferencing variables ?"

This reverts commit e8ff95f5c6.

* Revert "- use environment variables"

This reverts commit a6938333d5.

* using ffmpeg 3.2.18 with ubuntu18 gcc7

* Update build_cpp.yml

Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable

* Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled

* Fixed bad indentation

* Can go in details namespace

* Update dlib/CMakeLists.txt

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

* use details namespace

* remove declaration. It's in details now

* don't need get_channels_from_layout()

---------

Co-authored-by: pf <pf@me>
Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-29 22:12:47 -04:00
Adrià Arrufat 4ffa9b02a5
Add simple polygon class (#2750)
* Add simple polygon class

* Add documentation for fill_convex_polygon

* Rename alpha_blend to antialias

* Update dlib/geometry/polygon_abstract.h

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

* Update dlib/geometry/polygon_abstract.h

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

* Update dlib/geometry/polygon_abstract.h

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

* Update dlib/geometry/polygon_abstract.h

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

* Update dlib/geometry/polygon_abstract.h

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

* Update dlib/geometry/polygon.h

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

* Update documentation for get_convex_shape

* Add tests for the polygon class

* Remove new line

---------

Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-26 21:05:43 -04:00
Davis E. King 9a13229970
Exercise more of the ways dlib can be configured in the github actions tests (#2751) 2023-03-25 22:52:41 -04:00
Davis King 049c59d0f6 set correct cmake version in check 2023-03-25 15:56:54 -04:00
Davis E. King 53d2ceb669
test with cmake 3.8 since that's the min required cmake version for dlib (#2748)
* test with cmake 3.8 since that's the min required cmake version for dlib
2023-03-24 22:25:40 -04:00
Davis King 91dcb04055 fix ffmpeg cmake scripts not working with cmake 3.8 2023-03-23 23:44:43 -04:00
Erin 4d5db9940f
Fix crash when libX11 is missing locale support (#2747) 2023-03-23 21:45:30 -04:00
Davis King 806b629035 Make everything work in cmake 3.8 2023-03-23 20:07:48 -04:00
Davis King b7834324b4 update sphinx config to work with newer versions of python 2023-03-22 22:11:20 -04:00
Davis King 15b2851318 improve docs 2023-03-22 22:02:30 -04:00
Davis King 32ab332989 cleanup docs 2023-03-18 08:28:13 -04:00
Lakshan Rukantha 9d305943bc
removed extra lines in the MANIFEST.in (#2744) 2023-03-17 08:08:18 -04:00
Adrià Arrufat f89b0388d5
Add optional Python version (#2743) 2023-03-14 20:05:18 -04:00
Davis E. King 93aea6ea9b
Update bug.yml
Make the steps to reproduce required.
2023-03-12 10:13:18 -04:00
Adrià Arrufat 310a37f452
Improve issue template (#2741)
* Create but report template

* Update bug.yml

* Update bug.yml

* Update bug.yml

* Update bug.yml

* Update bug.yml

* Update bug.yml

* Update bug.yml

* Update bug.yml

* Update bug.yml

* Update bug.yml

* Update bug.yml

* Update bug.yml

* Update bug.yml

* Create feature request template

* Update feature.yml

* Update feature.yml

* Update feature.yml

* Remove ISSUE_TEMPLATE

* Create config.yml
2023-03-12 10:07:55 -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
Michal Suchánek 398e2cb5be
powerpc/altivec: use __vector instead of vector (#2740)
The gcc altivec extension defines keywords for vector, bool, and pixel,
both with underscores and without. However, unless another extension is
used the keywords without underscores conflict with standard types.

To resolve the conflict use the keywords with underscores for the
altivec vector types.

Fixes: #2711

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2023-03-11 08:16:15 -05:00
Davis King 257b81a172 update docs 2023-03-01 19:09:47 -05:00
smoosbau ddad576d3e
fix wrong union calculation in box_overlap_testing.h (#2735)
Co-authored-by: Moosbauer, Sebastian <sebastian.moosbauer@posteo.de>
2023-03-01 19:08:26 -05:00