![]() |
| Mr Rogers under the sea |
![]() |
| Putin and his horse on an adventure |
So how do you make a scuba themed filter?
- First you should generally shift the colors to be ocean themed, because water absorbs different colors at different rates, apply different factors to each color.
- Then you need lighting effects of course. But not just any lighting effects. You need an array of lighting effects to select from at random which all have different resolutions, but which you would like to resize to be approximately the same size as your original image to apply the filter to. Then if there is a bit of extra hanging off the sides of the image you need to crop it.
- Then you should throw up a border just in case your scaling functions messed up and you want to try to hide defects. This won't work.
The same applies for a fungi theme, but instead of lighting effects use geometric patterns fed through the same kind of matching routine.
![]() |
| Taking any lighting effect and apply it to your source image by first trying to rescale and crop it to be as close as possible |
Now I know what you're thinking, if my rescaling function didn't work perfectly how did I get some cool photos? That's where numbers come in. I generated 50 randomized pictures with each of my filters. These were broken down as follows:
6 Images to apply the filters to
testPics = ["mrrogers.jpg", "hq.jpg", "mattreg.jpg", "mattShirt.jpg", "mattTesla.jpg", "putin.jpg"]
5 Lighting effects for ocean scenes
oceanLights = ["lightrays1.jpg", "lightrays2.jpg", "lightrays3.jpg", "lightrays4.jpg", "lightrays5.jpg"]
5 Geometric patterns to apply to fungal scenes
fungalLights = ["geometric1.jpg", "geometric2.jpg", "geometric3.jpg", "geometric4.png", "geometric5.jpg"]
By using test functions that accepted a counter for test samples I was able to generate as many pictures as I wanted, save them to my laptop, and pick the best ones. For example:
def fungusTest(testSamples):
for count in range(0,testSamples):
source = testPics[random.randint(0,len(testPics) - 1)]
testPic = makePicture(getMediaPath(source))
testPic = fungalFilter(testPic)
writePictureTo(testPic, getMediaPath("_fungalResult_" + str(count) + ".jpg"))
This kind of test capability also allowed me to find problems with my software, find ways that it would crash, find index problems, cropping problems, etc, which lead me to the conclusion that my combination of scaleMatch, blend, and smartBlend (which uses scale matching and blending) has big problems. Primarily there are cut off sections that appear given certain constraints, for example:
But when you apply the same setting to Putin you are fine:
So clearly some refinement of scaleMatch is needed based on the results of my 100 image test set. A lot of good stuff was learned from spending this much time chugging along on python though. I got some good experience with datatype conversion and rounding, exception handling in case people don't copy my exact directory location for images, test generation, and image manipulation. Overall I am happy with how things went but I think this week could knock my grade down a bit due to poor time management but that's ok.





No comments:
Post a Comment