[英]Why cv2.imread returns none when using django python?
I use opencv-python in django, but when I use cv2.imread , it just returns nonetype .我在 django 中使用 opencv-python,但是当我使用cv2.imread时,它只返回nonetype 。 How can I solve this problem?
我怎么解决这个问题?
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status
from . import serializers
from .serializers import call_serializers
from .apps import BmiEstimationConfig
import pickle
from skimage import io
class BMIEstimationView(APIView):
serializer_class = serializers.call_serializers
def post(self, request):
serializer = serializers.call_serializers(data=request.data)
serializer.is_valid(raise_exception=True)
file = request.FILES['file']
import cv2
image = cv2.imread(file)
print(image)```
got this :
> TypeError: bad argument type for built-in operation
Please make sure the syntax of the cv2.imread()请确保 cv2.imread() 的语法
Syntax: cv2.imread(path, flag)
Parameters:
path: A string representing the path of the image to be read.
flag: It specifies the way in which image should be read. It’s default value is cv2.IMREAD_COLOR
Return Value: This method returns an image that is loaded from the specified file.
and also please provide full path of your image并请提供您的图像的完整路径
to see the examples click here查看示例 点击这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.