Giter VIP home page Giter VIP logo

thermimage's People

Contributors

gtatters avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thermimage's Issues

Info about metadata

This is issue isn't for feature suggestion or bugs itself; it's more about what some metadata really means.

I've been looking for info on the web but found nothing. I realised there are two metadata embedded on FLIR images called OffsetX and OffsetY. Any idea about what is it?

ATA1-2, ATB1-2, ATX are no constants

Dear Glenn,

in your temp2raw function description you are stating that the above-mentioned parameters are supposed to be used as implemented as they are constants (Line 40-41):

Keep these humidity parameters in since they are set constants required for a calculation
ATA1<-0.006569; ATA2<-0.01262; ATB1<--0.002276; ATB2<--0.00667; ATX<-1.9

Looking through my images and their EXIF information it seems that these constants change depending on the camera model. For my images/camera the "constants" are:

AtmosphericTransAlpha1 , Value : 1.23900001369748e-08
Key : APP1:AtmosphericTransAlpha2 , Value : 1.10949995857368e-08
Key : APP1:AtmosphericTransBeta1 , Value : 0.00317999999970198
Key : APP1:AtmosphericTransBeta2 , Value : 0.00318020000122488
Key : APP1:AtmosphericTransX , Value : 0.73199999332428

I have not tested yet how this impacts the conversion, but I thought I let you know.

Cheers,
René

Please find attached another example image for you to check my statement.

FLIR9027

Thermimage - convertflirVID, Warning messages: 1- in system2, 2- in file.remove

Describe the bug
Hi
I want to convert an .SEQ file and use this code and this is the warning:

my file to convert

library(Thermimage)
setwd("C: .../Thermimage/extdata")

exiftoolpath <- "installed"
perlpath <- "installed"

f<-"SampleSEQ.seq"
 
# if JPG contains raw thermal image as TIFF, endian = "lsb"
# if JPG contains raw thermal image as PNG,  endian = "msb"

vals<-flirsettings(f)
w<-vals$Info$RawThermalImageWidth
h<-vals$Info$RawThermalImageHeight
res.in<-paste0(w,"x",h)


convertflirVID(f, exiftoolpath="installed", perlpath="installed",
               fr=30, res.in=res.in, res.out=res.in, outputcompresstype="jpegls", outputfilenameroot=NULL,
               outputfiletype="png", outputfolder="output", verbose=FALSE)

[1] FALSE
Warning messages:
1: In system2("ffmpeg", args = args, stdout = TRUE) :
running command '"ffmpeg" -r 30 -f image2 -vcodec tiff -s 640x480 -i "temp/frame%05d.tiff" -vcodec jpegls -s 640x480 "output/SampleSEQ.seq.avi" -y' had status 1
2: In file.remove("./temp") :
cannot remove file './temp', reason 'Permission denied'

what's is the error?, I installed Perl and Imagemagick (.exe)

the version is

R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=Spanish_Chile.1252 LC_CTYPE=Spanish_Chile.1252 LC_MONETARY=Spanish_Chile.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Chile.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] Thermimage_4.0.0

loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 reshape_0.8.8 assertthat_0.2.1 dplyr_0.8.3 crayon_1.3.4 plyr_1.8.4
[7] R6_2.4.0 grid_3.6.1 gtable_0.3.0 GGally_1.4.0 magrittr_1.5 scales_1.0.0
[13] ggplot2_3.2.1 pillar_1.4.2 rlang_0.4.0 lazyeval_0.2.2 rstudioapi_0.10 RColorBrewer_1.1-2
[19] tools_3.6.1 glue_1.3.1 purrr_0.3.2 munsell_0.5.0 compiler_3.6.1 pkgconfig_2.0.2
[25] colorspace_1.4-1 tidyselect_0.2.5 tibble_2.1.3

flirsetting

