'Loading images from internal storage kivy python

I am looking for a solution regarding loading images from internal storage file manager via my kivy application.

for testing,i need to select the image from internal storage and then convert it into gray scale image by using opencv.

I have tried filechooserlistview,but however i could not access my internal storage.

I have also added below mentioned line in my buildozer.spec file. android.permissions = READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE

i'm searching for this solution for the last two days but i didn't get any proper result yet.

Please share the code if anything you have. Thanks in advance



Solution 1:[1]

Try with path /storage/emulated/0/

As an example, mention it in your .kv file

#:import platform kivy.utils.platform
FileChooserListView:
    rootpath: '/storage/emulated/0/' if platform == 'android' else '/'

Solution 2:[2]

In newer Android systems, the buildozer permission request for accessing the storage is not working with kivy.
To acquire these permissions you have to ask for them in your app by:

from android.permissions import request_permissions, Permission
request_permissions([Permission.WRITE_EXTERNAL_STORAGE,
                     Permission.READ_EXTERNAL_STORAGE])

... and the user will be asked to your App to access the storage.
The android library is included in the buildozer builds, so that request is all you have to do...

To get the internal storage path:

from android.storage import primary_external_storage_path
SD_CARD = primary_external_storage_path()

Note that this is the virtual (internal) SD card of the system.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Niteesh
Solution 2