diff --git a/.gitignore b/.gitignore index 8017f67..47bd263 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,10 @@ /SDKs.DjiImage/obj /SDKs.DjiImage.Net45/obj /SDKs.DjiImage.Net45/bin +/SDKs.DjiImage.Net45/.vs /SDKs.DjiImage.Net48/bin /SDKs.DjiImage.Net48/obj +/SDKs.DjiImage.Net48/.vs /SDKs.DjiImage.Tests/obj /SDKs.DjiImage.Tests/bin /.vs \ No newline at end of file diff --git a/SDKs.DjiImage.Net45/Properties/AssemblyInfo.cs b/SDKs.DjiImage.Net45/Properties/AssemblyInfo.cs index f84ad58..ce3aacc 100644 --- a/SDKs.DjiImage.Net45/Properties/AssemblyInfo.cs +++ b/SDKs.DjiImage.Net45/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("745424554@qq.com")] [assembly: AssemblyProduct("SDKs.DjiImage.Net45")] -[assembly: AssemblyCopyright("Copyright(c) 2022-2023 jazous")] +[assembly: AssemblyCopyright("Copyright(c) 2022-2024 jazous")] [assembly: AssemblyTrademark("@jazous")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.2.0")] -[assembly: AssemblyFileVersion("1.4.2.0")] +[assembly: AssemblyVersion("1.4.3.0")] +[assembly: AssemblyFileVersion("1.4.3.0")] diff --git a/SDKs.DjiImage.Net45/Thermals/RJPEG.cs b/SDKs.DjiImage.Net45/Thermals/RJPEG.cs index 2d73fdf..f95b728 100644 --- a/SDKs.DjiImage.Net45/Thermals/RJPEG.cs +++ b/SDKs.DjiImage.Net45/Thermals/RJPEG.cs @@ -121,7 +121,7 @@ public static RJPEG FromStream(System.IO.Stream stream, bool leaveOpen = false) int code = img.Load(buffer); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(buffer).Value; + img._droneDji = Rdf.GetDroneDji(buffer) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -146,7 +146,7 @@ public static RJPEG FromBytes(byte[] bytes) int code = img.Load(bytes); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(bytes).Value; + img._droneDji = Rdf.GetDroneDji(bytes) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -178,7 +178,7 @@ public static RJPEG TryParse(System.IO.Stream stream, bool leaveOpen = false) int code = img.Load(buffer); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(buffer).Value; + img._droneDji = Rdf.GetDroneDji(buffer) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -202,7 +202,7 @@ public static RJPEG TryParse(byte[] bytes) int code = img.Load(bytes); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(bytes).Value; + img._droneDji = Rdf.GetDroneDji(bytes) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -336,6 +336,14 @@ public LTCollection GetEntries(System.Func predicate) return result; } /// + /// 获取缓冲区图片温度矩阵 + /// + /// + public float[,] GetTemp() + { + return _mData; + } + /// /// 获取图片指定位置的温度,超出图像范围返回 float.NaN /// /// diff --git a/SDKs.DjiImage.Net48/Properties/AssemblyInfo.cs b/SDKs.DjiImage.Net48/Properties/AssemblyInfo.cs index 80fff17..38f2bf9 100644 --- a/SDKs.DjiImage.Net48/Properties/AssemblyInfo.cs +++ b/SDKs.DjiImage.Net48/Properties/AssemblyInfo.cs @@ -11,7 +11,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("745424554@qq.com")] [assembly: AssemblyProduct("SDKs.DjiImage.Net48.dll")] -[assembly: AssemblyCopyright("Copyright(c) 2022-2023 jazous")] +[assembly: AssemblyCopyright("Copyright(c) 2022-2024 jazous")] [assembly: AssemblyTrademark("@jazous")] [assembly: AssemblyCulture("")] @@ -33,6 +33,6 @@ //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.2.0")] -[assembly: AssemblyFileVersion("1.4.2.0")] +[assembly: AssemblyVersion("1.4.3.0")] +[assembly: AssemblyFileVersion("1.4.3.0")] [assembly: NeutralResourcesLanguage("zh")] diff --git a/SDKs.DjiImage.Net48/Thermals/RJPEG.cs b/SDKs.DjiImage.Net48/Thermals/RJPEG.cs index 6626b96..63d9586 100644 --- a/SDKs.DjiImage.Net48/Thermals/RJPEG.cs +++ b/SDKs.DjiImage.Net48/Thermals/RJPEG.cs @@ -120,7 +120,7 @@ public static RJPEG FromStream(System.IO.Stream stream, bool leaveOpen = false) int code = img.Load(buffer); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(buffer).Value; + img._droneDji = Rdf.GetDroneDji(buffer) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -145,7 +145,7 @@ public static RJPEG FromBytes(byte[] bytes) int code = img.Load(bytes); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(bytes).Value; + img._droneDji = Rdf.GetDroneDji(bytes) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -177,7 +177,7 @@ public static RJPEG TryParse(System.IO.Stream stream, bool leaveOpen = false) int code = img.Load(buffer); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(buffer).Value; + img._droneDji = Rdf.GetDroneDji(buffer) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -201,7 +201,7 @@ public static RJPEG TryParse(byte[] bytes) int code = img.Load(bytes); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(bytes).Value; + img._droneDji = Rdf.GetDroneDji(bytes) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -335,6 +335,14 @@ public LTCollection GetEntries(System.Func predicate) return result; } /// + /// 获取缓冲区图片温度矩阵 + /// + /// + public float[,] GetTemp() + { + return _mData; + } + /// /// 获取图片指定位置的温度,超出图像范围返回 float.NaN /// /// diff --git a/SDKs.DjiImage.Tests/libv_hirp.dll b/SDKs.DjiImage.Tests/libv_hirp.dll new file mode 100644 index 0000000..ca382d8 Binary files /dev/null and b/SDKs.DjiImage.Tests/libv_hirp.dll differ diff --git a/SDKs.DjiImage/SDKs.DjiImage.csproj b/SDKs.DjiImage/SDKs.DjiImage.csproj index aa8f8e4..1aa96fb 100644 --- a/SDKs.DjiImage/SDKs.DjiImage.csproj +++ b/SDKs.DjiImage/SDKs.DjiImage.csproj @@ -7,7 +7,7 @@ enable True true - 1.4.2 + 1.4.3 jazous https://github.com/Jazous/SDKs-DjiImage.git https://github.com/Jazous/SDKs-DjiImage @@ -18,7 +18,7 @@ README.md zh True - Copyright(c) 2022-2023 jazous + Copyright(c) 2022-2024 jazous True AnyCPU none @@ -26,7 +26,7 @@ MIT ..\SDKs.snk obj\Release\net6.0\SDKs.DjiImage.xml - 1、修复读取御2行业进阶版照片报错的问题 + 1、RJPEG 添加 GetTemp 不带参数的方法,提供温度矩阵返回,方便用于直接返回给前端进行处理 745424554@qq.com $(AssemblyName).dll diff --git a/SDKs.DjiImage/Thermals/RJPEG.cs b/SDKs.DjiImage/Thermals/RJPEG.cs index 645b426..d956478 100644 --- a/SDKs.DjiImage/Thermals/RJPEG.cs +++ b/SDKs.DjiImage/Thermals/RJPEG.cs @@ -119,7 +119,7 @@ public static RJPEG FromStream(System.IO.Stream stream, bool leaveOpen = false) int code = img.Load(buffer); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(buffer).Value; + img._droneDji = Rdf.GetDroneDji(buffer) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -144,7 +144,7 @@ public static RJPEG FromBytes(byte[] bytes) int code = img.Load(bytes); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(bytes).Value; + img._droneDji = Rdf.GetDroneDji(bytes) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -176,7 +176,7 @@ public static RJPEG TryParse(System.IO.Stream stream, bool leaveOpen = false) int code = img.Load(buffer); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(buffer).Value; + img._droneDji = Rdf.GetDroneDji(buffer) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -200,7 +200,7 @@ public static RJPEG TryParse(byte[] bytes) int code = img.Load(bytes); if (code == 0) { - img._droneDji = Rdf.GetDroneDji(bytes).Value; + img._droneDji = Rdf.GetDroneDji(bytes) ?? RdfDroneDji.Empty; return img; } img.Dispose(); @@ -335,6 +335,14 @@ public LTCollection GetEntries(System.Func predicate) return result; } /// + /// 获取缓冲区图片温度矩阵 + /// + /// + public float[,] GetTemp() + { + return _mData; + } + /// /// 获取图片指定位置的温度,超出图像范围返回 float.NaN /// /// diff --git a/SDKs.DjiImage/Thermals/_skdlinux.cs b/SDKs.DjiImage/Thermals/_sdklinux.cs similarity index 95% rename from SDKs.DjiImage/Thermals/_skdlinux.cs rename to SDKs.DjiImage/Thermals/_sdklinux.cs index cd7dfdd..3b6fc1c 100644 --- a/SDKs.DjiImage/Thermals/_skdlinux.cs +++ b/SDKs.DjiImage/Thermals/_sdklinux.cs @@ -1,10 +1,10 @@ namespace SDKs.DjiImage.Thermals { - static class _skdlinux + static class _sdklinux { const string dllName = "libdirp.so"; [System.Runtime.InteropServices.DllImport(dllName, CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl)] - public extern static int dirp_create_from_rjpeg(byte[] data, int size, ref IntPtr ph); + public extern static int dirp_create_from_rjpeg(byte[] data, int size, ref System.IntPtr ph); [System.Runtime.InteropServices.DllImport(dllName, CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl)] public extern static int dirp_get_rjpeg_resolution(System.IntPtr h, ref dirp_resolution_t resolution); [System.Runtime.InteropServices.DllImport(dllName, CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl)] diff --git a/SDKs.DjiImage/Thermals/_tsdk.cs b/SDKs.DjiImage/Thermals/_tsdk.cs index 7efcb3f..2455bdf 100644 --- a/SDKs.DjiImage/Thermals/_tsdk.cs +++ b/SDKs.DjiImage/Thermals/_tsdk.cs @@ -10,27 +10,27 @@ static _tsdk() public static int dirp_create_from_rjpeg(byte[] data, int size, ref System.IntPtr ph) { - return isLinux ? _skdlinux.dirp_create_from_rjpeg(data, size, ref ph) : _sdkwin.dirp_create_from_rjpeg(data, size, ref ph); + return isLinux ? _sdklinux.dirp_create_from_rjpeg(data, size, ref ph) : _sdkwin.dirp_create_from_rjpeg(data, size, ref ph); } public static int dirp_get_rjpeg_resolution(System.IntPtr h, ref dirp_resolution_t resolution) { - return isLinux ? _skdlinux.dirp_get_rjpeg_resolution(h, ref resolution) : _sdkwin.dirp_get_rjpeg_resolution(h, ref resolution); + return isLinux ? _sdklinux.dirp_get_rjpeg_resolution(h, ref resolution) : _sdkwin.dirp_get_rjpeg_resolution(h, ref resolution); } public static int dirp_get_original(System.IntPtr h, byte[] raw_image, int size) { - return isLinux ? _skdlinux.dirp_get_original_raw(h, raw_image, size) : _sdkwin.dirp_get_original_raw(h, raw_image, size); + return isLinux ? _sdklinux.dirp_get_original_raw(h, raw_image, size) : _sdkwin.dirp_get_original_raw(h, raw_image, size); } public static int dirp_measure(System.IntPtr h, byte[] temp_image, int size) { - return isLinux ? _skdlinux.dirp_measure(h, temp_image, size) : _sdkwin.dirp_measure(h, temp_image, size); + return isLinux ? _sdklinux.dirp_measure(h, temp_image, size) : _sdkwin.dirp_measure(h, temp_image, size); } public static int dirp_get_measurement_params(System.IntPtr h, ref MeasureParam measurement_params) { - return isLinux ? _skdlinux.dirp_get_measurement_params(h, ref measurement_params) : _sdkwin.dirp_get_measurement_params(h, ref measurement_params); + return isLinux ? _sdklinux.dirp_get_measurement_params(h, ref measurement_params) : _sdkwin.dirp_get_measurement_params(h, ref measurement_params); } public static int dirp_destroy(System.IntPtr h) { - return isLinux ? _skdlinux.dirp_destroy(h) : _sdkwin.dirp_destroy(h); + return isLinux ? _sdklinux.dirp_destroy(h) : _sdkwin.dirp_destroy(h); } } } \ No newline at end of file