@Reference(type=Inproceedings, author={"Jose San Pedro","Stefan Siersdorfer"}, title="Ranking and Classifying Attractiveness of Photos in Folksonomies", year="2009", booktitle="18th International World Wide Web Conference", pages={"771","","771"}, url="http://www2009.eprints.org/78/", month="April") public class RGBRMSContrast extends Object implements ImageAnalyser<MBFImage>, FeatureVectorProvider<DoubleFV>
See the referenced paper for a description. The original python looked like:
cdata = image.getdata()
center = [0.0,0.0,0.0]
for v in cdata:
center[0]+=v[0]
center[1]+=v[1]
center[2]+=v[2]
for i in xrange(len(center)):
center[i]/=len(cdata) #mean vector of the RGB values
contrast2 = 0.0
for v in cdata:
contrast2 += ((v[0]-center[0])**2) + ((v[1]-center[1])**2) + ((v[2]-center[2])**2) #norm of differences wrt the mean
contrast2 /= len(cdata)
Constructor and Description |
---|
RGBRMSContrast() |
Modifier and Type | Method and Description |
---|---|
void |
analyseImage(MBFImage image)
Analyse an image.
|
double |
getContrast()
Get the contrast of the last image analysed with
analyseImage(MBFImage) |
DoubleFV |
getFeatureVector()
Get the FeatureVector associated with this object.
|
public RGBRMSContrast()
public DoubleFV getFeatureVector()
FeatureVectorProvider
getFeatureVector
in interface FeatureVectorProvider<DoubleFV>
public void analyseImage(MBFImage image)
ImageAnalyser
analyseImage
in interface ImageAnalyser<MBFImage>
image
- The image to process in place.public double getContrast()
analyseImage(MBFImage)