learning_brain
New Member
- Messages
- 206
- Reaction score
- 1
- Points
- 0
I have been working on this for a while and ideally need some help to tidy it up as it's my first OOP.
Effectively, I wanted a class that analyses images to check for skin tone percentage. Then return the original image if the percentage is low enough, but return a pixellated image if it is too high together with the option of a link to view the original. Quite a challenge!
I have now succeeded (tested it and it works), but I'm guessing the code is messy and resource intensive so I'm asking if anyone a) finds this of interest and b) would like to assist in making the code cleaner.
There are 3 files attached
1) The class (a lot of commented out stuff here that I used to determine what a skintone is)
2) A dynamic pixellated image renderer (same directory)
4) The test html page
The class call has a number of variables to control the output.
First is the source url
Second.. if "Message" is entered rather than "", a warning message will be output.
Third.. if "Link" is entered rather than "", it will provide the link to view the original.
Fourth.. adjust the sensitivity. In this case, the percentage skintone threshold is 15%. If the image contains more than 15% skintones, it will return a pixellated image. The higher the percentage, the more skintones need to be present before pixellation.
The class will return the complete image so no need for <img src="anything"/> etc...
It doesn't seem to return pixellated images for all urls... for some reason.
This will be extremely useful for my search engine, but may be helpful to others as well.
Any ideas?
Effectively, I wanted a class that analyses images to check for skin tone percentage. Then return the original image if the percentage is low enough, but return a pixellated image if it is too high together with the option of a link to view the original. Quite a challenge!
I have now succeeded (tested it and it works), but I'm guessing the code is messy and resource intensive so I'm asking if anyone a) finds this of interest and b) would like to assist in making the code cleaner.
There are 3 files attached
1) The class (a lot of commented out stuff here that I used to determine what a skintone is)
2) A dynamic pixellated image renderer (same directory)
4) The test html page
The class call has a number of variables to control the output.
First is the source url
Second.. if "Message" is entered rather than "", a warning message will be output.
Third.. if "Link" is entered rather than "", it will provide the link to view the original.
Fourth.. adjust the sensitivity. In this case, the percentage skintone threshold is 15%. If the image contains more than 15% skintones, it will return a pixellated image. The higher the percentage, the more skintones need to be present before pixellation.
The class will return the complete image so no need for <img src="anything"/> etc...
PHP:
$analysedImage = new ImageAnalysis();
$analysedImage->doAnalysis("thefullurl","Message","Link","15");
It doesn't seem to return pixellated images for all urls... for some reason.
This will be extremely useful for my search engine, but may be helpful to others as well.
Any ideas?
Attachments
Last edited: