美文网首页
cv2.error: \modules\imgproc\src\

cv2.error: \modules\imgproc\src\

作者: sherrysack | 来源:发表于2017-11-03 18:05 被阅读0次
    def visualize_mean_face(x_mean, size, new_dims):
        """Rearrange the data in the mean face to a 2D array
    
        - Organize the contents in the mean face vector to a 2D array.
        - Normalize this image.
        - Resize it to match the new dimensions parameter
    
        Args:
            x_mean (numpy.array): Mean face values.
            size (tuple): x_mean 2D dimensions
            new_dims (tuple): Output array dimensions
    
        Returns:
            numpy.array: Mean face uint8 2D array.
        """
        #new_size = size+(1,)
        #vis_mean = x_mean.reshape(size).astype(np.uint8)
        vis_mean = x_mean.reshape(size).astype(int)
        vis_mean = cv2.resize(vis_mean, new_dims, interpolation = cv2.INTER_CUBIC)
        return vis_mean
    

    After change the datatype, I found I can't resize the image, and the error says:"cv2.error: ......\opencv-2.4.13.2\modules\imgproc\src\imgwarp.cpp:2114: error: (-215) func != 0 in function cv::resize"
    After a long time search, I found that datatype has a problem, I should change the float to np.uint8, instead of pure int.

    相关文章

      网友评论

          本文标题:cv2.error: \modules\imgproc\src\

          本文链接:https://www.haomeiwen.com/subject/niztmxtx.html