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()
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()
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()