示例#1
0
def material_shape_detail(request, pk):
    shape = get_object_or_404(MaterialShape, pk=pk)

    votes = [
        prepare_votes_bar(shape, "qualities", "correct", "correct", "Quality"),
        prepare_votes_bar(shape, "planarities", "planar", "planar", "Planarity"),
    ]

    bsdfs_wd = shape.bsdfs_wd.extra(
        select={"correct_score": "color_correct_score + gloss_correct_score"}, order_by=("-correct_score",)
    )
    # .filter(color_correct=True, gloss_correct=True) \

    data = {
        "nav": "browse/material-shape",
        "shape": shape,
        "votes": votes,
        "names": shape.names.select_related("name").filter(invalid=False),
        "substances": (shape.substances.select_related("substance").filter(invalid=False)),
        "bsdfs_wd": bsdfs_wd,
        "rectified_normals": (
            shape.rectified_normals.select_related("shape", "shape__photo").order_by("-correct_score")
        ),
    }

    if shape.bsdf_wd:
        data["similar_shapes"] = get_similar_shapes(shape.bsdf_wd)

    return render(request, "material_shape_detail.html", data)
示例#2
0
def photo_detail(request, pk):
    photo = get_object_or_404(Photo, pk=pk)

    votes = [
        prepare_votes_bar(
            photo, 'scene_qualities', 'scene_category_correct',
            'correct', 'Scene label correct'),
        prepare_votes_bar(
            photo, 'whitebalances', 'whitebalanced',
            'whitebalanced', 'Whitebalance'),
    ]

    try:
        intrinsic_synthetic = photo.intrinsic_synthetic
    except ObjectDoesNotExist:
        intrinsic_synthetic = None

    # sections on the page
    nav_section_keys = [
        ("photo", 'Photo'),
        ("shapes", 'Material segmentations'),
        ("vanishing", 'Vanishing points'),
        ("whitebalance", 'Whitebalance'),
        ("intrinsic_synthetic", 'Synthetic Rendering') if intrinsic_synthetic else None,
        ("intrinsic_judgements", 'Reflectance Judgements'),
        ("intrinsic_decompositions", 'Intrinsic Image Decompositions'),
    ]
    nav_sections = [
        {
            'key': t[0],
            'name': t[1],
            'template': 'photos/detail/%s.html' % t[0],
        }
        for t in nav_section_keys if t
    ]

    return render(request, 'photos/detail.html', {
        'nav': 'browse/photo',
        'photo': photo,
        'votes': votes,
        'intrinsic_synthetic': intrinsic_synthetic,
        'nav_sections': nav_sections,
    })
示例#3
0
def rectified_normal_detail(request, pk):
    entry = get_object_or_404(ShapeRectifiedNormalLabel, pk=pk)
    votes = [
        prepare_votes_bar(entry, 'qualities', 'correct', 'correct', 'Quality'),
    ]

    data = {
        'nav': 'browse/rectified-normal',
        'entry': entry,
        'votes': votes,
    }
    return render(request, 'rectified_normal_detail.html', data)
示例#4
0
def rectified_normal_detail(request, pk):
    entry = get_object_or_404(ShapeRectifiedNormalLabel, pk=pk)
    votes = [
        prepare_votes_bar(entry, 'qualities', 'correct', 'correct', 'Quality'),
    ]

    data = {
        'nav': 'browse/rectified-normal',
        'entry': entry,
        'votes': votes,
    }
    return render(request, 'rectified_normal_detail.html', data)
示例#5
0
def photo_detail(request, pk):
    photo = get_object_or_404(Photo, pk=pk)

    votes = [
        prepare_votes_bar(photo, 'scene_qualities', 'scene_category_correct',
                          'correct', 'Scene label correct'),
        prepare_votes_bar(photo, 'whitebalances', 'whitebalanced',
                          'whitebalanced', 'Whitebalance'),
    ]

    try:
        intrinsic_synthetic = photo.intrinsic_synthetic
    except ObjectDoesNotExist:
        intrinsic_synthetic = None

    # sections on the page
    nav_section_keys = [
        ("photo", 'Photo'),
        ("shapes", 'Material segmentations'),
        ("vanishing", 'Vanishing points'),
        ("whitebalance", 'Whitebalance'),
        ("intrinsic_synthetic",
         'Synthetic Rendering') if intrinsic_synthetic else None,
        ("intrinsic_judgements", 'Reflectance Judgements'),
        ("intrinsic_decompositions", 'Intrinsic Image Decompositions'),
    ]
    nav_sections = [{
        'key': t[0],
        'name': t[1],
        'template': 'photos/detail/%s.html' % t[0],
    } for t in nav_section_keys if t]

    return render(
        request, 'photos/detail.html', {
            'nav': 'browse/photo',
            'photo': photo,
            'votes': votes,
            'intrinsic_synthetic': intrinsic_synthetic,
            'nav_sections': nav_sections,
        })
示例#6
0
def material_shape_detail(request, pk):
    shape = get_object_or_404(MaterialShape, pk=pk)

    votes = [
        prepare_votes_bar(shape, 'qualities', 'correct', 'correct', 'Quality'),
        prepare_votes_bar(shape, 'planarities', 'planar', 'planar',
                          'Planarity'),
    ]

    bsdfs_wd = shape.bsdfs_wd \
        .extra(
            select={'correct_score':
                    'color_correct_score + gloss_correct_score'},
            order_by=('-correct_score',)
        )
    #.filter(color_correct=True, gloss_correct=True) \

    data = {
        'nav':
        'browse/material-shape',
        'shape':
        shape,
        'votes':
        votes,
        'names':
        shape.names.select_related('name').filter(invalid=False),
        'substances':
        (shape.substances.select_related('substance').filter(invalid=False)),
        'bsdfs_wd':
        bsdfs_wd,
        'rectified_normals': (shape.rectified_normals.select_related(
            'shape', 'shape__photo').order_by('-correct_score'))
    }

    if shape.bsdf_wd:
        data['similar_shapes'] = get_similar_shapes(shape.bsdf_wd)

    return render(request, 'material_shape_detail.html', data)