Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] doc/filters/find_rect: extend documentation
@ 2023-03-26 19:22 Stefano Sabatini
  2023-03-26 19:34 ` Stefano Sabatini
  0 siblings, 1 reply; 4+ messages in thread
From: Stefano Sabatini @ 2023-03-26 19:22 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Stefano Sabatini

Document metadata entries set by the filter, extend and clarify
options, add additional example showing how to extract the generated
data.

Fix issue:
http://trac.ffmpeg.org/ticket/8766
---
 doc/filters.texi | 41 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 1980fa6888..11406cb076 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -13768,7 +13768,29 @@ value.
 
 @section find_rect
 
-Find a rectangular object
+Find a rectangular object in the input video.
+
+The object to search for must be specified as a gray8 image specified with the
+@option{object} option.
+
+If the input video contains multiple instances of the object, the filter will
+find only one of them.
+
+When an object is found, the following metadata entries are set in the matching
+frame:
+@table @option
+@item lavfi.rect.w
+width of object
+
+@item lavfi.rect.h
+height of object
+
+@item lavfi.rect.x
+x position of object
+
+@item lavfi.rect.y
+y position of object
+@end table
 
 It accepts the following options:
 
@@ -13777,7 +13799,12 @@ It accepts the following options:
 Filepath of the object image, needs to be in gray8.
 
 @item threshold
-Detection threshold, default is 0.5.
+Detection threshold, expressed as a decimal number in the range 0-1.
+
+A threshold value of 0.01 means only exact matches, a threshold of 0.99 means
+almost everything matches.
+
+Default value is 0.5.
 
 @item mipmaps
 Number of mipmaps, default is 3.
@@ -13797,6 +13824,16 @@ Cover a rectangular object by the supplied image of a given video using @command
 @example
 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
 @end example
+
+@item
+Find the position of an object in each frame using @command{ffprobe} and write
+it to a log file:
+@example
+ffprobe -f lavfi movie=test.mp4,find_rect=object=object.pgm:threshold=0.3 \
+  -show_entries frame=pkt_pts_time:frame_tags=lavfi.rect.x,lavfi.rect.y \
+  -of csv -o find_rect.csv
+@end example
+
 @end itemize
 
 @section floodfill
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] doc/filters/find_rect: extend documentation
  2023-03-26 19:22 [FFmpeg-devel] [PATCH] doc/filters/find_rect: extend documentation Stefano Sabatini
@ 2023-03-26 19:34 ` Stefano Sabatini
  2023-04-01 23:47   ` Stefano Sabatini
  0 siblings, 1 reply; 4+ messages in thread
From: Stefano Sabatini @ 2023-03-26 19:34 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

On date Sunday 2023-03-26 21:22:44 +0200, Stefano Sabatini wrote:
> Document metadata entries set by the filter, extend and clarify
> options, add additional example showing how to extract the generated
> data.
> 
> Fix issue:
> http://trac.ffmpeg.org/ticket/8766
> ---
>  doc/filters.texi | 41 +++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 39 insertions(+), 2 deletions(-)

Up with more details about the score.

[-- Attachment #2: 0001-doc-filters-find_rect-extend-documentation.patch --]
[-- Type: text/x-diff, Size: 2514 bytes --]

From 9f6b66f4bb0caa07f97685f4ebddf21ec212386d Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <stefasab@gmail.com>
Date: Sun, 26 Mar 2023 21:21:50 +0200
Subject: [PATCH] doc/filters/find_rect: extend documentation

Document metadata entries set by the filter, extend and clarify
options, add additional example showing how to extract the generated
data.

Address issue:
http://trac.ffmpeg.org/ticket/8766
---
 doc/filters.texi | 47 +++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 1980fa6888..7efb201819 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -13768,7 +13768,35 @@ value.
 
 @section find_rect
 
-Find a rectangular object
+Find a rectangular object in the input video.
+
+The object to search for must be specified as a gray8 image specified with the
+@option{object} option.
+
+For each possible match, a score is computed. If the score reaches the specified
+threshold, the object is considered found.
+
+If the input video contains multiple instances of the object, the filter will
+find only one of them.
+
+When an object is found, the following metadata entries are set in the matching
+frame:
+@table @option
+@item lavfi.rect.w
+width of object
+
+@item lavfi.rect.h
+height of object
+
+@item lavfi.rect.x
+x position of object
+
+@item lavfi.rect.y
+y position of object
+
+@item lavfi.rect.score
+match score of the found object
+@end table
 
 It accepts the following options:
 
@@ -13777,7 +13805,12 @@ It accepts the following options:
 Filepath of the object image, needs to be in gray8.
 
 @item threshold
-Detection threshold, default is 0.5.
+Detection threshold, expressed as a decimal number in the range 0-1.
+
+A threshold value of 0.01 means only exact matches, a threshold of 0.99 means
+almost everything matches.
+
+Default value is 0.5.
 
 @item mipmaps
 Number of mipmaps, default is 3.
@@ -13797,6 +13830,16 @@ Cover a rectangular object by the supplied image of a given video using @command
 @example
 ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
 @end example
+
+@item
+Find the position of an object in each frame using @command{ffprobe} and write
+it to a log file:
+@example
+ffprobe -f lavfi movie=test.mp4,find_rect=object=object.pgm:threshold=0.3 \
+  -show_entries frame=pkt_pts_time:frame_tags=lavfi.rect.x,lavfi.rect.y \
+  -of csv -o find_rect.csv
+@end example
+
 @end itemize
 
 @section floodfill
-- 
2.25.1


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] doc/filters/find_rect: extend documentation
  2023-03-26 19:34 ` Stefano Sabatini
