Hyperspectrum hyperspectralDetector =new Hyperspectrum(getApplicationContext());
HyperspectralConfiguration hyperspectralConfiguration = new HyperspectralConfiguration.Builder().setProcessMode(VisionConfiguration.MODE_IN).build();
hyperspectralDetector.setConfiguration(hyperspectralConfiguration);
HyperspectralResult hyperspectralResult = new HyperspectralResult();
ArrayList<ArrayList<Float>> visionArray = new ArrayList<>();
List<VisionData> visionData = new ArrayList<>();
for (List<Float> array : visionArray) {
visionData.add(VisionData.fromArray(array));
}
int resultCode = hyperspectralDetector.mapping(visionData, hyperspectralResult, null);
{
"resultCode":0,
"hyperspectralLength":"301",
"hyperspectralResult":"{
\"hyperspectral_detect_result\":[2363.7144,2346.1948,2326.457, ,…],
\"hyperspectral_wavelength_result\":[1350.0,1351.0,1352.0,…]}"
}
可以的,在mapping()方法中会默认启动引擎,如果引擎已经启动则不会再次启动,开发者可以放心使用。
请在应用不再使用高光谱能力时及时卸载模型,释放资源。
当前仅支持64位应用程序调用。