April 30, 2016
This past Monday I met with Dr. Pankratz and we tried to figure out why I was running out of memory. We used a function that could tell us how much memory was being used at the time it was called. This helped locate where the problem was. Since we were not able to figure it out right away Dr. Pankratz suggested I save the cropped images in a folder and then upload the small images and place them in an array. This was in place of me cropping images in a function and then returning them and storing them in an array. This ended up working because it allowed me to dispose of images after they were used instead of returning them. When I was cropping in one function and returning the images to another it was not disposing of the images so I had copies of them.
April 24, 2016
Since last time I have resized the original image as it is uploaded, and cropped(to squares) and resized the tile images. I thought that by cropping and resizing images as they are uploaded I would not have memory issues but I do. I think the original tile images might still be in memory or at least some of their attributes and that is what is causing problems. I am not really sure. Another aspect I have added is allowing the user to choose how many tiles across there is. How many tiles tall the image mosaic will be is then determined after they upload the original image.
April 18, 2016
I have cleaned up my windows form so I do not have the testing textboxes and labels visible. Also instead of a MessageBox popping up every 20 generations to say which generation the algorithm is on I have a windows form appearing that displays the current generation, allows the user to change how often this progress form is shown and allows the user to stop the algorithm. I have also been trying to resize the images as they are loaded but am having trouble doing so.
April 12, 2016
I fixed my previous problem, where I was changing the child with the best score. The algorithm found the best matches for a 5X5 grid. I enlarged it to 20X20 and it improves until about 40-50th generations and then stops. I am going to try moving around some of the worse tile matches for the individual children to see if that will help. Since last time I have also displayed the final image that the algorithm creates.
April 11, 2016
I have been working on creating the next generations. Right now I split the generation into four sections using my bestMatches array that has the children ordered from best to worst score(lowest to highest). I started out with doing a lot of shuffling around of images and copying better parts of the children with the better scores and putting them in the ones farther down the list. This improved the scores for the first 10-20 generations but after that they stopped improving.
Before I was starting at the top of the list and going down, and I think that was part of my problem because I was copying and pasting a lot of the same images in the same locations. Now I change the children with the worst scores first. My other problem was that I was just keeping the top best matches without checking to see how well they were being matched to the original image. For the most part they were being matched poorly. So now I check to see how well the images match and if they are not close enough I randomly place them somewhere else. I did try shifting them over one place(left or right) but that was not really helping( which may have to do with the small amount of tiles I am testing it with).
The algorithm seems to be working well now, since the best score keeps dropping; the problem I am having is that my top child with the best score is being changed and I do not know where. This is frustrating because it can have a really great low score and then get worse and then great again between a few consecutive generations.
April 4, 2016
I had a very relaxing spring break at home, unfortunately that means I have to make up for it now! Since my last entry I have added three more arrays. One that saves the color differences(between the original tile and child tile) for individual tiles in each child in the generation. In another array I have these scores added up for each child, so each child has a score. My third array has the child scores ordered from the best to worst scores. Next I will need to determine how to create and rearrange the tiles for the next generation.
March 14, 2016
This past week we had our walkthroughs so I got to see how everyone else is doing and got some tips/advice for my project. I have all of my code now in one project and fixed the naming of all my buttons, textboxes and functions so they do not have the default names. I now have a button that allows the user to upload the original picture and chops and stores the images. I also made it so it saved the individual pictures into my folder. In addition, I have a button where I can upload multiple pictures and displays the names of the pictures. The last button I have is to start the genetic algorithm. So far it just initializes the array of arrays(size of 30), fills the arrays from 0 to the number of tiles and then shuffles them. At the end I display each child in the generation and its contents into a textbox so I can see what they have.
March 7, 2016
There was no progress with my project this past week. I just sat down and figured out what I have done, which includes code in separate programs to simplify testing, and how I want to piece them all together. I've made myself some diagrams and ordered lists to organize what I have and my current plan for what is next.
February 29, 2016
Last Tuesday I met with Dr. Pankratz and we discussed the genetic algorithm and ideas for creating new generations to have the best results. We also talked about how the tiles/images will have to be the same size. I searched the Internet and found a way to resize and crop images. I also found a way to chop up the original image and save the tiles into an array, which will help me test my algorithm since it should eventually come up with the correct solution. Using the tiles in the array I found the average color for each, which I stored in another array that has the image number and the red, green and blue values. I displayed both the image and its average color next to each other and found that the smaller I cut up the image the more similar the two looked.
February 22, 2016
This last week I found the correct type of genetic algorithm(using a permutation representation) for my problem. I also found some options for mutating. I'm not sure which one(s) will be best for creating each generation. Since last time I was also able to open a dialog box and import multiple images at one time and store them in an array which I could then use to display each image.
To Do:
- Work on mockups
- Continue working on algorithm
February 15, 2016
I did spend some time working on my project this weekend, though not as much as I would have liked to, despite being sick. I was able to compute the average color value for each section of an entire image and made it possible to change both dimensions of the grid. I had been working with a square last week but this week I worked with rectangular pictures and realized I did not have to convert the pictures into .bmp files for the computations to work. Both formats seem to take the same amount of time but that might be something to look into once there are more images.
To Do:
- List all parameters for the genetic algorithm
- Getting multiple images from a folder and storing them
February 7, 2016
This weekend I made a couple small .bmp files to work with. I have also researched how to convert .jpg files in to .bmp files to make them easier to work with and was able to display both formats using a picture box. I was also able to get the average RGB value for all the pixels in one section of the picture(using bitmap.GetPixel(x,y)) but haven't been able to do the same for the rest of the image. Next time I work on it I should be able to figure it out.
To Do:
- Get average color for each section of the image
- Make grid size modifiable
February 4, 2016
Today I met with Dr. Pankratz and got a better understanding of genetic algorithms and what I should focus on first. I am going to start working with C# to find the best way to compare the color of pixels in both the tiles and the sections of the original photo. We also discussed ways to store the photos and color data. Right now I'm thinking that each of the tiles will have an id number and a red, blue and green number that will be stored in an array. I would like to reduce the number of times I have to compute the color of each pixel to compare the tile and photo. I also found some YouTube videos that talk about genetic algorithms and give some examples: Genetic Algorithms 6/30: Example Problem .. Dashed Line Detection
To Do:
- Work with pixel colors
- Find test picture(s)
February 1, 2016
I started my project by looking at existing websites that allow people to create photographic mosaics. Some have photos users can choose from and others allow users to upload their own. There are a lot of choices I will have to make about how many options the user will have, for example the number of pictures uploaded and if photos can be reused or colorized to match the original picture better. I also found some websites who discuss the algorithms used to create the image. The ones I have found make a grid and find the average brightness and color of each region and match it with the most similar image(or images) available(that the user has uploaded). I will have to find the best way to store and locate photographs.
To Do:
- Research best platform for images and algorithm
- Research genetic algorithms
- Continue working on website