chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
844 stars 133 forks source link

Adding a opencv2-python wheel file for python3.10 #1280

Closed Storkycold closed 1 week ago

Storkycold commented 1 week ago

Chaquopy version

Chaquopy 15.0

Relevant parts of your build.gradle file

build.gradle.kts

chaquopy {
    defaultConfig {
        version = "3.10"
        pip {
            // private package 
            install("mai.data==0.0.11")
            options("--no-deps")
            options("--index-url=http://****")
            options("--trusted-host=****")
            // private package 
            install("mai.converter==2.0.25")
            options("--no-deps")
            options("--index-url=http://****")
            options("--trusted-host=****")

            install("-r", "./requirements_dep.txt")
        }
    }
}

requirements_dep.txt

fastapi[standard]==0.115.0
pydicom==2.3
mysql-connector-python==8.2.0
xmltodict==0.13.0
chardet==5.2.0
pyATC==1.0.6
defusedxml==0.7.1 # sierraecg
numpy==1.23.3
chaquopy-libcxx
chaquopy-openblas
chaquopy-libgfortran
scipy==1.8.1
pandas==1.5.0
pycryptodome==3.9.4
pydantic==2.9.2
pydantic-core==2.23.4
pymongo==4.4.1
wfdb==4.1.2

Describe your issue

My Python version is 3.10. Downgrading to 3.8 is not an option.

I am currently using the interpolation feature within the opencv2-python package to resample time-series data signals. However, when attempting to run this Python code in an Android environment using Chaquopy, I encountered the issue that there isn’t a wheel file available at https://chaquo.com/pypi-13.1/opencv-python/ for this package. As a result, we currently have only a partial setup that excludes resampling for data types requiring interpolation. To correctly resample signals regardless of data type, having an opencv2-python wheel file compatible with Python 3.10 would be highly beneficial.

ref: https://docs.opencv.org/3.4/da/d54/group__imgproc__transform.html

resample_signal code

import cv2 
...
    def resample_signal(self, ecg, method="INTER_CUBIC"):
        rate_resample = self.sampling_rate_org / self.sampling_rate
        if rate_resample % 1 == 0:
...
            ecg = ecg[****]
#         else:
#             ecg = cv2.resize(
#                 ecg,
#                 dsize=(****),
#                 interpolation=getattr(cv2, method),
#             )
        return ecg
mhsmith commented 1 week ago

Thanks for the request. We're not planning to make any more builds of this package in the near future, but please subscribe to #779 to be notified when we do.

There's also a link there with instructions if you want to try building the package yourself.