Пример #1
0
def labelize_kmeans(request):
    img = getOriginalImage(request)
    if img is not None:
        mask = kmeans(img)
        postProcMask(mask)
        saveMask(request, mask)
        return JsonResponse({'img': imconvert.array_2_base64(mask)})
    else:
        return HttpResponseBadRequest()
Пример #2
0
def labelize_kmeans(request):
    img = getOriginalImage(request)
    if img is not None:
        mask = kmeans(img)
        postProcMask(mask)
        saveMask(request, mask)
        return JsonResponse({'img': imconvert.array_2_base64(mask)})
    else:
        return HttpResponseBadRequest()
Пример #3
0
def labelize_watershed(request):
    img = getOriginalImage(request)
    markers = constructMarkers3(request)
    if img is not None and markers is not None:
        mask = watershed2(img, markers)
        postProcMask(mask)
        saveMask(request, mask)
        return JsonResponse({'img': imconvert.array_2_base64(mask)})
    else:
        return HttpResponseBadRequest()
Пример #4
0
def labelize_watershed(request):
    img = getOriginalImage(request)
    markers = constructMarkers3(request)
    if img is not None and markers is not None:
        mask = watershed2(img, markers)
        postProcMask(mask)
        saveMask(request, mask)
        return JsonResponse({'img': imconvert.array_2_base64(mask)})
    else:
        return HttpResponseBadRequest()
Пример #5
0
def labelize_grabcut(request):
    img = getOriginalImage(request)
    rect = receiveRectangle(request)
    markers = constructMarkers4(request)
    if img is not None:
        mask = grabCut(img, rect, markers)
        postProcMask(mask)
        saveMask(request, mask)
        return JsonResponse({'img': imconvert.array_2_base64(mask)})
    else:
        return HttpResponseBadRequest()
Пример #6
0
def labelize_grabcut(request):
    img = getOriginalImage(request)
    rect = receiveRectangle(request)
    markers = constructMarkers4(request)
    if img is not None:
        mask = grabCut(img, rect, markers)
        postProcMask(mask)
        saveMask(request, mask)
        return JsonResponse({'img': imconvert.array_2_base64(mask)})
    else:
        return HttpResponseBadRequest()