Dynamic Image Resizing
Resize an image without losing the dimensions of important aspects of the image.
Turn color image into grayscale image. Find the gradient magnitude of the grayscale image Find the minimum sums of paths of pixels
Find a path of pixels with the smallest change of intensity and remove them.
Continue this until the image has the desired dimensions
The intensities of the pixels are summed vertically (creating the center gradient magnitude image). Then, the darkest seams (path of pixels from top to bottom, created by moving at most one pixel to the left or right, with the least intensity, and thus least importance in the image) are removed.
First, find the best seams to remove in order and store the paths in an array.
Go to each path, and instead of removing it, add pixels next to the path that has the average values of the pixels on either side. Repeat until image has desired dimensions.
Traditional Stretching The traditional method of stretching the image expands each pixel uniformly, thus making the final image unrealistic.
My method of stretching expands only things in the background of the image. The important items (the dolphin in this case) remain untouched by the program. Final Result
With negative weights, a single object can be removed from an image without effecting anything else. The image can then be expanded back to its original size, and it is near impossible to tell it has been changed.