Python uses OpenCV to open a picture's OpenCV Error:assertion failed solution __python

Source: Internet
Author: User
#OpenImg. py
From numpy Import *
import cv2

win_name = ' mypicture ' #窗口名称
#cv2. Window_normal: The window can be resized manually
Cv2.namedwindow (Win_name, Cv2. Window_normal)

img = cv2.imread (' mypicture.jpg ', 1) # 0 Black-and-White Picture: 1 Color picture
cv2.imshow (Win_name, img) #显示图片
Cv2.waitkey (0)
cv2.destroyallwindows ()   #销毁创建的对象

Above for my Python code to open a picture with OpenCV

Error is: Assertion failed

There are two reasons for the error:

One: There are Chinese names in the path

Two: Picture not and openimg under the same path


This is a problem with memory overflow or OPENCV or out of bounds.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.