Opencv java use to solve the problem failed to read the video VideoCapture

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_42558056/article/details/99624323

Programming Environment

jdk1.8 IDEA opencv4.1.0

Problem Description

Open the video failed isOpen () returns false

problem causes

opencv reads the video file and need ffmpeg associated, not directly into opencv

problem solved

  • Copy all files opencv / build / bin directory to opencv / build / java / x64 folder (x64-bit system is provided, it is copied to the 32-bit x32)
    Here Insert Picture Description
  • Open IDEA project has been built in, then click on File >> Project Structure >> Modules >> Dependencies and click the + next, click Jars or Directories, select opencv / build / java jar file folder, click ok
    Here Insert Picture Description
  • The most critical step, configure the operating environment, we want to opencv jar package and ffmpeg link
    Click run >> Edit Configurations, add the following sentence in the VM opentions (corresponding to your own path)
    -Djava.library. path = F: \ opencv \ opencv \ build \ java \ x64
    Here Insert Picture Description
  • Click ok, we're done, then you can read the opencv avi video format of the

Guess you like

Origin blog.csdn.net/weixin_42558056/article/details/99624323