Cascade definition loading that worked with .so in 4.0.1 no longer works in 4.5.2

Has anyone had this problem with the face detection code? All I did was update the .so plugin in my Assets folder in Unity with one from 4.5.2, and suddenly the cascade definition is no longer found. xml files are in the same place. I’m not asking anyone to troubleshoot Unity pathfinding itself, since that doesn’t seem to be the issue (or it wouldn’t have worked before my plugin update), but _faceCascade.load(cascadeFileName) in my c++ code somehow works differently in this version. Did I miss an update detail?

Here is my logcat dump from the time it looks for the file name to the time it fails:

I/Unity: looking for cascade file name: /storage/emulated/0/Android/data/com.nxxxxlabs.nxxxx.lite/files/lbpcascade_frontalface_improved.xml
    UnityEngine.Logger:Log(LogType, Object)
    <TransferFile>d__13:MoveNext()
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
     
    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2021-06-10 14:55:40.896 11110-11138/? I/CameraManagerGlobal: Connecting to camera service
2021-06-10 14:55:40.899 11110-11138/? W/CameraManagerGlobal: [soar.cts] ignore the status update of camera: 2
2021-06-10 14:55:40.899 11110-11138/? W/CameraManagerGlobal: [soar.cts] ignore the status update of camera: 3
2021-06-10 14:55:40.918 11110-11138/? I/Unity: all devices: 2
    UnityEngine.Logger:Log(LogType, Object)
    <TransferFile>d__13:MoveNext()
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
     
    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2021-06-10 14:55:40.918 11110-11138/? I/Unity: main camera name:Camera 1
    UnityEngine.Logger:Log(LogType, Object)
    <TransferFile>d__13:MoveNext()
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
     
    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2021-06-10 14:55:40.926 11110-11138/? E/libc: Access denied finding property "persist.vendor.camera.privapp.list"