@ 2023-04-01 23:47   ` Stefano Sabatini
  2023-04-02 15:13     ` Stefano Sabatini
  0 siblings, 1 reply; 4+ messages in thread
From: Stefano Sabatini @ 2023-04-01 23:47 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On date Sunday 2023-03-26 21:34:20 +0200, Stefano Sabatini wrote:
> On date Sunday 2023-03-26 21:22:44 +0200, Stefano Sabatini wrote:
> > Document metadata entries set by the filter, extend and clarify
> > options, add additional example showing how to extract the generated
> > data.
> > 
> > Fix issue:
> > http://trac.ffmpeg.org/ticket/8766
> > ---
> >  doc/filters.texi | 41 +++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 39 insertions(+), 2 deletions(-)
> 
> Up with more details about the score.

> From 9f6b66f4bb0caa07f97685f4ebddf21ec212386d Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab@gmail.com>
> Date: Sun, 26 Mar 2023 21:21:50 +0200
> Subject: [PATCH] doc/filters/find_rect: extend documentation
> 
> Document metadata entries set by the filter, extend and clarify
> options, add additional example showing how to extract the generated
> data.
> 
> Address issue:
> http://trac.ffmpeg.org/ticket/8766
> ---
>  doc/filters.texi | 47 +++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 45 insertions(+), 2 deletions(-)

Will apply tomorrow if I see no comments.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] doc/filters/find_rect: extend documentation
  2023-04-01 23:47   ` Stefano Sabatini
@ 2023-04-02 15:13     ` Stefano Sabatini
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Sabatini @ 2023-04-02 15:13 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On date Sunday 2023-04-02 01:47:15 +0200, Stefano Sabatini wrote:
> On date Sunday 2023-03-26 21:34:20 +0200, Stefano Sabatini wrote:
> > On date Sunday 2023-03-26 21:22:44 +0200, Stefano Sabatini wrote:
> > > Document metadata entries set by the filter, extend and clarify
> > > options, add additional example showing how to extract the generated
> > > data.
> > > 
> > > Fix issue:
> > > http://trac.ffmpeg.org/ticket/8766
> > > ---
> > >  doc/filters.texi | 41 +++++++++++++++++++++++++++++++++++++++--
> > >  1 file changed, 39 insertions(+), 2 deletions(-)
> > 
> > Up with more details about the score.
> 
> > From 9f6b66f4bb0caa07f97685f4ebddf21ec212386d Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefasab@gmail.com>
> > Date: Sun, 26 Mar 2023 21:21:50 +0200
> > Subject: [PATCH] doc/filters/find_rect: extend documentation
> > 
> > Document metadata entries set by the filter, extend and clarify
> > options, add additional example showing how to extract the generated
> > data.
> > 
> > Address issue:
> > http://trac.ffmpeg.org/ticket/8766
> > ---
> >  doc/filters.texi | 47 +++++++++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 45 insertions(+), 2 deletions(-)
> 
> Will apply tomorrow if I see no comments.

Applied.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-02 15:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-26 19:22 [FFmpeg-devel] [PATCH] doc/filters/find_rect: extend documentation Stefano Sabatini
2023-03-26 19:34 ` Stefano Sabatini
2023-04-01 23:47   ` Stefano Sabatini
2023-04-02 15:13     ` Stefano Sabatini

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git