Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Read File Despite Correct Path and Permissions #2260

Open
daife opened this issue Aug 2, 2024 · 0 comments
Open

Unable to Read File Despite Correct Path and Permissions #2260

daife opened this issue Aug 2, 2024 · 0 comments

Comments

@daife
Copy link

daife commented Aug 2, 2024

My code:

package com.example.myapplication;

import org.bytedeco.opencv.opencv_core.;
import org.bytedeco.opencv.opencv_imgproc.
;
import static org.bytedeco.opencv.global.opencv_core.;
import static org.bytedeco.opencv.global.opencv_imgproc.
;
import static org.bytedeco.opencv.global.opencv_imgcodecs.;
public class CameraMovementExample {
public static void main() {
//System.loadLibrary();
// 从文件路径读取两张图片
Mat image1 = imread("/storage/emulated/0/DCIM/Screenshots/Screenshot_2024-08-01-21-51-34-386_com.miui.mediaviewer.jpg"/
, IMREAD_GRAYSCALE*/);
//Mat image2 = imread("/storage/emulated/0/DCIM/Screenshots/Screenshot_2024-08-01-21-51-41-629_com.miui.mediaviewer.jpg"/, IMREAD_GRAYSCALE/);
// 创建 CameraMovementEstimator 实例
// CameraMovementEstimator estimator = new CameraMovementEstimator();

    // 处理第一张图片
   // estimator.processFrame(image1);

    // 处理第二张图片并计算移动量
  //  estimator.processFrame(image2);
}

}

The WARN:

OpenCV/4.7.0: [ WARN:0@0.204] global loadsave.cpp:244 findDecoder imread_('/storage/emulated/0/DCIM/Screenshots/Screenshot_2024-08-01-21-51-34-386_com.miui.mediaviewer.jpg'): can't open/read file: check file path/integrity

I have performed the following verifications:

The file path is correct and matches the one provided.

The file permissions have been set to r&w, and the application has the necessary permissions to access the path.->if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
1);
}

environment:

redmi phone k70(android 14)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants