Let's look at solution in simplistic form. The original image is made up of pixels arranged in a table as shown below (the column and row location for each pixel is also shown). The new image is a collage in which three copies of the original image are placed side by side horizontally. The picture will look like following (notice the colors and how they are copied in the new image, we will discuss this in detail later):
|
||||||||||||||||||||||||||||||||||||||||||
|
Here are some important points:
Let's try to figure out how the colors are copied from original image to new one:
Pixel in original image | Corresponding pixels in new image | |||||
---|---|---|---|---|---|---|
|
|
|||||
|
|
|||||
|
|
|||||
|
|
|||||
So for each original pixel (x,y), in new image the row number is same as the original one and column numbers are x, x+origWidth and x+origWidth+origWidth. | ||||||
|
|
So we can modify the original program given as part of Lab 7 as follows (notice the parts striked out, these are changed in new function):
|
Let's look at problem in the same way as before:
|
|
Here are some important points:
Let's try to figure out how the colors are copied from original image to new one:
Pixel in original image | Corresponding pixels in new image | ||||
---|---|---|---|---|---|
|
|
||||
|
|
||||
|
|
||||
|
|
||||
So for each original pixel (x,y), in new image the column number is same as the original one and row numbers are y, y+origHeight. | |||||
|
|
So we can modify the original JES function as follows:
|