Hi Kevin!
I think this is great! I liked how you used k-means instead of average as a better representation of simply averaging the entire frame in your previous project. I wonder if there’s still a way of averaging in a better way. What if you were able to restrict the sample of your averages to certain areas/masks? For instance:
def setup():
global comic
size(477,733)
noStroke()
#Loading a comic (or movie frame?)
comic = loadImage("comic.png")
def draw():
#image(comic,0,0)
background(255)
rectCapture(comic,mouseX,mouseY,40,40)
#Rule of Thirds columns
# for i in range(3):
# rectCapture(comic,i*width/3,0,width/3,height)
# #Rule of Thirds rows
# for i in range(3):
# rectCapture(comic,0,i*height/3,width,height/3)
#Grid Capture
# for i in range(0,width,50):
# for j in range(0,height,50):
# rectCapture(comic,i,j,30,30)
def rectCapture(someImage,x,y,w,h):
colors = []
for i in range(w):
for j in range(h):
colors.append(someImage.get(x+i,y+j))
fill(averageColors(colors))
rect(x,y,w,h)
def averageColors(alist):
averagedColor = [0,0,0]
for i in alist:
averagedColor[0] += red(i)
averagedColor[1] += green(i)
averagedColor[2] += blue(i)
averagedColor = [1.0*i/len(alist) for i in averagedColor]
return color(*averagedColor)
You can comment out different masks above as an illustration of what I mean. It’s possible to think of other masks to analyze frames from seeing how movie frames are composed (or even comics composition).
Maybe masks need not be rectangular, maybe it could be linear, just as an approach that doesn’t favor the background over the foreground elements in a composition.
Also, I wonder if the final visual could be animated. It could be a series of interpolations between one set of masked averages to another. Maybe analyzing the averages of Warm/Cool colors in a composition through time. If you have access to the subtitles, perhaps what’s the average sentiment from one set of colors to the next?
Just wanted to suggest some ideas. I liked your analysis and I think there’s so much potential in it. I think I’m conflating this visualization with your comic books project, but I forgot to reply to the previous one and I think they’re both related.