Top Level View of Our Design Albert Liu
Document Sample


Lab 4
Fade In / Fade Out and
Background Subtraction
Albert Liu, 303193184 Section 1
Joshua Yang, 703196411 TA: Jamie Macbeth
Top-Level View of Our Design
PiP2 PiP1
(background subtraction / fade) (reference)
Top-Level View of Our Design
1. Draw out the PiP’s on the screen.
2. Implement PiP2 to show current video.
3. Implement PiP1 to take a snapshot.
4. Perform background subtraction in PiP2.
5. Add the PUSH button feature.
6. Create the indicator bar.
Draw out the PiP’s on the Screen
Two 90x60 pixel boxes.
PiP1: Width 610 to 700
Height 390 to 450
PiP2: Width 500 to 590
Height 390 to 450
Two modules creating arrays
of size 5400
Each element is 24-bits wide
Contains R,G,B (8-bits) info
Draw out the PiP’s on the Screen
MEMORY
Top-Level View of Our Design
1. Draw out the PiP’s on the screen.
2. Implement PiP2 to show current video.
3. Implement PiP1 to take a snapshot.
4. Perform background subtraction in PiP2.
5. Add the PUSH button feature.
6. Create the indicator bar.
Implement PiP2 to Show Current Video
Our 90x60 PiP’s are 8 times smaller than the
720x480 screen.
Therefore, we save the RGB information of each 8th pixel of
the video input into the PiP memory arrays.
Implement PiP2 to Show Current Video
How do we do this?
We only set the memory’s write-enable to 1 if it’s a qualifying pixel.
if (line_count(2 downto 0)= "000" AND pixel_count(2 downto 0) = "000"
Implement PiP2 to Show Current Video
THE RESULT?
PiP2 now displays a smaller version of the current video
read in from the camera.
Top-Level View of Our Design
1. Draw out the PiP’s on the screen.
2. Implement PiP2 to show current video.
3. Implement PiP1 to take a snapshot.
4. Perform background subtraction in PiP2.
5. Add the PUSH button feature.
6. Create the indicator bar.
Implement PiP1 to take a snapshot.
THE BASIC IDEA:
→ Same deal as before, but now only write into PiP1’s
memory array at the one minute mark.
Implement PiP1 to take a snapshot.
Two Major Steps:
1. Create a minute counter.
60 Hz = 60 frames/sec = 3600 frames/min
→ 3600 frame counts means that 1 minute has passed.
The Algorithm:
Each time we’re at a certain reference position we increment the
counter until we reach 3600.
At 3600, we set PiP1’s memory write enable to 1 for qualifying
pixels.
Implement PiP1 to take a snapshot.
Two Major Steps:
2. Display PiP1 to the monitor.
PiP1’s information does not change over the course of a
minute because write enable = 0, preventing an update.
→ Constant still snapshot displayed.
(line_count - "0110000110") * PIP_WIDTH + (pixel_count - "01001100010");
Top-Level View of Our Design
1. Draw out the PiP’s on the screen.
2. Implement PiP2 to show current video.
3. Implement PiP1 to take a snapshot.
4. Perform background subtraction in PiP2.
5. Add the PUSH button feature.
6. Create the indicator bar.
Perform Background Subtraction in PiP2
The data is fed into the FADE module.
PiP1
FADE
PiP2
Perform Background Subtraction in PiP2
What’s the FADE module all about?
INPUTS: RGB vectors of PiP1 and PiP2 (current video), counter
OUTPUTS: Adjusted PiP2 RGB vector with background subtraction
The Algorithm:
1. Find the difference between
each R, G and B.
2. Sum up the differences.
3. If the “total difference” (sum)
is negligibly small, do nothing.
4. Otherwise…
Perform Background Subtraction in PiP2
Rout := (Rp* 9* mtime ) / 32768;
Gout := (Gp* 9* mtime ) / 32768;
Bout := (Bp* 9* mtime ) / 32768;
Why 9/32768?
9/32768 ≈ 1/3600
As grow progress closer to
the minute mark, (RGB)out
becomes closer to (RGB)p
At times far from one
minute, (RGB)out is close
to 0, which would be black.
In Summary (thus far)
Current
w/ Updated PiPs
PiP1
FADE
PiP2
Top-Level View of Our Design
1. Draw out the PiP’s on the screen.
2. Implement PiP2 to show current video.
3. Implement PiP1 to take a snapshot.
4. Perform background subtraction in PiP2.
5. Add the PUSH button feature.
6. Create the indicator bar.
Add the PUSH Button Feature
1. Make changes in EDK.
2. Send the PUSH signal through a debouncing module to clean up
noise.
3. When the MODE changes from 0 to 1, we reset the minute
counter and update the reference location at which we increment
the minute counter.
Top-Level View of Our Design
1. Draw out the PiP’s on the screen.
2. Implement PiP2 to show current video.
3. Implement PiP1 to take a snapshot.
4. Perform background subtraction in PiP2.
5. Add the PUSH button feature.
6. Create the indicator bar.
Create the Indicator Bar
Remember this?
Well we need it for the indicator bar!
Create the Indicator Bar
We choose our indicator bar to be 100 pixels long.
With 5400 square pixels in each PiP (90x60), we
march through each PiP and increment a pixel counter
each time the PiP1 pixel differs from the current pixel.
Once the counter reaches 54 (5400/100), we reset it
to 0 and add 1 to a value called BAR.
0 BAR 100
Create the Indicator Bar
If the current image is drastically different than the
reference, then the bar is all white.
BAR = 100
If the current image is exactly the same as the
reference, then the bar is all black.
BAR = 0
In Summary (Final)
Current
w/ Updated PiPs
PiP1
FADE
PiP2
Improvements?
1. mode
Implement a thirdCurrent that simply displays a
PiP of the current video.
Can compare current video with background
subtraction better.
Gives us a third mode to worry about.
2. Implement an indicator bar that shows how
w/ Updated PiPs
much the input video is changing with respect
to its last frame.
A more practical measurement – how fast objects
are moving.
Get documents about "