ImageContainsQ

ImageContainsQ[image,category]

returns True if an instance of the specified category is detected in image.

ImageContainsQ[image,{category1,category2,}]

returns True if at least one instance of each of the categoryi is detected in image.

ImageContainsQ[image,category1|category2|]

returns True if image contains an instance of at least one of categoryi.

Details and Options

  • ImageContainsQ tries to find subimages of image that may be an instance of a given category.
  • Possible forms for category include:
  • "concept"named concept, as used in "Concept" entities
    "word"English word, as used in WordData
    wordspecword sense specification, as used in WordData
    Entity[]any appropriate entity
    category1|category2|any of the categoryi
  • The following options can be given:
  • AcceptanceThresholdAutomaticidentification acceptance threshold
    MaxOverlapFractionAutomaticmaximum bounding box overlap
    TargetDevice"CPU"the target device on which to compute
  • ImageContainsQ uses machine learning, and its training set and methods may change in different versions of the Wolfram Language, yielding different results.
  • ImageContainsQ may download resources that will be stored in your local object store at $LocalBase, and can be listed using LocalObjects[] and removed using ResourceRemove.

Examples

open all close all

Basic Examples  (2)

Check whether an image contains a specific category of objects:

In[1]:=
Click for copyable input

This image contains at least a bird:

In[2]:=
Click for copyable input
Out[2]=

The image does not contain dogs:

In[3]:=
Click for copyable input
Out[3]=

Test for the simultaneous presence of multiple categories:

In[1]:=
Click for copyable input
Out[1]=

Scope  (3)

Options  (2)

Introduced in 2019
(12.0)