120 likes | 260 Views
3.11.13. It's a palindrome!. Announcements. March USACO 2nd to last round last day to take it if busy, can start late too because of CAHSEE tomorrow. Harker Programming Invitational (3/16) Cool prizes! This Saturday. Announcements (registration). Stanford ProCo (5/19) Cool prizes!
E N D
3.11.13 It's a palindrome!
Announcements • March USACO • 2nd to last round • last day to take it • if busy, can start late too because of CAHSEE tomorrow. • Harker Programming Invitational (3/16) • Cool prizes! • This Saturday
Announcements (registration) • Stanford ProCo (5/19) • Cool prizes! • Signups are in progress • 6 team max per school • Google Codejam • Somewhat similar to USACO • Series of qualification rounds • Rounds get rapidly more difficult • Registration begins tomorrow
Example Source Target
Image Manipulation • Images are made of pixels • Colors are formed using red, green, and blue subpixels • Brightness • Calculated most simply as sum of red, green, and blue channels • Gradient • Calculated from neighboring pixels • Take differences in brightness • Is a vector: • Magnitude • Direction
Example (cont.) Gradient Final
General Idea • To seemingly blend a pixel into another image, its neighboring pixel values must be known • Need to consider how pixels change with respect to their neighbors • Gradient • Alter the boundary pixels of the foreground image to be equal to corresponding pixels of the background image • Need to make an improved version of the foreground image that blends with the background image
cont. • Copies regions from a source image to a target image • If one of the neighbors is a boundary pixel, its value is fixed • Keep the transition smooth • Preserve the gradient of the foreground image pixels • The sum of the differences between a pixel and its neighbors • If one of the neighbors is out of bounds of the selection, it is excluded • Done for all pixels within the improved foreground
cont. • Assume there are n pixels in foreground • Need to solve for every pixels • System of linear equations in n variables • n by n matrix • N is very large • Note that the matrix is very sparse • Can use Gauss Jordan Elimination (RREF) • too slow • Use conjugate gradient
PotW Have fun at Harker Proco~