31
1 Take the difference between a reference image and a subsequent image to determine the still elements image components. Use of Motion In Segmentation

Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

1

Take the difference between a reference image and a subsequent image to determine the still elements image components.

Use of Motion In Segmentation

Page 2: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

Motion detection and estimation

2

Page 3: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

Motion detection and estimation

•  A video sequence is a much richer source of visual information than a still image. –  This is primarily due to the capture of motion; while a single image

provides a snapshot of a scene, a sequence of images registers the dynamics in it.

–  The registered motion is a very strong cue for human vision; we can easily recognize objects as soon as they move even if they are inconspicuous when still.

•  Main applications –  Video analysis (through feature extraction) –  Video compression and coding (MPEG4) –  Investigation of the dynamics of human organs

3

Page 4: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

Why is it important?

•  First, motion carries a lot of information about spatiotemporal relationships between image objects. This information can be used in such applications as traffic monitoring or security surveillance, for example to identify objects entering or leaving the scene or objects that just moved.

•  Secondly, image properties, such as intensity or color, have a very high correlation in the direction of motion, i.e., they do not change significantly when tracked in the image (the color of a car does not change as the car moves across the image). This can be used for the removal of temporal video redundancy;

4

Page 5: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

Example: Left ventricle dynamics from US

5

Page 6: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

Basic operations

•  Motion detection: do the points (or objects) move?

•  Motion estimation: how do they move?

•  Special case: apparent motion –  One object displayed at different positions in different time instants is

perceived as a moving object

6

Page 7: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

7

Page 8: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

8

Motion based segmentation

•  Motion segmentation, i.e., the identification of groups of image points moving similarly

•  Concept: detect the changes from one image to the next

•  Possible approaches –  Taking image differences –  Block matching –  Optical flow

Page 9: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

Notions and preliminaries

•  Let x = (x, y)T be a spatial position of a pixel in continuous coordinates, i.e., x is in R2 within image limits, and let It denote image intensity at time t

•  After sampling, x is discrete and lives in Z2

•  Let v(x,y) be the velocity at the spatial position (x,y). Then, vt will denote a velocity field or motion field, i.e., the set of all velocity vectors within the image, at time t

•  For discrete images, the notion of velocity is replaced by displacement d, but the meaning is unchanged since d represents the displacement of pixel (x,y) between two time instants t1 and t2 thus it is representative of its “velocity”

9

Page 10: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

Displacement / velocity

10

P x + dx, y+ dy( )t+Δt = P x, y( )t

d

dx

dy t

t+dt

x

y

Page 11: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

Motion estimation

•  Pixel differences (difference image)

•  Optical flow

•  Block matching

11

Page 12: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

12

Difference images

•  Difference image between two images taken at time points ti and tj

–  dij=1 only if the difference between the pixel values in the two images are above a given threshold T

–  dij has the same size as the two images

•  Drawbacks –  Sensitivity to noise

•  Accumulation strategies can be devised –  Only allows to detect motion but not to characterize it

•  This would require establishing correspondences among pixels to calculate motion vectors

Page 13: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

