Skip to content

Commit

Permalink
1、RJPEG 添加 GetTemp 不带参数的方法,提供温度矩阵返回
Browse files Browse the repository at this point in the history
2、修复红外照片解析DroneJjid信息赋值问题
  • Loading branch information
Jazous committed Jun 15, 2024
1 parent 6e8ae94 commit eaf810d
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 29 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions SDKs.DjiImage.Net45/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("[email protected]")]
[assembly: AssemblyProduct("SDKs.DjiImage.Net45")]
[assembly: AssemblyCopyright("Copyright(c) 2022-2023 jazous")]
[assembly: AssemblyCopyright("Copyright(c) 2022-2024 jazous")]
[assembly: AssemblyTrademark("@jazous")]
[assembly: AssemblyCulture("")]

Expand All @@ -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")]
16 changes: 12 additions & 4 deletions SDKs.DjiImage.Net45/Thermals/RJPEG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -336,6 +336,14 @@ public LTCollection GetEntries(System.Func<int, int, float, bool> predicate)
return result;
}
/// <summary>
/// 获取缓冲区图片温度矩阵
/// </summary>
/// <returns></returns>
public float[,] GetTemp()
{
return _mData;
}
/// <summary>
/// 获取图片指定位置的温度,超出图像范围返回 float.NaN
/// </summary>
/// <param name="p"></param>
Expand Down
6 changes: 3 additions & 3 deletions SDKs.DjiImage.Net48/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("[email protected]")]
[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("")]

Expand All @@ -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")]
16 changes: 12 additions & 4 deletions SDKs.DjiImage.Net48/Thermals/RJPEG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -335,6 +335,14 @@ public LTCollection GetEntries(System.Func<int, int, float, bool> predicate)
return result;
}
/// <summary>
/// 获取缓冲区图片温度矩阵
/// </summary>
/// <returns></returns>
public float[,] GetTemp()
{
return _mData;
}
/// <summary>
/// 获取图片指定位置的温度,超出图像范围返回 float.NaN
/// </summary>
/// <param name="p"></param>
Expand Down
Binary file added SDKs.DjiImage.Tests/libv_hirp.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions SDKs.DjiImage/SDKs.DjiImage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Nullable>enable</Nullable>
<SignAssembly>True</SignAssembly>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.4.2</Version>
<Version>1.4.3</Version>
<Authors>jazous</Authors>
<RepositoryUrl>https://github.com/Jazous/SDKs-DjiImage.git</RepositoryUrl>
<PackageProjectUrl>https://github.com/Jazous/SDKs-DjiImage</PackageProjectUrl>
Expand All @@ -18,15 +18,15 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<NeutralLanguage>zh</NeutralLanguage>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Copyright>Copyright(c) 2022-2023 jazous</Copyright>
<Copyright>Copyright(c) 2022-2024 jazous</Copyright>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>none</ErrorReport>
<PackageTags>dji,thermal,r-jpeg</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<AssemblyOriginatorKeyFile>..\SDKs.snk</AssemblyOriginatorKeyFile>
<DocumentationFile>obj\Release\net6.0\SDKs.DjiImage.xml</DocumentationFile>
<PackageReleaseNotes>1、修复读取御2行业进阶版照片报错的问题</PackageReleaseNotes>
<PackageReleaseNotes>1、RJPEG 添加 GetTemp 不带参数的方法,提供温度矩阵返回,方便用于直接返回给前端进行处理</PackageReleaseNotes>
<Company>[email protected]</Company>
<Product>$(AssemblyName).dll</Product>
</PropertyGroup>
Expand Down
16 changes: 12 additions & 4 deletions SDKs.DjiImage/Thermals/RJPEG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -335,6 +335,14 @@ public LTCollection GetEntries(System.Func<int, int, float, bool> predicate)
return result;
}
/// <summary>
/// 获取缓冲区图片温度矩阵
/// </summary>
/// <returns></returns>
public float[,] GetTemp()
{
return _mData;
}
/// <summary>
/// 获取图片指定位置的温度,超出图像范围返回 float.NaN
/// </summary>
/// <param name="p"></param>
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
12 changes: 6 additions & 6 deletions SDKs.DjiImage/Thermals/_tsdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit eaf810d

Please sign in to comment.