Edits for live
This commit is contained in:
parent
6fc9310751
commit
7fabef0516
5 changed files with 85 additions and 39 deletions
51
graphs.php
51
graphs.php
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
var d1 = <?php echo require "output/talk1.json" ?>;
|
var d1 = <?php echo require "output/talk1.json" ?>;
|
||||||
var d2 = <?php echo require "output/talk2.json" ?>;
|
var d2 = <?php echo require "output/talk2.json" ?>;
|
||||||
var d3 = <?php echo require "output/talk3.json" ?>;
|
//~ var d3 = <?php echo require "output/talk3.json" ?>;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
@ -22,10 +22,10 @@ var d3 = <?php echo require "output/talk3.json" ?>;
|
||||||
overflow-x:auto;
|
overflow-x:auto;
|
||||||
}
|
}
|
||||||
#presentations{
|
#presentations{
|
||||||
width:300%;
|
width:200%;
|
||||||
}
|
}
|
||||||
#presentations .presentation{
|
#presentations .presentation{
|
||||||
width:33%;
|
width:50%;
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
#presentations .presentation div.plot{
|
#presentations .presentation div.plot{
|
||||||
|
@ -59,8 +59,15 @@ var d3 = <?php echo require "output/talk3.json" ?>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#imgwrap div{
|
||||||
|
display:block;
|
||||||
|
color:#999;
|
||||||
|
font-size:80%;
|
||||||
|
}
|
||||||
#imgwrap img{
|
#imgwrap img{
|
||||||
width:90%;
|
height:7em;
|
||||||
|
min-width: 3em;
|
||||||
|
background:#ccc;
|
||||||
margin-left:2%;
|
margin-left:2%;
|
||||||
margin-top:1em;
|
margin-top:1em;
|
||||||
}
|
}
|
||||||
|
@ -78,29 +85,31 @@ var d3 = <?php echo require "output/talk3.json" ?>;
|
||||||
|
|
||||||
<div id="scroller">
|
<div id="scroller">
|
||||||
<div id='presentations'>
|
<div id='presentations'>
|
||||||
<div class='presentation'>
|
|
||||||
<h1>Orit Halpern</h1>
|
|
||||||
<div class='stats' id='plot1-stats'></div>
|
|
||||||
<div class='plot' id="plot1-div"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class='presentation'>
|
<div class='presentation'>
|
||||||
<h1>Penousal Machado</h1>
|
<h1>Penousal Machado</h1>
|
||||||
<div class='stats' id='plot2-stats'></div>
|
<div class='stats' id='plot2-stats'></div>
|
||||||
<div class='plot' id="plot2-div"></div>
|
<div class='plot' id="plot2-div"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class='presentation'>
|
||||||
|
<h1>Orit Halpern</h1>
|
||||||
|
<div class='stats' id='plot1-stats'></div>
|
||||||
|
<div class='plot' id="plot1-div"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
|
||||||
<div class='presentation'>
|
<div class='presentation'>
|
||||||
<h1>Nicolas Maigret</h1>
|
<h1>Nicolas Maigret</h1>
|
||||||
<div class='stats' id='plot3-stats'></div>
|
<div class='stats' id='plot3-stats'></div>
|
||||||
<div class='plot' id="plot3-div"></div>
|
<div class='plot' id="plot3-div"></div>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id='imgwrap'>
|
<div id='imgwrap'>
|
||||||
<img src="" id="hoverimg">
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
|
@ -209,16 +218,16 @@ for(var i in facialParameters){
|
||||||
checkboxWrapperEl.appendChild(labelEl);
|
checkboxWrapperEl.appendChild(labelEl);
|
||||||
}
|
}
|
||||||
|
|
||||||
var imgEl = document.getElementById("hoverimg");
|
var imgwrapEl = document.getElementById("imgwrap");
|
||||||
var plot1Div = document.getElementById('plot1-div');
|
var plot1Div = document.getElementById('plot1-div');
|
||||||
var plot2Div = document.getElementById('plot2-div');
|
var plot2Div = document.getElementById('plot2-div');
|
||||||
var plot3Div = document.getElementById('plot3-div');
|
//~ var plot3Div = document.getElementById('plot3-div');
|
||||||
|
|
||||||
function drawGraphs(){
|
function drawGraphs(){
|
||||||
params = getCheckedParams();
|
params = getCheckedParams();
|
||||||
drawGraph("talk1", plot1Div, d1, params);
|
drawGraph("talk1", plot1Div, d1, params);
|
||||||
drawGraph("talk2", plot2Div, d2, params);
|
drawGraph("talk2", plot2Div, d2, params);
|
||||||
drawGraph("talk3", plot3Div, d3, params);
|
//~ drawGraph("talk3", plot3Div, d3, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -423,12 +432,20 @@ function drawGraph(id, targetEl, d, params) {
|
||||||
//~ });
|
//~ });
|
||||||
|
|
||||||
targetEl.on('plotly_hover', function (data){
|
targetEl.on('plotly_hover', function (data){
|
||||||
|
let HTML = "";
|
||||||
var points = data.points[0],
|
var points = data.points[0],
|
||||||
pointNum = points.pointNumber;
|
pointNum = points.pointNumber;
|
||||||
console.log(pointNum, d['windows'][pointNum]['startFrame'], data);
|
console.log(d);
|
||||||
imgEl.src = "/images.php?i="+d['windows'][pointNum]['startFrame']+"¶ms="+params.join() + "&nr=" + d['outputNr'] ;
|
for(let i in d['windows'][pointNum]['frames']) {
|
||||||
|
console.log(pointNum, d['windows'][pointNum]['frames'][i], data);
|
||||||
|
//~ imgEl.src = "/images.php?i="+d['windows'][pointNum]['frames'][i]+"¶ms="+params.join() + "&nr=" + d['outputNr'] ;
|
||||||
|
HTML+= "<div>"+d['windows'][pointNum]['frames'][i]+"<img src=\"/images.php?i="+d['windows'][pointNum]['frames'][i]+"¶ms="+params.join() + "&nr=" + d['outputNr'] +"\"></div>" ;
|
||||||
|
}
|
||||||
|
imgwrapEl.innerHTML = HTML;
|
||||||
|
|
||||||
var audio = new Audio('output/'+d['outputNr']+'/'+d['windows'][pointNum]['startFrame']+'.wav');
|
var audio = new Audio('output/'+d['outputNr']+'/'+d['windows'][pointNum]['startFrame']+'.wav');
|
||||||
audio.play();
|
audio.play();
|
||||||
|
|
||||||
//~ Plotly.Fx.hover('plot-div',[
|
//~ Plotly.Fx.hover('plot-div',[
|
||||||
//~ { curveNumber:0, pointNumber:pointNum },
|
//~ { curveNumber:0, pointNumber:pointNum },
|
||||||
//~ { curveNumber:1, pointNumber:pointNum },
|
//~ { curveNumber:1, pointNumber:pointNum },
|
||||||
|
|
20
images.php
20
images.php
|
@ -61,21 +61,28 @@ usort($json['faces'], function ($f1, $f2) {
|
||||||
return $f1['diff'] > $f2['diff'] ? -1 : 1;
|
return $f1['diff'] > $f2['diff'] ? -1 : 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
$targetIm = imagecreatetruecolor(1920, 1080);
|
$i = 0;
|
||||||
|
$faceDim = 120;
|
||||||
|
$faceMargin = 20;
|
||||||
|
$faceCount = count($json['faces']);
|
||||||
|
$widthNr = max(1, $faceCount);
|
||||||
|
$targetIm = imagecreatetruecolor(($faceDim+$faceMargin)* $widthNr, $faceDim + 20);
|
||||||
$white = imagecolorallocate($targetIm, 255, 255, 255);
|
$white = imagecolorallocate($targetIm, 255, 255, 255);
|
||||||
imagefill($targetIm, 0, 0, $white);
|
imagefill($targetIm, 0, 0, $white);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$faceDim = 120;
|
$faceDim = 120;
|
||||||
$faceMargin = 20;
|
$faceMargin = 20;
|
||||||
$itemsPerRow = (int) 1080 / ($faceDim + $faceMargin);
|
//~ $itemsPerRow = (int) 1080 / ($faceDim + $faceMargin);
|
||||||
$maxDiff = sqrt(count($params) * 100);
|
$maxDiff = sqrt(count($params) * 100);
|
||||||
foreach($json['faces'] as $face) {
|
foreach($json['faces'] as $face) {
|
||||||
$posX = $i % $itemsPerRow;
|
$posX = $i % $itemsPerRow;
|
||||||
$posY = (int) ($i / $itemsPerRow);
|
//~ $posY = (int) ($i / $itemsPerRow);
|
||||||
|
//~
|
||||||
$destX = $posX * ($faceDim + $faceMargin);
|
//~ $destX = $posX * ($faceDim + $faceMargin);
|
||||||
$destY = $posY * ($faceDim + $faceMargin);
|
//~ $destY = $posY * ($faceDim + $faceMargin);
|
||||||
|
$destX = $i * ($faceDim + $faceMargin);
|
||||||
|
$destY = 0;
|
||||||
|
|
||||||
imagecopyresampled ( $targetIm , $im , $destX , $destY , (int) $face['rect']['x'] , (int) $face['rect']['y'] , $faceDim , $faceDim , (int) $face['rect']['w'], (int) $face['rect']['h']);
|
imagecopyresampled ( $targetIm , $im , $destX , $destY , (int) $face['rect']['x'] , (int) $face['rect']['y'] , $faceDim , $faceDim , (int) $face['rect']['w'], (int) $face['rect']['h']);
|
||||||
|
|
||||||
|
@ -85,7 +92,6 @@ foreach($json['faces'] as $face) {
|
||||||
imagettftext($targetIm, 12, 0, $destX, $destY + $faceDim + $faceMargin/1.2, $colorBg, "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf", round($face['diff'],2));
|
imagettftext($targetIm, 12, 0, $destX, $destY + $faceDim + $faceMargin/1.2, $colorBg, "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf", round($face['diff'],2));
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$im = $targetIm;
|
$im = $targetIm;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -245,6 +245,18 @@ int main(int argsc, char ** argsv)
|
||||||
|
|
||||||
int frameNrIn = 1;
|
int frameNrIn = 1;
|
||||||
int frameNrOut = 1;
|
int frameNrOut = 1;
|
||||||
|
// increase number to current pos:
|
||||||
|
while(true) {
|
||||||
|
char buff[100];
|
||||||
|
snprintf(buff, sizeof(buff), (use_segments ? "segment%06d.json" : "frame%06d.json"), frameNrIn);
|
||||||
|
boost::filesystem::path jsonPath = outPath / buff;
|
||||||
|
if ( boost::filesystem::exists( jsonPath.native() )) {
|
||||||
|
frameNrIn++;
|
||||||
|
frameNrOut++;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
std::time_t lastImgUpdate(0);
|
std::time_t lastImgUpdate(0);
|
||||||
int seconds = 1;
|
int seconds = 1;
|
||||||
while(true){ //(cv::waitKey(20) != -1);
|
while(true){ //(cv::waitKey(20) != -1);
|
||||||
|
|
|
@ -217,6 +217,9 @@ class Window:
|
||||||
return np.std(vectors)
|
return np.std(vectors)
|
||||||
|
|
||||||
def getAverageV(self, params):
|
def getAverageV(self, params):
|
||||||
|
# when no faces, return faux vector
|
||||||
|
if len(self.getFaces()) < 1:
|
||||||
|
return [0.0 for p in params]
|
||||||
vectors = [f.getCharacteristicVector(params) for f in self.getFaces()]
|
vectors = [f.getCharacteristicVector(params) for f in self.getFaces()]
|
||||||
vAvg = np.mean(vectors, axis=0)
|
vAvg = np.mean(vectors, axis=0)
|
||||||
return vAvg
|
return vAvg
|
||||||
|
@ -458,12 +461,13 @@ def getGraphData(frames, params, window_size, outputNr):
|
||||||
"""
|
"""
|
||||||
collection = WindowCollection(window_size, frames)
|
collection = WindowCollection(window_size, frames)
|
||||||
windows = collection.windows
|
windows = collection.windows
|
||||||
jsonOutput = {'windows':[], 'outputNr': outputNr}
|
jsonOutput = {'windows':[], 'outputNr': outputNr, 'window_size': window_size}
|
||||||
for window in windows:
|
for window in windows:
|
||||||
w = {
|
w = {
|
||||||
'start': window.getStartTime().strftime('%Y-%m-%d %H:%M:%S'),
|
'start': window.getStartTime().strftime('%Y-%m-%d %H:%M:%S'),
|
||||||
'end': window.getEndTime().strftime('%Y-%m-%d %H:%M:%S'),
|
'end': window.getEndTime().strftime('%Y-%m-%d %H:%M:%S'),
|
||||||
'startFrame': window.frames[0].name,
|
'startFrame': window.frames[0].name,
|
||||||
|
'frames': [frame.name for frame in window.frames],
|
||||||
'params': {},
|
'params': {},
|
||||||
'param_values': {},
|
'param_values': {},
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,8 @@ nextOutNr = segmentCount
|
||||||
while True:
|
while True:
|
||||||
nextJpg = os.path.join(args.frameOutput, "frame%06d.jpg" % nextInNr)
|
nextJpg = os.path.join(args.frameOutput, "frame%06d.jpg" % nextInNr)
|
||||||
nextInJson = os.path.join(args.frameOutput, "frame%06d.json" % nextInNr)
|
nextInJson = os.path.join(args.frameOutput, "frame%06d.json" % nextInNr)
|
||||||
while os.path.exists(nextJpg) and not os.path.exists(nextInJson):
|
while os.path.exists(nextJpg):
|
||||||
|
if not os.path.exists(nextInJson):
|
||||||
print("(SPLIT) Found: {}".format(nextJpg))
|
print("(SPLIT) Found: {}".format(nextJpg))
|
||||||
img = Image.open(nextJpg)
|
img = Image.open(nextJpg)
|
||||||
|
|
||||||
|
@ -46,11 +47,14 @@ while True:
|
||||||
segmentFilename = os.path.join(args.segmentDir, "segment%06d.jpg" % segmentNr)
|
segmentFilename = os.path.join(args.segmentDir, "segment%06d.jpg" % segmentNr)
|
||||||
segmentImg.save(segmentFilename, quality=90)
|
segmentImg.save(segmentFilename, quality=90)
|
||||||
print("(SPLIT) Created: {}".format(segmentFilename))
|
print("(SPLIT) Created: {}".format(segmentFilename))
|
||||||
|
else:
|
||||||
|
print("(SPLIT) Skip: {}".format(nextJpg))
|
||||||
|
|
||||||
nextInNr += 1
|
nextInNr += 1
|
||||||
nextJpg = os.path.join(args.frameOutput, "frame%06d.jpg" % nextInNr)
|
nextJpg = os.path.join(args.frameOutput, "frame%06d.jpg" % nextInNr)
|
||||||
nextInJson = os.path.join(args.frameOutput, "frame%06d.jpg" % nextInNr)
|
nextInJson = os.path.join(args.frameOutput, "frame%06d.json" % nextInNr)
|
||||||
|
|
||||||
|
continue
|
||||||
nextJson = os.path.join(args.segmentDir, "segment%06d.json" % nextOutNr)
|
nextJson = os.path.join(args.segmentDir, "segment%06d.json" % nextOutNr)
|
||||||
while os.path.exists(nextJson):
|
while os.path.exists(nextJson):
|
||||||
print("(MERGE) Found: {}".format(nextJson))
|
print("(MERGE) Found: {}".format(nextJson))
|
||||||
|
@ -88,8 +92,11 @@ while True:
|
||||||
print("(MERGE) Wrote: {}".format(jsonOutFilename))
|
print("(MERGE) Wrote: {}".format(jsonOutFilename))
|
||||||
print("(MERGE) Cleanup segments for frame {}".format(frameOutNr))
|
print("(MERGE) Cleanup segments for frame {}".format(frameOutNr))
|
||||||
for imgName in segmentImages:
|
for imgName in segmentImages:
|
||||||
|
if os.path.exists(imgName):
|
||||||
print("(MERGE) \t Unlink {}".format(imgName))
|
print("(MERGE) \t Unlink {}".format(imgName))
|
||||||
os.unlink(imgName)
|
os.unlink(imgName)
|
||||||
|
else:
|
||||||
|
print("(MERGE) \t Already unlinked {}".format(imgName))
|
||||||
|
|
||||||
nextOutNr += segmentCount
|
nextOutNr += segmentCount
|
||||||
nextJson = os.path.join(args.segmentDir, "segment%06d.json" % nextOutNr)
|
nextJson = os.path.join(args.segmentDir, "segment%06d.json" % nextOutNr)
|
||||||
|
|
Loading…
Reference in a new issue