OpenCV => 3.4, Operating System / Platform => Ubuntu18.4, Compiler => Pycharm2018, Django => 2.1.2
I am trying to get an image from a database and encode the image for face recognition.
Model
from django.db import models
class Image(models.Model):
name = models.CharField(max_length=500)
imagefile = models.FileField(upload_to='images/', null=True, verbose_name="")
def __str__(self):
return self.name + ": " + str(self.imagefile)
Read Image
from .models import Image
import cv2
lastimage = Image.objects.last()
imagefile = lastimage.imagefile
image = cv2.imread(imagefile)
cv2.imshow('image',image)
Error Get this error
Exception Type: TypeError
Exception Value: bad argument type for built-in operation