| | |
| | | import com.whyc.dto.Point; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.TempPoint; |
| | | import com.whyc.hik.ChannelParamCfg; |
| | | import com.whyc.hik.Commom.osSelect; |
| | | import com.whyc.hik.DevManager; |
| | | import com.whyc.hik.NetSDKDemo.HCNetSDK; |
| | | import com.whyc.hik.SdkSysCfg; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.FileOutputStream; |
| | |
| | | m_strJpegWithAppendData.dwJpegPicLen = 2*1024*1024; |
| | | m_strJpegWithAppendData.dwP2PDataLen = 2*1024*1024; |
| | | m_strJpegWithAppendData.write(); |
| | | Map<String, TempPoint> tempPointMap; |
| | | Map<String, Object> tempPointMap; |
| | | boolean resBoolean = hCNetSDK.NET_DVR_CaptureJPEGPicture_WithAppendData(lUserID, 2, m_strJpegWithAppendData); |
| | | if (resBoolean) { |
| | | System.out.println("抓图成功"); |
| | |
| | | fos.write(pP2PDataBuff.getByteArray(0, m_strJpegWithAppendData.dwP2PDataLen), 0, m_strJpegWithAppendData.dwP2PDataLen); |
| | | |
| | | //获取红外结果并解析 |
| | | tempPointMap = analyzeData(m_strJpegWithAppendData.dwP2PDataLen, cFilename, cFilename2); |
| | | tempPointMap = analyzeData(m_strJpegWithAppendData, cFilename, cFilename2); |
| | | }else { |
| | | System.out.printf("抓热图失败:%s",hCNetSDK.NET_DVR_GetLastError()); |
| | | return new Response().set(1,false,String.format("抓热图失败:%s",hCNetSDK.NET_DVR_GetLastError())); |
| | |
| | | return true; |
| | | } |
| | | |
| | | public Map<String,TempPoint> analyzeData(int dwP2PDataLen, String cFilename, String cFilename2) throws IOException { |
| | | Map<String,TempPoint> tempMap = new HashMap<String, TempPoint>(); |
| | | public Map<String,Object> analyzeData(HCNetSDK.NET_DVR_JPEGPICTURE_WITH_APPENDDATA m_strJpegWithAppendData, String cFilename, String cFilename2) throws IOException { |
| | | Map<String,Object> tempMap = new LinkedHashMap<>(); |
| | | // 打开本地保存的文件 |
| | | String inputFilename = cFilename; |
| | | String outputFilename = cFilename2; |
| | | |
| | | int m_AnalysisHotPic_W = 384; // 根据抓热图接口返回的图像宽dwJpegPicWidth进行赋值 |
| | | int m_AnalysisHotPic_H = 288; // 根据抓热图接口返回的图像高dwJpegPicHeight进行赋值 |
| | | //int m_AnalysisHotPic_W = 384; // 根据抓热图接口返回的图像宽dwJpegPicWidth进行赋值 |
| | | //int m_AnalysisHotPic_H = 288; // 根据抓热图接口返回的图像高dwJpegPicHeight进行赋值 |
| | | int m_AnalysisHotPic_W = m_strJpegWithAppendData.dwJpegPicWidth; // 根据抓热图接口返回的图像宽dwJpegPicWidth进行赋值 |
| | | int m_AnalysisHotPic_H = m_strJpegWithAppendData.dwJpegPicHeight; // 根据抓热图接口返回的图像高dwJpegPicHeight进行赋值 |
| | | int bufSize = m_AnalysisHotPic_H * m_AnalysisHotPic_W * 4; |
| | | |
| | | try (RandomAccessFile datafilefp = new RandomAccessFile(inputFilename, "r"); |
| | |
| | | |
| | | System.out.println("Min Temperature: " + minTempPoint); |
| | | System.out.println("Max Temperature: " + maxTempPoint); |
| | | tempMap.put("pixelX",m_strJpegWithAppendData.dwJpegPicWidth); |
| | | tempMap.put("pixelY",m_strJpegWithAppendData.dwJpegPicHeight); |
| | | tempMap.put("minTempPoint",minTempPoint); |
| | | tempMap.put("maxTempPoint",maxTempPoint); |
| | | } |