Comments (8)
I think your res settings are not appropriate for the underlying thermal data embedded inside that jpg.
try:
metadata<-flirsettings("C:/git/IR_60901.jpg")
metadata$Info$RawThermalImageHeight
348
metadata$Info$RawThermalImageWidth
464
convertflirJPG("C:/git/IR_60901.jpg", exiftoolpath="installed", res.in="464x348", endian="lsb", verbose=TRUE)
from thermimage.
But I think you should set endian="msb" for this image. It will create a washed out greyscale but the underlying image won't be corrupted. You can just adjust brightness and contrast in ImageJ or photoshop.
from thermimage.
Thanks!
For some reason I thought your function would upscale the base thermal image, although now thinking about it that wouldn't really make a lot of sense.
When I translate the function call you gave above
convertflirJPG("C:/git/IR_60901.jpg", exiftoolpath="installed", res.in="464x348", endian="lsb", verbose=TRUE)
into it's twin CMD call
"exiftool" "C:/git/ThermalAspen/IR_60901.jpg" -b -RawThermalImage | convert - gray:- | convert -depth 16 -endian msb -size 464x348 gray:- "C:/git/ThermalAspen/output/IR_60901.png"
I successfully get the same outputs as you posted! But if I use the same settings for a convertflirJPG() function call I get a whole mess of text with the main warning message:
Warning message:
In system2(exiftool, args = exifvalsrawunix, stdout = TRUE) :
running command '"exiftool" "C:/git/IR_60901.jpg" -b -RawThermalImage | convert - gray:- | convert -depth 16 -endian msb -size 464x348 gray:- "C:/git/output/IR_60901.png"' had status 99
I'm struggling to find any references to what status 99 could be referring to in regards to a system2() call. Do you have any ideas?
This has been immensely helpful!
Here is the giant wall of text I get when trying to run that convertflirjpg() from R, due its convolution it is hard to properly format it with markdown.
îÇœ.†�æD|ŒJžV[ù•;dþíË»w2š¸œ.�Ùø•ççi–»ÿK1?+} Ý^p/e�ìó”#áÌ&[ù ÖC(Ž
[1] "Error: File is empty - -"
[2] "‰PNG"
[3] "\032"
[4] ""
[5] "\b/ˆ\a$¤\bñ\020xC‘ \u0081'\036BB\022ì\020ÇÄ¡\u009dn÷\Ý]óºuçáðý¬ïùÝ}nµ×ÑÙÃ\032óúqソ÷—\017»Ãn\vûÜ\u009dÝ\u009dY¿ýîÌŸ$q»ÝÓu%§¸Æ\036v\u008f’t&wgögR.%Ö\u009dôBulqb\017¹"\u008d@—\020R?ûkÑ\u008d¬äÜ«¼Ð·ê\0209Ö\020Ý_¯ä\021\026ä¤n¡×â'và˳áuGÉC¼³;9jNrÌÝ\006u1ºLòz\024uw‰I‰æ\036C”ÿqF©ªáäÓÒîc\030àé*=H|ÛO4\fµƒålÊÝØý©ÝkÉ;®¦\030
[6] "zLmڙݽåýa÷ùá¥ý£Ý“ÝÅä(^%ž®ÜC%*\004Pž\017[\031y/íî¯\ržI^Ô\u009dÙ]ß½µ_Lꓤ C9T·üÓ\\\u009dß]Èÿ…ÝÝíäxœÿ“\034\037åÿxww÷0Ç'‰SÖïLîJí¹Ü}vxmÿçv¿\026l\017“ÒPù\u0081¿Ñ<\024\u009d\017·çò;“?ù}¶ûQ°ž\rî\037æwow9p†Rg°" [7] "Éq0lR.%[Ž\rç\027%†ûçÃp$vr\027²£?}\rD¥'ŽüªýrH:•\020ëØ'íÜ’éùȵÖU(¥ài8¾\023./„××sþIÊž\u008d”‹m œ]\030ÀG9\rø\u008f]\u0090Ey/>¹Ð\024\vÝ}}÷~ ï\002±4—\a’\034-Ž\035$SB¹u¬–ª\037–x7q¥kh›¼•„Ò\033\025•\tºÏE“ôˆf:{¼dÂn.î>9ìw7ö¯E\002\037>ã¡Z\006íL\005º\021U\023\u0090Tó{ž€Š£Ä¸~\032à \024ÌI|Hiù\u0081äÜP\006FH\032×öçwWCÞ½00\024͹¢(ž²\017ÎóP6j©@Þ{a](ý®ö1€G‰" [8] "s÷J„¥|¹‘¶\005•ìñ2§\u008fc6TØ¿Ü\u008fR)yÌ\002ž3‰ï™\"v»ßÞ¿µ»™Ø©žå¢ÆSùÀÕ\022\024Hyª(³=ì>Ú½\033\t\\\016†‹»7v/çŠ9,\a¸Î›L@)w½zþ¸aj®Jat2|£j~
¹\026\034›ÖóŠÌ¡P[ºv2×ÎR\a\032V³uNÊŽS;¥Bꓘ=Ý(}&ŽéAdwoá¯Ô"
[9] "\001|%'Œ$\032ã®\024”ÊVLi\u008fV\031:+u宜¶¬r½\037øìÜ"
[10] "\u008d¶Ä!:âŠ[ÅÅn˜'\u008f³j\f⤢ìqx:Ÿ²ýÁEóm\b4"
[11] "±îöií„LJ'9–9GùKܨe ¸Ÿk%[ªqÊ)õwu\u008fì–m‰âÙJºŸ;\006-ô¸.sÐ:Ë¡ŠNû\"q¯¥e}oyñG\"S\026ž\032ŠÈá\\Z±—R5Ò\032¦B\016ugcB÷¢îñÛ ¶t!\023ú.b¿¶{g÷bx)\037M\003y»ê\u009düTt3" [12] "Ú/å" [13] "’ûGñ£·ƒ÷rÚïGiíÏïþhw#Š¥²Bø¢\034AkhJiªT*É^“Ò©ÙLî\r\036É•NGØ&LÙ“Ҙ¦£¬ÿ3á…«\021š«GxU\021¿±˜‘º\034ç#Ù‡)÷yÒ¹¶W\003ç~îA…i €;¦{JÁä‘.°%º ƒ§\u0081þQ®..9ƒÔ00[\031Pˆç\u008dï3)‰“Ò»‹öÏï>\rœúUÿ )UZ\v¥´U²Åx\b?\002h\017r¼\021;¹\033\rk(¾¶ÿÚî—vß\u008dÎ\037,ºÑ\017vËŸ\003¬\002\037â‡Ý\001½2ì\016‰®‚CL\v{fy¼]\031åÙîËpÅ\\A«VE]Æ" [14] "Ý‘rŠ£ÂÛð?\017‘(ä\003©êRzÊlÌ•ÉÒR" [15] ".F$‡¨Š'\033nš\037n\020ä;›nÖµˆðvTZ\025ãýä?ut‡Çª¥|àôRLìâîJr1Ôº‡á¢çÒDÛNj¿\024¸îÏGewv?ÛýaŽoì¾\032\032^\fE\037Äxu\036ýÊËH/‰Ç0\022mŠc¥Q‰–+e+Gpà+E½kª\034r7l)-ù¼\026*ƒ\r£’OõÒÚ¯©J…WómÛ@o8–Ó‘Œõ\"\036F\022îuûî%O¡¹ÎÆÀ/'ÿàƒ\u009dî‡î\\ž„Vþ:p-óåT-úج\005\005ÃÕœ‹\021˜J
\037-"
[16] "ÍÛöóÑQ«¥\Zó:£eãzÝ\034\017µ\037¹Û²?=\ÝÃ"
[17] "ëp'Öò[ésÝÞý‹Ã\v{ΤÝp\005AŽD7¢\033U\0219æ™PI¨\036Æ5çRâR®)eŸêx+ÕóýÝO\003ýA*é;\u0081øfZÑ" [18] "¹\fw 8Ã\tvµ$f‹kÊ䘔í\\iž\017n•äÂòÙåA\036²\030Éô®%[j‹)¾\u0081ZY\\Œd//\027Èå\u0090\024“¯¾ä\027ó(\030T<\022" [19] "¡X'ç\021g
Öµ\f4˜šgbÜO©Egœ!º’R&ÍÙŸHϧZ¾¾Ú´[GƒiÉvϘ\016Ó+æ–o\vÀ\020î\034~mÿöªÔ¼-†’íJîþà:—¿ŠÍ´Ïdôù\a™&¸•Jû0-ñ¹TÌ‹I¿¿ûF&‹:ø(ÆM_î‡ë\&T"
[20] "ƒwãqRË7\a º0\017\035®s‹#iSrõ\\\031\f¿âÚ\"6¦wgâL¾—–êr
Ü\vD¢J14h1TËö\026¦wq>±Œ—¼ÚÂM•U¶-±rèð‘ýÀìy£ÙÕP9çóqu¯Æ1Ð\032þZ8jlãžd’2.s\u0081\033©ºñ"v}ÄZ“,ƒ§j”o\004Ñ«!.¹’°\032àä\021Ú£/äa"
[21] "\020nÚÿê}¢Vüv\036Y€¬„î1¾¦zŽÍ‰ù0:u"\037Æ\002\036\035Îeˆ7å«ÉØÕ(eÑuL
[22] "?'֖i
[23] "\u008118[¡W‘\034äð\033²·ø^\u008dÀK‰ãü‡2g^ðLŒ±Þб07¬…" [24] ".\025ãZ†ëwòÿ0\024ã¸" [25] "UóQ~crÓgHÅÙß?\\Î\024×£Ý\033û¯çÈÀHaã£\022BoãTP-¨6ãnŒùµÄŸÛý<\025ò;KQ\füÎáÊþ\\ŒýŸåÿV\024y&J¬Q\u008f¾À\023*›M‚Ò\aã\\\u008dl·ü¸z\030j/¥Ç
äW(cþòU¢õü•×@•\fôRtØý \020M£È÷8Ò®Õ¬¬+ŽK0Þn×UÇQKÛ\026Éh\034\026÷\u008f2þ>\023ªÀh@\037lÃÛh\005\ru–å°•_™ê\034%O\003åÓÜ·OWNGjs'×>ì\v© &\027ihd6z¤û¶ñ§r\030ŠJg1Ï5NG60)‡\v\026r'<^Ïõ\u008d\034wqÀ‡ð"
[26] "#Øq\003ó8ÀXF‹%.\t~\002°!rÿ$s´îʨs\001H/˜"
[27] "[\036ó¹]”9“Éž@kÇ·f|&SJ§\f/\024\vˆÃ.Q—‚¡¢ù\f¬‡Š©ñÍ]êÅ—ù¦õ¾”WDD.\020òp´"Ž\aÐŒ/\tê|:›¦ˆæÇ°\030[Ï\021Þ‘ä¦ß=<Žç½²¿ž–î•@owœÀÝÌCŸx&saå,ÏY^Š\týaZP]œÏ\017ºà×ö\u008f\002óAJ?H§÷K\u0081ýO\023ÛV¨$“Iy.lwåÕ•p$sI¯1òwœ¨]ÊŸ9j¥›»\034õºZ"
[28] "zÔ1\t\bQ=;¾„n\004P´\vÓB6WΩ¤Y\r\035\030“2f\003yñ R¨"
[29] "§\024˯½Ô\005\004ƒÁ}?¦øÇ1ÈOv\037§Ôåt;xë\vñ§àS²6îíä~?ê,gÊ–†‘ÀÆE%ø‹ÇæÔ\027´Z9æ¨M\033n\022y\fCóÜÿIçbD\u008fòdãLc\u008fc\006J3ÞÛåÕw@M;¼¹\\WdÖɵ÷’ï\u009dHóãÄ·,\034\003q¬g´£¼k’…½ô\030Ë^\\TÝK|5Wí5w\u008fåSêLý‘Épf
Q=jÛL\020µÚ·,¨Õ°å»©Ú›äô\031ÝMåœ\024|?M#öúîkqÔ¿·û Uu$#OC¯âÀZ\005\032Yt®+Øœ·\022!¦ª¤†M©ÍY¦Z’\t×û$ß\032šÖOvÚ»\f·üt<\006›ò \027>q·cRæWBÒ‹kðb¿mÛFCsV ««½\004\005gç`•ØB1º'&\u009d\\u009dL3ªÍ%½\u009d¯%ê%’ÁÕeçëû/ï߈9\030SvüY.\aÇä.$\023Uqù{˜j÷“øæOâ\022>Ú}tÐI¼Ÿ#w1Û#îìþITùp÷•Àgæ§\016"
[30] "ÿ\f\r\025\u009d\032%\u008fR\001»\021Zó:"
[31] "Ô¤ÛuHꃌ\rîÇœ.†\002æD|ŒJžV[ù•;dþíË»w2š¸œ.\031Ùø•ççi–»ÿK1?+} Ý^p/e\035ìó”#áÌ&[ù\tÖC(Ž"
attr(,"status")
[1] 99
from thermimage.
I don't know what you mean by "But if I use the same settings for a convertflirJPG() function call I get a whole mess of text with the main warning message"
convertflirJPG is not a simple wrapper for the system2 command. You'll have to be explicit in what your Thermimage question is. what exact code did you type. I can't replicate it without that
from thermimage.
When I copy/paste and run the R convertflirJPG() function with your corrections I get that system2() error message.
convertflirJPG("C:/git/IR_60901.jpg", exiftoolpath="installed", res.in="464x348", endian="lsb", verbose=TRUE)
Warning message:
In system2(exiftool, args = exifvalsrawunix, stdout = TRUE) :
running command '"exiftool" "C:/git/IR_60901.jpg" -b -RawThermalImage | convert - gray:- | convert -depth 16 -endian msb -size 464x348 gray:- "C:/git/output/IR_60901.png"' had status 99
But interestingly enough if I just rip out the exiftool/Imagemagick CMD call that is being sent to the command prompt
"exiftool" "C:/git/IR_60901.jpg" -b -RawThermalImage | convert - gray:- | convert -depth 16 -endian msb -size 464x348 gray:- "C:/git/output/IR_60901.png"
I actually get a successful conversion! So although the core of each command is the same, I only get the error when running it through convertflirJPG(), while a "raw" exiftool/Imagemagick command line call without R involved at all garners a successful conversion. You've been very helpful and I've just made a small function to directly run exiftool without the convertflirJPG() function!
Thanks so much for troubleshooting, user error as per usual.
from thermimage.
Aha, one reason I added the verbose=TRUE was to allow users to troubleshoot. Often these system call errors are based on differences in OS that are difficult for me to troubleshoot or keep up with. I will try to get onto a windows machine and try this out so I can replicate the problem and work backwards.
from thermimage.
Awesome,
If you don't mind me asking, what does the middle Imagemagick convert call do?
convert - gray:-
I understand the first exiftool call converts the FLIR jpg into binary data
"exiftool" "C:/git/IR_60901.jpg" -b -RawThermalImage
and that the last Imagemagick call actually completes the conversion into a png,
convert -depth 16 -endian msb -size 464x348 gray:- "C:/git/output/IR_60901.png"
but what happens in the middle? Does the last Imagemagick call not additionally convert the data to grayscale with 'gray:-' ?
from thermimage.
The author of Exiftool gave me some pointers in the EEVBlogs that I consulted during the function creation stage.
The way I understand (but it has been >4 years since I worked on this code) it is this:
Exiftool extract the raw thermal image in whatever manner FLIR has stored it in the JPG. Sometimes they have stored in a TIFF format, sometimes as PNG. So the first convert following the pipe from exiftool just instructs it to convert to a gray scale image (maybe I added it for safety, or maybe it is required before the second convert call following the second pipe. This convert call is important for for setting the endian and 16 bit depth and resolution.
Here is a link to the eevblog that really helped with the cmd line code:
https://exiftool.org/forum/index.php?PHPSESSID=a3fb7c3fd1233b33c6eaef613d2ee08b&topic=4898.0
from thermimage.
Related Issues (20)
- Bug in readflirJPG function? HOT 5
- flirsetting HOT 6
- Info about metadata HOT 5
- Error when loading FLIR jpg HOT 2
- Equation to convert to temperature HOT 4
- Error in raw2temp HOT 3
- Does the library work with files other than FLIR? HOT 13
- "Error in if (cams$Info$RawThermalImageType == "TIFF") { : argument is of length zero" error HOT 18
- Can't open FLIR ONE jpg HOT 8
- GPSLatitude and GPSLongitude not being read properly by flirsettings() HOT 4
- Package not extracting thermal image data HOT 1
- AFF SEQ Files HOT 11
- Getting random frame extraction times HOT 3
- Thermimage / Error in system2 HOT 4
- DN to Temp conversion results in a data matrix that exceeds (696, 928) the dimensions of the original camera resolution (640x480) HOT 11
- ATA1-2, ATB1-2, ATX are no constants HOT 13
- Importing images causes loss of resolution HOT 3
- Thermimage - convertflirVID, Warning messages: 1- in system2, 2- in file.remove HOT 17
- Error in writeBin & total frames HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thermimage.