Sunday
Sunday

Reputation: 129

how to use hikvision thermal camera temperature interval measure api with c#

private async void StartServer()
{
    HttpListeningServer server = new HttpListeningServer("http://192.168.0.191:8080");

    await server.StatAsync(async request => 
    {
         switch (request.HttpMethod)
         {
              case "GET"
                  break
              case "POST"
                  using (var reader = new StreamReader(request.InputStream))
                  {
                       var bodyContent = await reader.ReadToEndAsync();
                       var xmlContentString = bodyContent.Split("--boundary").Where(x=>x != "").ToList();
                       var extractedContents = d[0].Split("\r\n").Where(x=>x != "").ToList()
                       string xmlString = string.Empty;
                       
                       for(int i = 3 i < extractedContents.Count; i++)
                       {
                            xmlString += "\r\n" + extractedContents[i];
                       }

                       var result = xmlHelper<EventNotificationAlert>.DeserializeFromXml(xmlString);
                  }
                  break;
         }
    }
}

Open the Http Server with the following ports and addresses "/ISAPI/Event/notification/httpHosts" registered the server address via API.

I succeeded in receiving events such as TMA, TMPA, etc. by referring to API documents, and now I'm about to receive a temperature interval measurement event.

enter image description here

"/ISAPI/Thermal/capabilities" api is normally displayed as true when determined whether the function is supported or not.

"/ISAPI/Thermal/channels/{channelId}/thermometry/realTimethermometry/rules" api was tried to check the current rule, but InvalidOperation returned as a result of API call. The same is true of requests sent to POST.

enter image description here

I thought I could get a temperature value every N seconds on a regular basis if I set it up.

Accessing Thermography data from a HikVision IP Camera

I also referred to the link above, but I was able to get the picture, but it didn't seem to be a way to get the temperature data.

If anyone has done this, please tell me what I misunderstand or missed

Add to 20230420

There was something I was missing about "/ISAPI/Thermal/channels/channelid/thermometry/senceId" from the above question. The actual price is different from the document I have.

    <?xml version="1.0" encoding="UTF-8"?>
<ThermometryScene version="2.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">
    <id>
        1
    </id>
    <normalizedScreenSize>
        <normalizedScreenWidth>
            1000
        </normalizedScreenWidth>
        <normalizedScreenHeight>
            1000
        </normalizedScreenHeight>
    </normalizedScreenSize>
    <ThermometryRegionList>
        <ThermometryRegion>
            <id>
                1
            </id>
            <enabled>
                true
            </enabled>
            <name>
                1
            </name>
            <emissivity>
                0.96
            </emissivity>
            <distance>
                400
            </distance>
            <reflectiveEnable>
                true
            </reflectiveEnable>
            <reflectiveTemperature>
                20.0
            </reflectiveTemperature>
            <type>
                region
            </type>
            <Region>
                <RegionCoordinatesList>
                    <RegionCoordinates>
                        <positionX>
                            26
                        </positionX>
                        <positionY>
                            982
                        </positionY>
                    </RegionCoordinates>
                    <RegionCoordinates>
                        <positionX>
                            19
                        </positionX>
                        <positionY>
                            32
                        </positionY>
                    </RegionCoordinates>
                    <RegionCoordinates>
                        <positionX>
                            961
                        </positionX>
                        <positionY>
                            26
                        </positionY>
                    </RegionCoordinates>
                    <RegionCoordinates>
                        <positionX>
                            971
                        </positionX>
                        <positionY>
                            976
                        </positionY>
                    </RegionCoordinates>
                    <RegionCoordinates>
                        <positionX>
                            971
                        </positionX>
                        <positionY>
                            976
                        </positionY>
                    </RegionCoordinates>
                </RegionCoordinatesList>
            </Region>
            <distanceUnit>
                centimeter
            </distanceUnit>
            <emissivityMode>
                customsettings
            </emissivityMode>
        </ThermometryRegion>
    </ThermometryRegionList>
</ThermometryScene>

The above result is the result of inquiring with ISAPI of my camera. However, the data differ from the examples of the resulting values provided by the "/ISAPI/Thermal/channels/channelId/thermometry/senceId/capabilities" api. The results of the API are as follows

<?xml version="1.0" encoding="UTF-8"?>
<ThermometryScene version="2.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">
    <normalizedScreenSize>
        <normalizedScreenWidth>
            1000
        </normalizedScreenWidth>
        <normalizedScreenHeight>
            1000
        </normalizedScreenHeight>
    </normalizedScreenSize>
    <ThermometryRegionList size="21">
        <ThermometryRegion>
            <id min="1" max="21" />
            <enabled opt="true,false" />
            <name min="0" max="32" />
            <emissivity min="0.01" max="1" />
            <distance min="0" max="65500" />
            <reflectiveEnable opt="true,false" />
            <reflectiveTemperature min="-73.3" max="1000.0">
                20.0
            </reflectiveTemperature>
            <type opt="point,region,line" />
            <Point>
                <TempValue min="-273" max="10000" />
                <CalibratingCoordinates>
                    <positionX min="0" max="1000" />
                    <positionY min="0" max="1000" />
                </CalibratingCoordinates>
            </Point>
            <Region>
                <highestTempValue min="-273" max="10000" />
                <lowestTempValue min="-273" max="10000" />
                <averageTempValue min="-273" max="10000" />
                <diffTempValue min="-273" max="10000" />
                <RegionCoordinatesList size="10">
                    <RegionCoordinates>
                        <positionX min="0" max="1000" />
                        <positionY min="0" max="1000" />
                    </RegionCoordinates>
                </RegionCoordinatesList>
            </Region>
            <Line>
                <highestTempValue min="-273" max="10000" />
                <lowestTempValue min="-273" max="10000" />
                <RegionCoordinatesList size="2">
                    <RegionCoordinates>
                        <positionX min="0" max="1000" />
                        <positionY min="0" max="1000" />
                    </RegionCoordinates>
                </RegionCoordinatesList>
            </Line>
            <distanceUnit opt="meter,feet,centimeter" />
            <emissivityMode opt="rougher,rough,smooth,smoother,customsettings" />
            <RegionBoundary>
                <RegionCoordinatesList size="4">
                    <RegionCoordinates>
                        <positionX>
                            10
                        </positionX>
                        <positionY>
                            990
                        </positionY>
                    </RegionCoordinates>
                    <RegionCoordinates>
                        <positionX>
                            990
                        </positionX>
                        <positionY>
                            990
                        </positionY>
                    </RegionCoordinates>
                    <RegionCoordinates>
                        <positionX>
                            990
                        </positionX>
                        <positionY>
                            10
                        </positionY>
                    </RegionCoordinates>
                    <RegionCoordinates>
                        <positionX>
                            10
                        </positionX>
                        <positionY>
                            10
                        </positionY>
                    </RegionCoordinates>
                </RegionCoordinatesList>
            </RegionBoundary>
            <regionMode>
                polygon
            </regionMode>
        </ThermometryRegion>
        <maxPointNum>
            10
        </maxPointNum>
        <maxLineNum>
            1
        </maxLineNum>
        <maxRegionNum>
            10
        </maxRegionNum>
    </ThermometryRegionList>
</ThermometryScene>

As above, it should definitely contain a value for temperature, but it is provided without it.

It seems to be a problem that can be solved only by asking Hikvision for technical support. If anyone is still thinking about this question, thank you.

Upvotes: 0

Views: 922

Answers (0)

Related Questions