2021-06-10 14:55:40.919 11110-11110/? W/UnityMain: type=1400 audit(0.0:8167): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=14707 scontext=u:r:untrusted_app:s0:c10,c257,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
2021-06-10 14:55:40.928 1098-5744/? I/CameraService: CameraService::connect call (PID -1 "com.nxxxxlabs.nxxxx.lite", camera ID 1) for HAL version default and Camera API version 2
2021-06-10 14:55:40.929 1098-5744/? I/CameraService: packageName is com.nxxxxlabs.nxxxx.lite
2021-06-10 14:55:40.929 1098-5744/? I/Camera2ClientBase: Camera 1: Opened. Client: com.nxxxxlabs.nxxxx.lite (PID 11110, UID 10266)
2021-06-10 14:55:40.929 1098-5744/? I/CameraDeviceClient: CameraDeviceClient 1: Opened
2021-06-10 14:55:40.930 1098-5744/? I/CameraProviderManager: Camera device device@3.3/legacy/1 torch status is now NOT_AVAILABLE
2021-06-10 14:55:40.930 1098-5744/? I/CameraService: onTorchStatusChangedLocked: Torch status changed for cameraId=1, newStatus=0
2021-06-10 14:55:40.930 1098-5744/? E/CameraService: onTorchStatusChangedLocked: cannot get torch status of camera 1: No such file or directory (-2)
2021-06-10 14:55:40.930 804-804/? D/CHIUSECASE: [chi_extend_open][142] "[OP_EXT] OPEN_CAMERA E cameraId 1"
2021-06-10 14:55:40.930 804-804/? I/OPCameraBinder: OPHWBinder
2021-06-10 14:55:40.931 919-2597/? D/AudioFlinger: setParameters(): io 0, keyvalue cameraFacing=front, calling pid 1237 calling uid 1000
2021-06-10 14:55:40.931 800-1061/? D/audio_hw_primary: adev_set_parameters: enter: cameraFacing=front
2021-06-10 14:55:40.931 800-1061/? D/audio_hw_hfp: hfp_set_parameters: enter
2021-06-10 14:55:40.931 800-1061/? D/audio_hw_hfp: hfp_set_parameters: enter
2021-06-10 14:55:40.931 800-1061/? D/audio_hw_extn: audio_extn_fm_set_parameters: Enter
2021-06-10 14:55:40.931 800-1061/? D/audio_hw_hfp: hfp_set_parameters: enter
2021-06-10 14:55:40.932 804-804/? D/CHIUSECASE: [initPackageName][2632] "[OP_EXT] com.nxxxxlabs.nxxxx.lite"
2021-06-10 14:55:40.932 804-804/? I/OPCameraBinder: ~OPHWBinder
2021-06-10 14:55:40.932 804-804/? D/CHIUSECASE: [chi_extend_open][146] "[OP_EXT] OPEN_CAMERA X"
2021-06-10 14:55:40.934 804-804/? E/CamX: [ERROR][HAL    ] camxhal3.cpp:47 NFCSendMessage() can't open file /data/nfc/nfc_pipe, Permission denied
2021-06-10 14:55:40.934 804-804/? E/CamX: [ERROR][HAL    ] camxhal3.cpp:455 open() camera 1 opened
2021-06-10 14:55:40.934 804-804/? I/OPCameraBinder: OPHWBinder
2021-06-10 14:55:40.936 804-804/? I/OPCameraBinder: ~OPHWBinder
2021-06-10 14:55:40.936 804-804/? I/OPCameraBinder: OPHWBinder
2021-06-10 14:55:40.929 804-804/? W/provider@2.4-se: type=1400 audit(0.0:8168): avc: denied { read } for name="u:object_r:default_prop:s0" dev="tmpfs" ino=14633 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=0
2021-06-10 14:55:40.937 804-804/? I/OPCameraBinder: ~OPHWBinder
2021-06-10 14:55:40.937 804-804/? E/libc: Access denied finding property "ro.camera.req.fmq.size"
2021-06-10 14:55:40.938 804-804/? E/libc: Access denied finding property "ro.camera.res.fmq.size"
2021-06-10 14:55:40.946 1098-5744/? W/CameraDeviceClient: createSurfaceFromGbp: Camera 1 with consumer usage flag: 256: Forcing asynchronous mode for stream
2021-06-10 14:55:40.947 1098-5744/? W/CameraDeviceClient: createSurfaceFromGbp: Camera 1: Overriding format 0x1 to IMPLEMENTATION_DEFINED
2021-06-10 14:55:40.952 804-804/? D/CHIUSECASE: [chi_initialize_override_session][217] "[OP_EXT] CREATE_SESSION E"
2021-06-10 14:55:40.976 804-804/? D/CHIUSECASE: [InitializeOverrideSession][1532] "[OP_EXT] CAM Perflock: Release Perflock 1 and acquire OPEN_CAMERA"
2021-06-10 14:55:40.977 804-804/? E/libc: Access denied finding property "persist.camera.opx.enable"
2021-06-10 14:55:40.977 804-804/? D/CHIUSECASE: [InitializeOverrideSession][1709] "[OP_EXT] CAM Perflock: Select powerHintType=4"
2021-06-10 14:55:40.977 804-804/? I/OP_META: OPMetaManager, addr 0xe3c67000, usecaseId 1
2021-06-10 14:55:40.977 804-804/? D/CHIUSECASE: [Initialize][2427] "[OP_EXT] stream = 0xe361c374 streamType = 0 streamFormat = 34 streamWidth = 640 streamHeight = 480"
2021-06-10 14:55:40.977 804-804/? D/CHIUSECASE: [Initialize][2427] "[OP_EXT] stream = 0xe361c314 streamType = 0 streamFormat = 35 streamWidth = 640 streamHeight = 480"
2021-06-10 14:55:40.977 804-804/? D/CHIUSECASE: [Initialize][2448] "[OP_EXT] Usecase UsecaseVideo selected"
2021-06-10 14:55:40.977 804-804/? D/CHIUSECASE: [Initialize][2466] "[OP_EXT][0/1], pipeline name:PreviewVideo, pipeline type:0, session id:0, camera id:1"
2021-06-10 14:55:40.969 804-804/? W/provider@2.4-se: type=1400 audit(0.0:8170): avc: denied { read } for name="u:object_r:default_prop:s0" dev="tmpfs" ino=14633 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=0
2021-06-10 14:55:40.983 804-804/? D/CHIUSECASE: [CreatePipeline][671] "[OP_EXT] CreatePipeline E PreviewVideo"
2021-06-10 14:55:40.984 804-804/? I/OPFDManager: Create
2021-06-10 14:55:40.984 804-804/? I/OPFDManager: FDManagerNode: E
2021-06-10 14:55:40.984 804-804/? I/OPFDManager: FDManagerNode: FDHWDimension: 640 x 480
2021-06-10 14:55:40.984 804-804/? I/OPFDManager: VendorFDLoad: FD lib ptr existed
2021-06-10 14:55:40.984 804-804/? I/OPFDManager: FDManagerNode: X
2021-06-10 14:55:40.984 804-804/? I/OPFDManager: FD manager node : max input ports 1, max output ports 4
2021-06-10 14:55:40.984 804-804/? I/OPFDManager: Dimensions :Base[640x480], Preview [640x480], Original [640x480], Request [640x480]
2021-06-10 14:55:40.985 804-804/? I/OPFDManager: FD frames processed 0 skipped 0 total frames 0
2021-06-10 14:55:40.985 804-804/? I/OPFDManager: VendorFDDeinit: FD deinit spends 0 ms (pending engine: 0)
2021-06-10 14:55:40.985 804-804/? D/CHIUSECASE: [FindBestSensorMode][596] "[OP_EXT] SelectedMode W=2304, H=1728, FPS:30, NumBatchedFrames:1, modeIndex:1"
2021-06-10 14:55:40.985 804-804/? D/CHIUSECASE: [CreatePipeline][752] "[OP_EXT] CreatePipeline X"
2021-06-10 14:55:40.985 804-804/? E/CHIUSECASE: [PipelineCreated][2670] "MULTIFRAME AdvancedCameraUsecase pipelineId: 0"
2021-06-10 14:55:40.986 804-804/? I/OPFDManager: Create
2021-06-10 14:55:40.986 804-804/? I/OPFDManager: FDManagerNode: E
2021-06-10 14:55:40.986 804-804/? I/OPFDManager: FDManagerNode: FDHWDimension: 640 x 480
2021-06-10 14:55:40.986 804-804/? I/OPFDManager: VendorFDLoad: FD lib ptr existed
2021-06-10 14:55:40.986 804-804/? I/OPFDManager: FDManagerNode: X
2021-06-10 14:55:40.986 804-804/? I/OPFDManager: FD manager node : max input ports 1, max output ports 4
2021-06-10 14:55:40.986 804-804/? I/OPFDManager: Dimensions :Base[640x480], Preview [640x480], Original [640x480], Request [640x480]
2021-06-10 14:55:41.004 804-804/? E/CamX: [ERROR][CORE   ] camxnode.cpp:4549 FinalizeInitialization() Node::IFE maxImageBuffers(8) from link properties should be atleast requiredMaxImageBuffers(11). So replacing maxImageBuffers with requiredMaxImageBuffers
2021-06-10 14:55:41.004 804-804/? I/chatty: uid=1047(cameraserver) provider@2.4-se identical 1 line
2021-06-10 14:55:41.004 804-804/? E/CamX: [ERROR][CORE   ] camxnode.cpp:4549 FinalizeInitialization() Node::IFE maxImageBuffers(8) from link properties should be atleast requiredMaxImageBuffers(11). So replacing maxImageBuffers with requiredMaxImageBuffers
2021-06-10 14:55:41.004 804-804/? E/CamX: [ERROR][CORE   ] camxnode.cpp:4549 FinalizeInitialization() Node::IFE maxImageBuffers(10) from link properties should be atleast requiredMaxImageBuffers(11). So replacing maxImageBuffers with requiredMaxImageBuffers
2021-06-10 14:55:41.004 804-804/? I/chatty: uid=1047(cameraserver) provider@2.4-se identical 6 lines
2021-06-10 14:55:41.004 804-804/? E/CamX: [ERROR][CORE   ] camxnode.cpp:4549 FinalizeInitialization() Node::IFE maxImageBuffers(10) from link properties should be atleast requiredMaxImageBuffers(11). So replacing maxImageBuffers with requiredMaxImageBuffers
2021-06-10 14:55:41.004 804-804/? E/CamX: [ERROR][CORE   ] camxnode.cpp:4549 FinalizeInitialization() Node::IPE maxImageBuffers(9) from link properties should be atleast requiredMaxImageBuffers(11). So replacing maxImageBuffers with requiredMaxImageBuffers
2021-06-10 14:55:41.004 804-804/? I/chatty: uid=1047(cameraserver) provider@2.4-se identical 1 line
2021-06-10 14:55:41.004 804-804/? E/CamX: [ERROR][CORE   ] camxnode.cpp:4549 FinalizeInitialization() Node::IPE maxImageBuffers(9) from link properties should be atleast requiredMaxImageBuffers(11). So replacing maxImageBuffers with requiredMaxImageBuffers
2021-06-10 14:55:41.004 804-804/? E/CamX: [ERROR][CORE   ] camxnode.cpp:4549 FinalizeInitialization() Node::IPE maxImageBuffers(10) from link properties should be atleast requiredMaxImageBuffers(11). So replacing maxImageBuffers with requiredMaxImageBuffers
2021-06-10 14:55:41.004 804-804/? E/CamX: [ERROR][CORE   ] camxnode.cpp:4549 FinalizeInitialization() Node::IPE maxImageBuffers(10) from link properties should be atleast requiredMaxImageBuffers(11). So replacing maxImageBuffers with requiredMaxImageBuffers
2021-06-10 14:55:41.021 804-804/? E/CamX: [ERROR][PPROC  ] camxipenode.cpp:2499 FinalizeBufferProperties() __debug: IPEInputPortFull: 1280 x 960
2021-06-10 14:55:41.029 804-804/? W/provider@2.4-se: type=1400 audit(0.0:8171): avc: denied { read } for name="u:object_r:default_prop:s0" dev="tmpfs" ino=14633 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=0
2021-06-10 14:55:41.032 804-804/? E/libc: Access denied finding property "persist.camera.aec.motionlog"
2021-06-10 14:55:41.029 804-804/? W/provider@2.4-se: type=1400 audit(0.0:8172): avc: denied { read } for name="u:object_r:default_prop:s0" dev="tmpfs" ino=14633 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=0
2021-06-10 14:55:41.032 804-804/? E/libc: Access denied finding property "persist.camera.aec.motionenable"
2021-06-10 14:55:41.037 804-804/? E/CamX: [ERROR][STATS_AEC] ctuningdataadapter.cpp:102: setChromatix m_numSelectors 2 mode 0 submode value 1 usecase 0 feature1 -675674112 feature2 0 scene -449363864 effect 1
2021-06-10 14:55:41.037 804-804/? E/CamX: [ERROR][HAL    ] camxmetadatapool.cpp:1434 GetMetadataByTag() Invalid Slot to get a metadata from
2021-06-10 14:55:41.037 804-804/? E/CamX: [ERROR][STATS_AEC] caeccoredatamanager.cpp:1268: getFrameHistory No start configuration is recorded in the history! 
2021-06-10 14:55:41.037 804-804/? E/CamX: [ERROR][STATS_AEC] caecmodarbitration.cpp:372: ArbitrateExposure start config: no exposure sync up
2021-06-10 14:55:41.037 804-804/? E/CamX: [ERROR][HAL    ] camxmetadatapool.cpp:1434 GetMetadataByTag() Invalid Slot to get a metadata from
2021-06-10 14:55:41.037 804-804/? E/CamX: [ERROR][HAL    ] camxmetadatapool.cpp:1587 SetMetadataByTag() Invalid slot; cannot set metadata tag 800a0005
2021-06-10 14:55:41.037 804-804/? E/CamX: [ERROR][HAL    ] camxmetadatapool.cpp:1743 PublishMetadataList() Invalid slot, cannot publish metadata list
2021-06-10 14:55:41.037 804-804/? E/CamX: [ERROR][HAL    ] camxmetadatapool.cpp:1434 GetMetadataByTag() Invalid Slot to get a metadata from
2021-06-10 14:55:41.037 804-804/? E/CamX: [ERROR][HAL    ] camxsession.cpp:3408 GetIntraRealtimePipelineId() Less than two realtime pipelines, no intra result
2021-06-10 14:55:41.038 804-804/? D/CamX: [DEBUG][STATS_AWB] camxcawbstatsprocessor.cpp:728 SetOperationModetoAlgo() Mode set to Algo: 1
2021-06-10 14:55:41.040 804-804/? E/CamX: [ERROR][HAL    ] camxsession.cpp:3408 GetIntraRealtimePipelineId() Less than two realtime pipelines, no intra result
2021-06-10 14:55:41.045 804-804/? E/libc: Access denied finding property "persist.camera.af.lcrEnable"
2021-06-10 14:55:41.039 804-804/? W/provider@2.4-se: type=1400 audit(0.0:8173): avc: denied { read } for name="u:object_r:default_prop:s0" dev="tmpfs" ino=14633 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=0
2021-06-10 14:55:41.047 804-804/? E/CamX: [ERROR][HAL    ] camxsession.cpp:3408 GetIntraRealtimePipelineId() Less than two realtime pipelines, no intra result
2021-06-10 14:55:41.048 804-804/? E/libc: Access denied finding property "persist.camera.disableVideoFinesearch"
2021-06-10 14:55:41.039 804-804/? W/provider@2.4-se: type=1400 audit(0.0:8174): avc: denied { read } for name="u:object_r:default_prop:s0" dev="tmpfs" ino=14633 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=0
2021-06-10 14:55:41.048 804-804/? I/mm-camera-CORE: [AFDBG] af_util_adjust_roi MainCamera = 1, Calculated new ROI: (922, 664, 460 400) roi_type:0 spotlight:0 lowlight:0 camif[2304,1728] zoom_ratio:1.000000
2021-06-10 14:55:41.048 804-804/? I/chatty: uid=1047(cameraserver) provider@2.4-se identical 1 line
2021-06-10 14:55:41.048 804-804/? I/mm-camera-CORE: [AFDBG] af_util_adjust_roi MainCamera = 1, Calculated new ROI: (922, 664, 460 400) roi_type:0 spotlight:0 lowlight:0 camif[2304,1728] zoom_ratio:1.000000
2021-06-10 14:55:41.048 804-804/? E/CamX: [ERROR][HAL    ] camxsession.cpp:3408 GetIntraRealtimePipelineId() Less than two realtime pipelines, no intra result
2021-06-10 14:55:41.048 804-804/? E/CamX: [ERROR][STATS_AF] camxautofocusnode.cpp:930 InitializeMultiStats() FATAL: Failed to get peer pipeline ID!
2021-06-10 14:55:41.076 804-804/? I/OPFDManager: FD node created in pipeline
2021-06-10 14:55:41.076 804-804/? I/OPFDManager: widthRatio=2.000000, heightRatio=2.000000
2021-06-10 14:55:41.076 804-804/? I/OPFDManager: CAMIF Map in ActiveArray (0, 0), 4608x3456
2021-06-10 14:55:41.076 804-804/? I/OPFDManager: VendorFDInit: E
2021-06-10 14:55:41.076 804-804/? E/libc: Access denied finding property "persist.camera.facelog.enable"
2021-06-10 14:55:41.076 804-804/? I/OPFDManager: VendorFDLoad_init_flag = Thread_Load_Init_Lib_OK
2021-06-10 14:55:41.069 804-804/? W/provider@2.4-se: type=1400 audit(0.0:8175): avc: denied { read } for name="u:object_r:default_prop:s0" dev="tmpfs" ino=14633 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=0
2021-06-10 14:55:41.076 804-804/? I/OPFDManager: VendorFDInit: X
2021-06-10 14:55:41.076 804-804/? E/OPFDManager: Succeed to create the face_attr_thread_loop thread
2021-06-10 14:55:41.076 804-804/? E/CamX: [ERROR][HAL    ] camxmetadatapool.cpp:1434 GetMetadataByTag() Invalid Slot to get a metadata from
2021-06-10 14:55:41.076 804-804/? E/CamX: [ERROR][HAL    ] camxmetadatapool.cpp:1434 GetMetadataByTag() Invalid Slot to get a metadata from
2021-06-10 14:55:41.077 804-804/? D/CHIUSECASE: [chi_initialize_override_session][221] "[OP_EXT] CREATE_SESSION X"
2021-06-10 14:55:41.077 1098-5744/? E/Camera3-Device: configureStreams: Stream 1: DataSpace override not allowed for format 0x23
2021-06-10 14:55:41.077 1098-5744/? E/Camera3-Device: configureStreamsLocked:2942 mOperatingMode is 0
2021-06-10 14:55:41.078 1098-5744/? E/Camera3-Device: configureStreamsLocked:2942 mOperatingMode is 0
2021-06-10 14:55:41.078 1098-5744/? D/Camera3-Device: Set real time priority for request queue thread (tid 11183)
2021-06-10 14:55:41.081 573-573/? I/hwservicemanager: getTransport: Cannot find entry android.hardware.graphics.allocator@3.0::IAllocator/default in either framework or device manifest.
2021-06-10 14:55:41.081 11110-11132/? W/Gralloc3: allocator 3.x is not supported
2021-06-10 14:55:41.092 11110-11138/? W/Unity: [OpenCVFaceDetection] Failed to find cascades definition

