first pass of allowing to scan for all files in import and storage paths <- works, and showing all unknown faces to handle them somehow - very rudimentary
This commit is contained in:
@@ -74,7 +74,10 @@
|
||||
<div class="dropdown-menu" aria-labelledby="PersonMenu">
|
||||
<a class="dropdown-item" href="{{url_for('new_person')}}">Create Person</a>
|
||||
<a class="dropdown-item" href="{{url_for('persons')}}">Show People</a>
|
||||
<a class="dropdown-item" href="{{url_for('aistats')}}">View stats of matched faces</a>
|
||||
<a class="dropdown-item" href="{{url_for('aistats')}}">View stats of matches</a>
|
||||
<a class="dropdown-item" href="{{url_for('run_ai_on_import')}}">Match in import path(s) </a>
|
||||
<a class="dropdown-item" href="{{url_for('run_ai_on_storage')}}">Match in storage path(s) </a>
|
||||
<a class="dropdown-item" href="{{url_for('unmatched_faces')}}">Show unmatched</a>
|
||||
</div>
|
||||
</div class="nav-item dropdown">
|
||||
<div class="nav-item dropdown">
|
||||
|
||||
50
templates/faces.html
Normal file
50
templates/faces.html
Normal file
@@ -0,0 +1,50 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block main_content %}
|
||||
<script src="{{ url_for( 'internal', filename='js/face.js')}}"></script>
|
||||
<div class="container-fluid">
|
||||
<h3>Unmatched Faces</h3>
|
||||
<div class="row mt-3">
|
||||
{% for f in faces %}
|
||||
<div id="F{{f.id}}" class="col-2 px-0">
|
||||
<form id="_fm" method="POST" action="/view/{{f.file_eid}}">
|
||||
<input type="hidden" name="eids" value="{{f.file_eid}},">
|
||||
<input type="hidden" name="noo" value="newest">
|
||||
<input type="hidden" name="cwd" value="/">
|
||||
<input type="hidden" name="root" value="/">
|
||||
<input type="hidden" name="size" value="128">
|
||||
<input type="hidden" name="grouping" value="1">
|
||||
<input type="hidden" name="offset" value="0">
|
||||
<input type="hidden" name="folders" value="false">
|
||||
<input type="hidden" name="how_many" value="1">
|
||||
<input type="hidden" name="orig_url" value="{{request.path}}">'
|
||||
|
||||
<figure id="fig_{{f.id}}">
|
||||
<div style="position:relative">
|
||||
<canvas id="c_{{f.id}}" height="128"></canvas>
|
||||
<script>
|
||||
var im_{{f.id}}=new Image();
|
||||
im_{{f.id}}.src="data:image/jpeg;base64,{{f.img}}";
|
||||
fig_{{f.id}}=$('#fig_{{f.id}}')
|
||||
// store this stuff in an javascript Object to use when document is ready event is triggered
|
||||
var orig_face_{{f.id}}=new Object;
|
||||
orig_face_{{f.id}}.x = {{f.locn[0][3]}}
|
||||
orig_face_{{f.id}}.y = {{f.locn[0][0]}}
|
||||
orig_face_{{f.id}}.w = {{f.locn[0][1]}}-{{f.locn[0][3]}}
|
||||
orig_face_{{f.id}}.h = {{f.locn[0][2]}}-{{f.locn[0][0]}}
|
||||
orig_face_{{f.id}}.orig_w = orig_face_{{f.id}}.w
|
||||
orig_face_{{f.id}}.orig_h = orig_face_{{f.id}}.h
|
||||
|
||||
// when the document is ready, then DrawRefimg
|
||||
$(function() { DrawRefimg( fig_{{f.id}}, im_{{f.id}}, c_{{f.id}}, orig_face_{{f.id}} ) });
|
||||
</script>
|
||||
<figcaption>{{f.id}}</figcation>
|
||||
</div>
|
||||
</figure>
|
||||
<button>Go</button>
|
||||
</form>
|
||||
</div id="/F*">
|
||||
{% endfor %}
|
||||
</div class="row">
|
||||
</div class="container-fluid">
|
||||
{% endblock main_content %}
|
||||
@@ -1,35 +1,5 @@
|
||||
{% extends "base.html" %} {% block main_content %}
|
||||
<script>
|
||||
// Define this once and before it will be called, hence at the top of this file
|
||||
function DrawRefimg(fig, img, canvas, orig_face )
|
||||
{
|
||||
// FIXME: should get this from shared.py, not sure why this doesnt work at present
|
||||
thumbsize=256
|
||||
|
||||
context=canvas.getContext('2d')
|
||||
// another call to this func will occur on load, so skip this one
|
||||
if( img.width == 0 )
|
||||
return
|
||||
|
||||
// only set canvas.width once we have valid img dimensions
|
||||
canvas.width=img.width/2
|
||||
|
||||
// actually draw the pixel images to the canvas at the right size
|
||||
context.drawImage(img, 0, 0, img.width/(img.height/canvas.height), canvas.height);
|
||||
fig.width(canvas.width)
|
||||
|
||||
// draw rectangle on face
|
||||
context.beginPath();
|
||||
new_x=(orig_face.x/orig_face.orig_w)*img.width/(img.height/canvas.height)
|
||||
new_y=(orig_face.y/orig_face.orig_h)*thumbsize/(img.height/canvas.height)
|
||||
new_w=(orig_face.w/orig_face.orig_w)*img.width/(img.height/canvas.height)
|
||||
new_h=(orig_face.h/orig_face.orig_h)*thumbsize/(img.height/canvas.height)
|
||||
context.rect(new_x, new_y, new_w, new_h)
|
||||
context.lineWidth = 2;
|
||||
context.strokeStyle = 'green';
|
||||
context.stroke();
|
||||
}
|
||||
</script>
|
||||
<script src="{{ url_for( 'internal', filename='js/face.js')}}"></script>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row col-12"><h3 class="offset-3">{{page_title}}</h3></div>
|
||||
|
||||
Reference in New Issue
Block a user