_applied sciences_  
_Article_  
**Correction of Temperature from Infrared Cameras for More Precise As-Is 3D Thermal Models of Buildings**  
**[PERSON] 1,*\({}^{\copyright}\)**, [PERSON] 2\({}^{\copyright}\)**, [PERSON] 1\({}^{\copyright}\) and [PERSON] 3\({}^{\copyright}\)  
Footnote 1: [[https://www.mdpi.com/journal/applsci](https://www.mdpi.com/journal/applsci)]([https://www.mdpi.com/journal/applsci](https://www.mdpi.com/journal/applsci))  
Footnote 2: [[https://www.mdpi.com/journals/pdf/](https://www.mdpi.com/journals/pdf/)]([https://www.mdpi.com/journals/pdf/](https://www.mdpi.com/journals/pdf/))  
Footnote 3: [[https://www.mdpi.com/journals/pdf/](https://www.mdpi.com/journals/pdf/)]([https://www.mdpi.com/journals/pdf/](https://www.mdpi.com/journals/pdf/))  
Footnote 4: [[https://www.mdpi.com/journals/pdf/](https://www.mdpi.com/journals/pdf/)]([https://www.mdpi.com/journals/pdf/](https://www.mdpi.com/journals/pdf/))  
Footnote 5: [[https://www.mdpi.com/journals/pdf/](https://www.mdpi.com/journals/pdf/)]([https://www.mdpi.com/journals/pdf/](https://www.mdpi.com/journals/pdf/))  
==WARNING: Truncated because of repetitions==
order to correct this problem, a single scanner measurement (3D coordinates) but with a number \(n\) of consecutive thermal images of the same viewpoint of the scene are taken. In our system, this entails the system performing \(n\) complete turns (usually from 6 to 10) of 360\({}^{\circ}\), taking 10 thermal frames in each turn. These data are then used to carry out a statistical procedure for the \(n\) frames corresponding to each camera rotation, in which atypical images that we denominate as outliers will certainly be identified. The pseudocode of the outlier image filtering algorithm is shown in Algorithm 1. ```
1:procedureprocedure(\(n\))



++
```
Inputs: a \(\times\) n Ir_images: \(I_{a,t}\) (a = number of sessions, n = number of camera positions) \([dimx,dimy]=size(I_{a,t})\) Pixel_Threshold: Maximum deviation with respect to the variance: \(U_{p1}\) Image_Threshold: Maximum percentage of outlier pixels in \(I_{a,t}\): \(U_{p2}\) % Do for each session of the Ir_camera. FOR \(i=1\) TO \(a\) % Do for each pixel (x,y) of \(I_{a,t}\) FOR \(0<x<dimx\) @ \(0<y<dimy\) Temperature array assigned to (x,y) \(\rightarrow\)\(V_{i,t3}=\{I_{i,1}(x,y),I_{i,2}(x,y),\ldots I_{i,n}(x,y)\}\) % Do for each position of the Ir_camera  FOR \(j=1\) TO \(n\) % Label a pixel (x,y) in \(I_{i,j}\) as valid (0) or outlier (1): \(\rightarrow\)  IF \(|\overline{V_{i,xy}}-I_{i,j}(x,y)|<U_{p1}\), \(E_{i,j}(x,y)=0\) ELSE \(E_{i,j}(x,y)=1\) END END % Do for each position of the Ir_camera  FOR \(j=1\) TO \(n\) % Label \(I_{i,j}\) as valid or outlier  IF \(100*\frac{\sum E_{i,j}}{dimx\cdot dimy}<U_{p2}\), \(I_{i,j}\) is valid ELSE \(I_{i,j}\) is outlier END % Obtain the average thermal image of the i-th position of the Ir_camera \(I_{i}=\overline{I_{i,j}}\), \((j=1,\ldots n,I_{i,j}\) and \(I_{i,j}\) valid) END
```

**Algorithm 1**Algorithm for the detection of outlier images and the creation of valid average thermal images. This algorithm evaluates whether or not an image is classified as an outlier within a set of \(n\) images that should, in theory, be very close in terms of pixel temperature. This process is first based on the labelling at a pixel level, whereby each pixel in each image is labelled as an _outlier pixel_ or as a _valid pixel_. Depending on the percentage of the outlier pixels in an image, the image is ultimately labelled as an _outlier image_ or as a _valid image_. After performing this process, an average image is generated with the set of _valid images_. The temperature contained in this average image will, from here on, be denominated as the _apparent temperature_.