we can’t help with your unity env (not at all supported from opencv)
what do you expect us to find in your error logs ?

also, the arcane cascades are superseeded by cnn based methods now
(and there are plans to remove them entirely in the future)

basically, that’s a “file not found” problem.

what makes it worse is - your “assets” folder is not accessible to plain c functions (it’s probably inside some zipped apk)
look how the android demo is trying to work around it
(by copying it to some accessible location):

you said finding the file was not the problem but it seems to be.

where’s the code that emits that message?

if you think it’s the file format, here are the cascades and their git history over the years.

I literally said I wasn’t expecting help with unity, nor am I “expecting” you to find anything in the logcat if it looks like nonsense, I Was just hoping something jumped out. But since you asked, I don’t use the assets folder – I write to the persistent data folder and retrieve it from the persistent data path. And, as I said, this was working perfectly fine until I updated my plugin to the 4.5.2 version, so that highly suggests that it’s not loading the file for a reason other than it not being there.

I even checked my phone and the file is right there where I saved it and right there where I’m reading from.

Yeah, only because my code that copies the file to the persistent data folder, then reads from it, was working fine until I updated the library with the 4.5.2 version. That error message is from Unity, but it’s reading a return value from this method in cpp:

extern "C" int Init(int& outCameraWidth, int& outCameraHeight, String cascadeFileName)
{
	if (!_faceCascade.load(cascadeFileName))
		return -1;

	_capture.open(0);


	if (!_capture.isOpened())
		return -2;

	outCameraWidth = _capture.get(CAP_PROP_FRAME_WIDTH);
	outCameraHeight = _capture.get(CAP_PROP_FRAME_HEIGHT);
	return 0;
}

