03-28-2013 09:46 AM
I want to read the image from SQL server using labview.In our project languages used are JAVA and Labview
Through java we acquiring the image and write in to SQL Server.
Through Labview I want to read the image form SQL server and i will do some image processing for my application.
My problem when I seen the database the images shown like hex decimal value.
I want to convert the hexadecimal value to image or any other functions is there to directly read the image from SQL server.
Can anybody help me....
01-14-2021 02:17 PM - edited 01-14-2021 02:19 PM
A slightly older thread, but I need help with the same thing:
I'm also trying to convert hexadecimal value (from a "image" column) retrived from a SQL-server.
Anyone that knows how to convert a hexadecimal value, hopefully without the need of "Vision Development Module", into an image and then display this in LabVIEW? 😊
Here is an example of a hexadecimal value, of a small "pdf"-icon, retrieved from SQL (using "Database Connectivity toolkit"):
0x89504E470D0A1A0A0000000D4948445200000018000000180806000000E0773DF80000067F4944415478DA8D957B8C54D51DC7BFE7DE997BE7B5B3F39ED99DD9C70CFB1CD66DBAC80209B24A410C208A8060CB23484C68699AD8B44D2DD258449A6293DAD2203E2A6C115010105704150CA0242EB518E4B112DD14D66567DDD9C73CD89D993BF7CEE939775CC31FDB86DF1FE72667BEBFDFE7F7FB9D737E43C0EC4F6EE3E9269B3049CCE48C0410D996A07F0550CD242B1FA60B47DA87F3BF1FA218C077D6269115BF8E3876C9C904458116C01C04D9A88D89C6B1A383B9D70EA6B5E7931409C2C56F7BD05B5782A0E3FE59B0970500AA8210016CD151AA06C4331868DE76203846A1721F1F817B9F0FB1505DC0187C703E44659431282865028DA06B287761DAF6A353744087177DF525282B5F3217D6681420E379D2E2AA529CF9F8E207F7B59F9D87DB6CBB13A7E678C8ECC8EAA590CABC2C195A74610925E3A961C7C6BD6E3DD4BB5EF433803FF8D07D304F6E60C2F1D8DC81E5A589D8F0B7036B5FBC32B0FB76C0521336FCCE87BFD72C6845C9DD539936CF82B302358A547F325EBAF9B0AF08F061A0DE066F70611BCC0D35C50A787B0C46F635223798CC4436BF51D6379A4BDE0E080908EDF5E3466DBD53082C5F016260091558FA992C927DC331C7B663E5E38041067087E6CD84A92E0C185960A354AC82B5E7FD33178E3C70F05F8F6002FB870B9DF778D11AF9F123109DF6E226AB20191BEE756CEBA8D001C77C18AAB3C1159A3D1DA6683DCB5C2C062FB043CB53ACDD716859FBF5F45B1301569AF1DB5F79F1C7496D3F802DDA583C070648C493D79D7F793F3C0E186115388273580593AABF3B80A230DD3F9CAADA792A30A2A899890035221A76FB71B5A6DA417CB3DB40C4A2DFF0B7235FB95FF9A48E9898E81D3F12111B4A436DD32157068B67408BD91FFAF88B3DCBCE76AFE6C11A4C861F364A64D6B1547E8702E4F91E97BEEEC6D5694E3456CF9D05D12AB3CA0BB8164B7735EC3F1F25662638EA473262853D34630AE46019F3A27A7B0AB90296EF3F3DFFAD78F6380FB6CE46B62CB7D28D3D56D7BF37F4A4A6E554FE42809F59B175BD1B4F459A22B05696E980AEFEF4A5E83B979B398030402A62812DD4D20C99DF67523CDCA1D850BCEAE8C5E028459E6FB5BB71A9D18C266375846E8AE5EEEFE8BE799203164868DDE845E7244F09BC77D5B2FC28AEF6A73E9F7CAABB4507B016A5C3165843931B21FB5C7AFF797B767DF6F5CE755DF19FEAED11117DD58FCB5603883F1CC62955DEB5EADC978FF3DFC20284ED6EF43496906055533D4451C09581F4F9A673DF4CE300A18301AACDB0846A6A207B1C7AFF55A580E7B2CEB6678E7F74960779C28ACD3F776393551050D1D8805B1A4D844F7F1548296A8EBFCB9DA578718613EB23E565303BECF86C387BAEF5D31B33C701A361334CC18A6AC82EBBDEFF445EFCE631D5133E71F2A4C6A7D25E0FAEB594A0D661B6C35B590E8DDD943557E28BF6F50D77F00456CB98B7DE831311E6EFF3FAF0513C7D66CEA56FEFE50051075820870255904A6DA00C703D3AE385C92FED7B3293C9A0D980A93BFDE8F44B200147392C2EAE010EF5A75F5FD6155BC501EC361A0F7A11ABB119DC55363BCE0EDD3AF9409F32771C30566D8154E1A98464B3209F2FE0B5E67BA7AFDFF17227777ED286BF3EEEC62FECAC96605584F5B838D4466EE592E14BB14052D5B25CF77409DA1758B0AA8E88A453A5C7E70F16E6738081575061225295CDAF03469DBEAF1F85A3F1F889132A1B18868301D25B67A27E57810D2C760948810D3445417E2C8B5583DAA2375319BD4DB3252CDEE4C2E1F0187099A263611A8B74C0BB0CE03310A95633C3200BF8F3A0F287A7C6F2CFF0D91E360A753B2A4C574B3319A1968D7C97C4872DD5AF327FEF0714E99F2B92CA1A0E2825B0B2B31A086660B9A9E2F0C22C967C0F7009446AC8194145D09971257A01F8727C1CDC2591193FB19A373E288A5394545A2D779A429EAC06A190C7888291AA1C02695613D76E29331D6919CB3E9C23E6371727322B38C0C85BE428C010CD08E49A4A3F6FC9D2163AC1DCE1D7719E8C95CFFAB0A7360ED835FDD162A986054780F7B8C62D12CF12993C5B69F7484FF70FACFBFE0CEC05484D6CDA6FC9E3375B299EC7FF30BF08EFFE0AE966ED90620CDD621BECE5EDC96ABB57AB74EDED3A165766D3315704541846AD19558A2605AD355F885C037AF07F6CA5DBF4CB354AF6B91FD9DC2632F56EFCE7466F77E4E2959A89B484FF67EDAB77F6940E2642B2B9FC93B6DE9BF7E00E2C44105E1AF02F8E1B8CD73FED8B9DEFD6B4DE09017CF1B0BE3D2AD2AD698BE3DC9E44A2FD4E00776AFF0587F58737AB8ACAD80000000049454E44AE42608200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
01-14-2021 05:32 PM
It is simply a PNG image. There is the PNG Data to LVImage.vi that could do the job, but it is terrible at dealing with alpha channels. You will have better results saving to a temporary file and then loading it using the usual picture format subVI
01-15-2021 02:14 PM - edited 01-15-2021 02:16 PM
Thank you for your reply.
I have tried to follow your example, both with the use of "Write to Binary File" and the "PNG Dato to LV Image" VI, and they lead to the error:
"LabVIEW: (Hex 0x6) Generic file I/O error" and "LabVIEW: (Hex 0x52) Unknown format specifier" respectively.
Here is a snip of the front panel and block diagram:
01-15-2021 03:59 PM
The string I was using is raw data with hex display, you have an ascii representation of hexadecimal values. If this is the case, you need to convert this to raw data
I use Search and Replace to add a tab after every 2 hex digits (skipping 0x), read this new string into an array of bytes and convert the byte array to a string (optional, you can stuff the byte array straight to write to binary file. I am just cutting and pasting code I have around).
01-16-2021 05:18 AM
Thanks again for your reply.
The problem is indeed related to the "conversion" regarding hexadecimal values, which I unfortunately do not have much knowledge about....
I tried to follow your example and it looks like the conversion part is not working as intended...
Not sure what I did wrong 😑:
01-16-2021 10:14 AM
Right click Search & Replace and choose to use Regular Expressions
01-16-2021 06:06 PM - edited 01-16-2021 06:10 PM
I have now tried to set/use "Regular Expressions" and the output string (trimmed string) is now different/changed 🤔.
But I still get an error message (no image). So there must still be something missing/wrong (see attached VI) 😑.
01-16-2021 06:39 PM
The replace string constant needs to be set to '\' code display. '\t' is a tab character in that case. When you change it, it will add a \, make sure to remove it.
The code I posted is a snippet, can you use it?
01-17-2021 04:42 AM - edited 01-17-2021 04:44 AM
Now it's working 😁!
Thanks alot for your help.