Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
dcunhas committed Sep 13, 2016
2 parents e32a851 + ad7064d commit ac6f81d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions webclient/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
url(r'^applyLabels$', 'webclient.views.applyLabels'),
url(r'^loadLabels$', 'webclient.views.loadLabels'),
url(r'^fix_label_location$', 'webclient.views.fix_label_location'),
url(r'^print_label_data', 'webclient.views.print_label_data'),


url(r'^get_overlayed_image/(?P<image_label_id>[0-9]*)$', 'webclient.views.get_overlayed_image'),
Expand Down
33 changes: 33 additions & 0 deletions webclient/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from webclient.image_ops import crop_images
from .models import *

import csv


######
#PAGES
Expand Down Expand Up @@ -508,3 +510,34 @@ def subtractPadding(matchobj):
except ValueError:
s = matchobj.group(0)
return s


@csrf_exempt
@require_POST
def print_label_data(request):
with open('imageLabel_data.csv', 'w') as csvfile:
fieldnames = ['parentImage_name', 'parentImage_path', 'categoryType',
'pub_date', 'labeler', 'iw_x', 'iw_y', 'iw_width', 'iw_height', 'timeTaken',
'if_brightness', 'if_contrast', 'if_saturation']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for label in ImageLabel.objects.all():
imageFilter = ImageFilter.objects.all().get(imageLabel=label)
labelDict = {
'parentImage_name' : label.parentImage.name,
'parentImage_path' : label.parentImage.path,
'categoryType' : label.categoryType.category_name,
'pub_date' : label.pub_date,
'labeler' : label.labeler,
'iw_x' : label.imageWindow.x,
'iw_y' : label.imageWindow.y,
'iw_width' : label.imageWindow.width,
'iw_height' : label.imageWindow.height,
'timeTaken' : label.timeTaken,
'if_brightness' : imageFilter.brightness,
'if_contrast' : imageFilter.contrast,
'if_saturation' : imageFilter.saturation,
}
writer.writerow(labelDict)
return HttpResponse("Printed")

0 comments on commit ac6f81d

Please sign in to comment.