> For the complete documentation index, see [llms.txt](https://capellac.gitbook.io/opencv/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://capellac.gitbook.io/opencv/week2/udacity-computer-vision/dense-flow-brightness-constraint.md).

# 6B-L1:DENSE FLOW: BRIGHTNESS CONSTRAINT

## :mage: Motion Estimation: Optical flow

* Optical flow is the apparent motion of objects or surfaces

![](https://2797135393-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M99TkJnCKaTvw9u9gQJ%2F-MAVpAFsIHdwCsayXhmo%2F-MAVqQuEGKZdwXHp6hVz%2FRubic'sCube.jpg?alt=media\&token=87d31940-6e71-478a-ae36-7fbf12e0f50e)

## :heavy\_plus\_sign: Problem Definition Optical Flow

* How to estimate pixel motion from image I(x, y, t) to I(x, y, t+1)
* Two key assumptions:
  * **color constancy**:  A point in I(x, y, t) looks the same in I(x', y', t+1). For gray scale images, this is brightness constancy&#x20;
  * **small motion:  points do not move very far.**

<div align="left"><img src="https://2797135393-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M99TkJnCKaTvw9u9gQJ%2F-MAVpAFsIHdwCsayXhmo%2F-MAVrtwrg_XzRA6KdQKX%2FOpticalFlow.jpeg?alt=media&amp;token=673ffa3e-8e6d-43b1-a9a7-229337134aaa" alt=""></div>

## :skull: Optical flow constraints (grayscale images)

1. Brightness constancy constraint (equation)
   1. &#x20;I(x, y, t) = I(x+v, y+u, t+1)
2. Small motion (u and v are less than 1 pixel, or smooth) (Taylor serious expansion)

![](https://2797135393-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M99TkJnCKaTvw9u9gQJ%2F-MAVpAFsIHdwCsayXhmo%2F-MAVutWZNMocgGOtqDvg%2FOptical-flow-Constraints.jpg?alt=media\&token=d5f4b0a4-3186-497c-9a41-d19db441d528)

## :heavy\_plus\_sign: Combining These Two Equations: (1st and 2nd in the previous header's list)

Brightness constancy constraint equation:

![](https://2797135393-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M99TkJnCKaTvw9u9gQJ%2F-MAVpAFsIHdwCsayXhmo%2F-MAVxaG-6_8LPO4OfaHW%2Feqation2.jpg?alt=media\&token=2e8213f2-978b-447d-9585-81c6c9fc7328)

![](https://2797135393-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M99TkJnCKaTvw9u9gQJ%2F-MAVpAFsIHdwCsayXhmo%2F-MAVwK225rXKIhNNOmyv%2FEquation.jpg?alt=media\&token=ca7c9a55-ee5a-49ef-84de-396663259004)

## :straight\_ruler: Gradient Component of Flow

<div align="left"><img src="https://2797135393-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M99TkJnCKaTvw9u9gQJ%2F-MAWybeGtHpc5rmHS3EM%2F-MAWyunBECSTEBrErAMV%2FgradientComponentOfFlow.png?alt=media&amp;token=6d78ae6d-0727-4bcf-aad7-19e9735c24ae" alt=""></div>

## :o: Aperture Problem

<div align="center"><img src="https://2797135393-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M99TkJnCKaTvw9u9gQJ%2F-MAWybeGtHpc5rmHS3EM%2F-MAWz7gF-Q6CMf6k1b8L%2FApertureProblem.png?alt=media&amp;token=179c9082-a0b8-44bf-82e6-8ae124b0c4c6" alt=""></div>

## :thinking: Additional Flow Constraints

* [x] Nearby pixels move together    (Local)
* [x] Motion must be consistent over the entire image   (Global)
* [x] Only consider distinct regions (such as corners)    &#x20;

## :stars: Smooth Optical Flow

![](https://2797135393-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M99TkJnCKaTvw9u9gQJ%2F-MAWzshCrzXavYDrq82Q%2F-MAX59HTxN5iy8YtnR-W%2Fsmoothopticalflow.svg?alt=media\&token=6342e910-bffe-4e21-986c-4ccf22c42ef4)