Hi.
I am trying to extract metadata using "flirsetting" function.
d<-flirsettings(img,exiftoolpath = "C:/",camvals = "")##notworking
I get the error:
Error in system2(syscommand, args = paste0(shQuote(imagefile), " ", camvals), :
'CreateProcess' failed to run 'C:\exiftool.exe "4007" "4005" "4005" "4014" "4012" "4010" "4006" "3990" "3998" "4005" "3990" "4000" "3987" "3987" "3996" "4001" "3996" "3990" "4007" "4000" "3999" "3999" "3993" "4006" "4002" "3994" "3993" "3991" "3988" "3996" "3992" "4010" "4008" "4014" "4007" "4003" "3992" "4012" "4008" "4015" "4017" "4017" "4012" "4016" "4015" "4025" "4039" "4038" "4065" "4086" "4120" "4152" "4168" "4194" "4203" "4210" "421

At the same time I can run the raw2temp function but just getting a matrix of NaN values.

The raw images where taken using a FLIR TAU 2 sensor. The readflirJPG function worked correctly.
R vesion 3.6.3; R studio: 1.2.5033; Thermimage:4.0.1
many thanks
Matteo

Importing images causes loss of resolution

Hi Glenn,

When I am importing images and then using dim(), it'll read a resolution much smaller than the original picture. For example, the original resolution is 320x240, but the output of the function reads 80x60.
I'm not sure why this happens since I followed the your tutorial and this didn't happen with your sample image.
Any help or insight to why this is happening is much appreciated!

Thanks!

DN to Temp conversion results in a data matrix that exceeds (696, 928) the dimensions of the original camera resolution (640x480)

Issue
Dear Glenn,
I am using a batch function, based on your package function, to convert thermal image digital numbers into temperature values. Today I stumbled upon the fact that the exported data matrix containing the T values is larger (696, 928) than the original camera resolution (640x480). I can´t think of anything that results in this behavior and would appreciate some input if possible.

Thanks a lot,

René

To Reproduce
I guess you only need my function and some images to reproduce my results:

`#' Converting digital numbers (DN), stored in a FLIR thermal jpg compressed image,
#' into temperature (T) values. A temperature matrix is exported. The conversion
#' is performed based on the conversion function implemented into the Thermimage
#' package written by Tattersall GJ.
#'
#' @param imgpath
#' @param searchpattern
#' @param out
#' @return
#' @examples
#' @details

flirdn2temp <- function(imgpath, searchpattern, out){
#"data/raw/20190912/"
#"*.jpg"
require(Thermimage)
require(exiftoolr)

exif_version() #Evaluate whether exiftool is installed

ldf <- list() # creates a list to store thermal images
vec.jpg <- dir(path = imgpath, pattern = searchpattern) # creates a vector containing all image names

for (k in 1:length(vec.jpg)){ldf[[k]] <- readflirJPG(paste(imgpath,
sep="/",
vec.jpg[k]),
exiftoolpath = "C:\Windows\")} # loops through file names stored in vec.jpg and pastes them to the absolute path of the image folder, loads images in a list

settings <- flirsettings(paste(imgpath, sep="/", vec.jpg[1]), exiftoolpath = "installed")

truetemp <- list()

for (i in 1:length(ldf)){

truetemp[[i]] <- raw2temp(ldf[[i]],
                          E = settings$Info$Emissivity,
                          OD = settings$Info$SubjectDistance,
                          RTemp = settings$Info$ReflectedApparentTemperature,
                          ATemp = settings$Info$AtmosphericTemperature,
                          IRWTemp = settings$Info$IRWindowTemperature,
                          IRT = settings$Info$IRWindowTransmission,
                          RH = settings$Info$RelativeHumidity,
                          PR1 = settings$Info$PlanckR1,
                          PB = settings$Info$PlanckB,
                          PF = settings$Info$PlanckF,
                          PO = settings$Info$PlanckO,
                          PR2 = settings$Info$PlanckR2)

}

h = settings$Info$RawThermalImageHeight
w = settings$Info$RawThermalImageWidth

for (k in 1:length(truetemp)){

write.csv(truetemp[[k]], file = paste(out, vec.jpg[[k]], sep = "", "matrix.csv"),row.names=FALSE)  

}
}`

IMG_9038
IMG_9039

Expected behavior
I would expect the output matrix of the attached function to produce a matrix that is larger than the possible image resolution (640x480).

Screenshots
Not applicable.

Thanks for looking into it.

René

convertflirJPG() seems to think flir jpg files are empty

When using the convertflirJPG() function the exiftool command prompt call seems to think that the FLIR.jpg files are empty, even though they are not and CAN be imported into R with the readflirJPG() command.

The resulting error message from exiftool is: "Error: File is empty - -"

My call of the convertflirJPG():

convertflirJPG(C:/git/IR_60901.jpg, exiftoolpath="installed", res.in="640x480", endian="lsb", outputfolder=, verbose=TRUE)

Any thoughts?
Much appreciated!

(Image being referenced attached)
IR_60901

AFF SEQ Files

This is more of a comment than issue:

I have an ancient FLIR SC6000 camera which came with even more ancient software for camera control/data acquisition called ExaminIR v. 1.20, so called, Basic version (as opposed to Pro and Max).

The basic version records thermal movies as files with an extension .SEQ. Their header suggests it is an Agema File Format (AFF) for sequence of thermal images. The exiftool cannot read these files (reviewing its source code suggests only the files with header FFF can be read). Flir software tools cannot read the format either (tested with ResearchIR, and so forth).
I was wondering if you had insights into AFF beyond what exiftool does and does not provide. Do you have a copy of later version of Examin IR, or Pro or Max?

Currently, for me the only way to get the frames out without relying on a supply of graduate students or interns, is to do some desktop programming, and have that program move the cursor around to extract the images into csv files, but this takes 20seconds/frame.

Thanks,

Bug in readflirJPG function?

Hi there,

I've used the package previously (just a few months ago) and everything worked fine before, but now when I try to use the readflirJPG function the error below occurs.

Screen Shot 2020-02-06 at 11 27 44 AM

I'm not sure how to fix this since I didn't code for cams$Info$RawThermalImageType yet an error for it pops up, and I can't seem to find the argument within the Thermimage cran or the github page.
I'm using a Mac, I updated R, Rstudio, and the package.

The error occurs when I try to use readflirJPG singly and when I set up a loop as shown below
Screen Shot 2020-02-10 at 12 58 56 PM
imgDir is just defined as the directory to find the files, and the variables for raw2temp are defined within the chunk above this code.

Thanks!

readflirJPG doesn't like file paths with spaces in

Hullo,

Some of my files have spaces in the path (Google Drive's fault: "C:/Users/Rebecca/Google Drive/files"), which I thought worked in the past but my current version of Thermimage (3.1.0) doesn't seem to like it. For this image, this works fine:

library(Thermimage)
test1 <- readflirJPG("C:/Temp/without_spaces/FLIR8563.jpg")

But adding a space:
test2 <- readflirJPG("C:/Temp/with spaces/FLIR8563.jpg")

I get:

File not found: C:/Temp/with
File not found: spaces/FLIR8563.jpg
Error in embed(vect, length(fid)) : wrong embedding dimension
In addition: Warning message:
In shell(paste(syscommand, imagefile, vals)) :
  'exiftool C:/Temp/with spaces/FLIR8563.jpg -b > tempfile' execution failed with error code 1
Timing stopped at: 0.04 0 0.23

My session info is below. Thanks in advance - great package!

Rebecca

R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Thermimage_3.1.0

loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0    yaml_2.1.18    png_0.1-7

Thermimage / Error in system2

Hello,
I am following the link (https://github.com/gtatters/Thermimage) to analyze my Thermal images, but I found an error when I try to read image. The code I am using is :

imagefile<-paste0(system.file("extdata/IR_2412.jpg", package="Thermimage"))
cams<-flirsettings(imagefile, exiftool="installed", camvals="")

but I found this error,

Error in system2(syscommand, args = paste0(shQuote(imagefile), " ", camvals), :
'CreateProcess' failed to run 'C:\windows\exiftool.exe "C:/Users/washfaq/Documents/R/win-library/3.6/Thermimage/extdata/IR_2412.jpg"

My session info is below;

R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] exifr_0.3.1 installr_0.21.3 stringr_1.4.0 Thermimage_3.2.1

loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 fansi_0.4.0 assertthat_0.2.1 zeallot_0.1.0 utf8_1.1.4 crayon_1.3.4
[7] rappdirs_0.3.1 plyr_1.8.4 backports_1.1.4 jsonlite_1.6 magrittr_1.5 pillar_1.4.1
[13] cli_1.1.0 rlang_0.3.4 stringi_1.4.3 rstudioapi_0.10 vctrs_0.1.0 tools_3.6.0
[19] yaml_2.2.0 compiler_3.6.0 pkgconfig_2.0.2 tibble_2.1.3

Any idea what might be going wrong? Thanks
Waseem

Getting random frame extraction times

Hi,
I am trying to get frame times following the code given as example. But I am getting random times for extracted frames. My file is pretty large i.e. 64MB.
How can I solve this?

Thanks.

Error in writeBin & total frames

I have the next message:

Error in writeBin(temperature, wb, size = 4, endian = "little") :
only 2^31-1 bytes can be written in a single writeBin() call

n.frames 5711L

Data
image

To Reproduce

steps of ""Importing Thermal Videos"
in
writeFlirBin(bindata=alldata, templookup, w, h, Interval, rootname="rootseq20180328")


I tried convert a SEQ file of 3.5GB, 5711 frames, total converted whith "convertflirVID" is 5584, why?

The objetive is convert SEQ file in png or tiff image with radiance (RAW) or Temperature. moreover, this file (image) in "details" should store the date and time of capture, focal... exif summarise, like to jpg file photo od rgb camera with geo-tag (I have the gnss info, I concatenate with the exif info)

step to step I've been able to generate some my project,

THANKS a lot!

frameLocates() error

To get acquainted with Thermimage, I tried to reproduce the README file.

Running the code with the SampleFLIR.seq file provided in the description works without error.

library(Thermimage)
exiftoolpath <- "installed"
perlpath <- "installed"

v <- "SampleFLIR.seq"

camvals <- flirsettings(imagefile = v)
w <- camvals$Info$RawThermalImageWidth
h <- camvals$Info$RawThermalImageHeight

fl <- frameLocates(v,w,h)

However, when I run the cose using a video recording from our FLIR thermal imaging camera stored as a .seq file like this:

library(Thermimage)
exiftoolpath <- "installed"
perlpath <- "installed"

v <- "Rec-000099.seq"

camvals <- flirsettings(imagefile = v)
w <- camvals$Info$RawThermalImageWidth
h <- camvals$Info$RawThermalImageHeight

fl <- frameLocates(v,w,h)

frameLocates() returns an error:

Error in if (wh.locate[1] < header.l & no.unique.locates == 2) { : 
  missing value where TRUE/FALSE needed

Any idea what might be going wrong?

Package not extracting thermal image data

I have a dji mavic 2 enterprise advanced and collected a few thermal images I would like to analyze in R (see example attached). However, when I try to read in the data I get and error message (see code and error below):

##########################

Thermal image analysis

##########################
setwd("D:/Detections")
list.files()
library(Thermimage)
library(fields)
f <- "D:/Detections/DJI_0067_T_S.JPG"
img <- readflirJPG(f, exiftoolpath="installed")

Warning: [minor] Bad MakerNotes directory - D:/Detections/DJI_0067_T_S.JPG
Error in if (cams$Info$RawThermalImageType == "TIFF") { :
argument is of length zero
In addition: Warning message:
In readflirJPG(f, exiftoolpath = "installed") :
Exiftool cannot extract raw thermal image data.
Image does not contain FLIR radiometric data.
Check with the user manual or manufacturer
or ensure camera is set to save radiometric information.

There is nothing wrong with the radiometric data, I have read this same image into the DJI thermal analysis tool without issue.
I am running Windows 10. with R 4.0.3 and freshly installed Thermimage.

DJI_0067_T_S

Equation to convert to temperature

Hi there,

I think it is not a bug, but it is a question that I have no answer to. For some raw values of this function def raw2temp(raw, E=0.75, OD=1, RTemp=20, ATemp=28, IRWTemp=20, IRT=1, RH=60, PR1=15965.437, PB=1417.1, PF=1, PO=-3949, PR2=0.01401533)
I have a mathematical lack due to log. But I've already checked all the metadata in my image and that's fine. Any idea?

GPSLatitude and GPSLongitude not being read properly by flirsettings()

Could be an issue on my end but not sure how...

For example:
cams$Info$GPSLatitude = 40959.29 in R

In the Composite:GPSLatitude tag (the only one I know how to view in exiftools cmd), it is:
40 deg 9' 59.28" N

So, it seems that the non-numeric DMS information is not being parsed correctly.

Thanks!
Mike

Error in raw2temp

After having installed the package (including Exiftool, Imagemagick & Perl) and read the image included with Thermimage ("IR_2412.jpg"), I get an error when trying to convert raw thermal data into temperature:

temperature<-raw2temp(img, ObjectEmissivity, OD, ReflT, AtmosT, IRWinT, IRWinTran, RH,
PlanckR1, PlanckB, PlanckF, PlanckO, PlanckR2,
ATA1, ATA2, ATB1, ATB2, ATX)

Error in raw2temp(raw, E, OD, RTemp, ATemp, IRWTemp, IRT, RH, PR1, PB, :
object 'IRT' not found

sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.5
Thermimage_4.0.1

I also get the same error when trying to reproduce the example with my laptop:
sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Sierra 10.12.6
Thermimage_4.0.1 tgp_2.4-16 sp_1.4-2

Perhaps I am missing something very obvious. Many thanks

"Error in if (cams$Info$RawThermalImageType == "TIFF") { : argument is of length zero" error

Hello!
I hope you are doing well. I have been trying to work on a project using your code for the past few months, and both me and my peer have encountered an issue and couldn't find someone to reach out to in order to fix it. I have attached numbered photos of the code (1 is first, then 2, then 3), and the error/where it occurs. The code is erroring in the code for "readflirJPG()", specifically where it states cams$Info$RawThermalImageType == "TIFF" . I know this code works for others, so I am just reaching out to see if you have any suggestions on what may be causing this to not work correctly, considering your close relationship with the code. Thank you so much for your time!
1
2
3
4(readflirjpg)

Can't open FLIR ONE jpg

Describe the bug
I can't open the jpg taken with a FLIRONE coupled in a Caterpillar Mobile (CAT6), R retrieves an empty list. It works great with a FLIR T530.

library(Thermimage)

imagefile<-paste0(system.file("extdata/flirone.jpg", package="Thermimage"))
imagefile

library(Thermimage)
imagefile<-paste0(system.file("extdata/flirone.jpg", package="Thermimage"))
imagefile
[1] ""

Expected behavior
the image path should appear in console indicating the image was properly stored and it is ready to be processed.

Screenshots
issueTherimage

Desktop (please complete the following information):

  • OS: [Windows 10]
  • Browser [MS Edge]

Additional context
Adding the image, in case you want to test.
flirone

Thanks in advance,
Ivan

Error when loading FLIR jpg

When importing an FLIR jpg according to the instructions from https://github.com/gtatters/Thermimage (OS: Win 10) using the following code the error message beyond is shown and import is stopped.

Code:
_install.packages("Thermimage")
library(Thermimage)
image <- paste0(system.file("..........thermo.jpg", package="Thermimage"))
cams<-flirsettings(".............thermo.jpg", "........./exiftool-12.03/", camvals="")
cams
img<-readflirJPG("............thermo.jpg", "........../exiftool-12.03/")

Error message in console:

img<-readflirJPG("........../thermo.jpg", ".............../exiftool-12.03/")
Error in if (cams$Info$RawThermalImageType == "TIFF") { :
argument is of length zero

So far I havent been able to determine where the problem is situated, therefore I am looking forward for answers or suggestions.

Thanks a lot in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.