13

)1( +tI

What is Optical Flow?

Optical Flow

}{),( iptI

1p

2p3p

4p

1v

2v

3v

4v

}{ iv

Velocity vectors

Common assumption: The appearance of the image patches do not change (brightness constancy)

)1,(),( ++= tvpItpI iii

Optical flow: 2D projection of the physical movement of points relative to the observer to 2D displacement of pixel patches on the image plane.

Page 14: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

When does it fail?

•  Illusory motion: the set is stationary yet things seem to move

•  A uniform rotating sphere: nothing seems to move, yet it is rotating

•  Changing directions or intensities of lighting can make things seem to move –  for example, if the specular highlight on a rotating sphere moves.

•  And infinitely more break downs of optical flow.

102

Page 15: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

OF Assumptions: Brightness Constancy

15

Page 16: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

OF Assumptions

16

Page 17: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

OF Assumptions

Page 18: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

1D case

f (x(t)) ≡ I(x(t), t) = I(x(t + dt), t + dt)

Brightness Constancy Assumption:

0)(

=∂∂

+⎟⎠

⎞⎜⎝

⎛∂∂

∂∂

txt tI

tx

xI

Ix v It

⇒ v = − ItIx

0)(=

∂∂txf

No changes in brightness in time

Page 19: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

v ?

Tracking in the 1D case

x

),( txI )1,( +txI

p

Page 20: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

v

xI

Spatial derivative

Temporal derivative tI

Tracking in the 1D case

x

),( txI )1,( +txI

p

tx x

II∂∂

=px

t tII

=∂∂

=x

t

IIv −≈

Assumptions: •  Brightness constancy •  Small motion

Page 21: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

Tracking in the 1D case

x

),( txI )1,( +txI

p

xI

tI

Temporal derivative at 2nd iteration

Iterating helps refining the velocity vector

Can keep the same estimate for spatial derivative

x

tprevious I

Ivv −←

Converges in about 5 iterations

Page 22: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

x

tI

Ivv −←

Ø Compute local image derivative at p: Ø  Initialize velocity vector: Ø Repeat until convergence:

Ø Compensate for current velocity vector: Ø Compute temporal derivative: Ø Update velocity vector:

For all pixel of interest p: xI

0←v

)1,()1,(' ++=+ tvxItxI

),()1,(' tpItpIIt −+=

�  Need access to neighborhood pixels around p to compute �  Need access to the second image patch, for velocity compensation:

�  The pixel data to be accessed in next image depends on current velocity estimate (bad?) �  Compensation stage requires a bilinear interpolation (because v is not integer)

�  The image derivative needs to be kept in memory throughout the iteration process

Requirements: xI

xI

Algorithm

Page 23: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

23

From 1D to 2D tracking

0)(

=∂∂

+⎟⎠

⎞⎜⎝

⎛∂∂

∂∂

txt tI

tx

xI

1D:

0)(

=∂∂

+⎟⎠

⎞⎜⎝

⎛∂∂

∂∂

+⎟⎠

⎞⎜⎝

⎛∂∂

∂∂

txtt tI

ty

yI

tx

xI

2D:

0)(

=∂∂

+∂∂

+∂∂

txtt tIv

yIu

xI

One equation, two velocity components unknown (u,v)

Page 24: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

From 1D to 2D tracking

* Slide from Michael Black, CS143 2003

We get at most “Normal Flow” – with one point we can only detect movement perpendicular to the brightness gradient. Solution is to take a patch of pixels Around the pixel of interest.

Page 25: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

25

image I

Gaussian pyramid of image It-1 Gaussian pyramid of image I

image It image It-1

u=10 pixels

u=5 pixels

u=2.5 pixels

u=1.25 pixels

Coarse-to-fine optical flow estimation

Page 26: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

26

image I image J

Gaussian pyramid of image It-1 Gaussian pyramid of image I

image I image It-1

Coarse-to-fine optical flow estimation

run iterative L-K

run iterative L-K

warp & upsample

.

.

.

Page 27: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

Example

27

Page 28: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

Example: Results

28

Page 29: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

29

Block matching Block-matching

16x16 pixels/block

Search window: ±16 pixels from the original position

Computationally heavy! To reduce the complexity

Sub-optimal algorithms

Hardware assisted

Page 30: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

30

Block matching

Page 31: Use of Motion In Segmentation...Motion based segmentation • Motion segmentation, i.e., the identification of groups of image points moving similarly • Concept: detect the changes

31

Motion estimation & Motion compensation Previous frame

Current frame (A)

Reconstructed frame

Motion compensation

Compensated frame (B)

Delta frame=A-B

Delta frame+Motion Vectors

Reference frame (prediction residual, previously decoded)

+