I know very little about android.

I know there are permissions that control whether access is granted… maybe those permissions vanished during the upgrade.

what methods do you have to check the existence and accessibility of the file from within the app, which are neither via OpenCV nor via another app?

I think you’re right, it has to be a permission thing somewhere. I grant the app all permissions in the phone’s settings though for camera, storage and location, so it wouldn’t be there. Hmm.

EDIT: I checked the repository you showed me, and it looks like the lpb file I’m using (lbpcascade_frontalface_improved.xml) has not been updated in many years, nor has the other one I was trying (lbpcascade_frontalface.xml).

is it possible that a library has its own permissions? just generating hypotheses here.

does anything else from OpenCV work/fail that accesses files, e.g. imread, VideoCapture, the FileStorage stuff?

I know the file name makes it into the c++ wrapper function that I have for accepting it, I know it’s the exact name of the persistent data path that it’s saved in (/storage/emulated/0/Android/data/com.xxxxx.xxxxxx.lite/files/lbpcascade_frontalface_improved.xml), and I know that it’s getting into this line of code:

if (!_faceCascade.load(cascadeFileName))
		return -1;

So the library file itself isn’t refusing permissions since that code is in the library. Unity is getting that -1 and displaying the “cascade definition not found” message. But of course, it’s the -1 I’m more interested in, not the debug text result I wrote myself in unity…

What I’m just wondering is, is there any other OpenCV condition that would generate a -1 other than a missing file? I feel like there must be.

If I could remember how to trace to the debug console within c++, I could check there as well and see if something weird is happening to the string of the file name or something.

to my knowledge, that path only exists on the emulation, not on a real device

Nah, according to unity documentation (not to take the conversation there or anything) that is the correct path for android internal storage, it just has a weird name. At this point I’m more concerned with seeing what’s going on inside my native wrapper and why it’s returning a -1 with the file name and path when the file is sitting there on my device and I can open it from the file explorer and see its contents.

I am starting to think that something’s going wrong when I pass the file path as a string from my end to a String parameter in my plugin wrapper method, which evidently is of type cv::String. Maybe there’s a more proper way to do this, other than relying on the plugin wrapper knowing the name of the file?

Okay, so it works now in the current master build version of the code at least. My path was correct after all, but for at least the last couple of days, the file name was being passed as a reference when it shouldn’t have been a reference. Still weird that this was working in 4.0.1 before the “fix” – maybe the old gnuc++ compiler from the older ndk with that version was more lenient with parameters.