Error in parsebinary function for converting int8 into an image file
Ältere Kommentare anzeigen
I'm trying to convert the data from mysql database to an image file using JDBC in Matlab. Now, the problem lies in converting the int8 data type to PNG. I keep getting an error in parsebinary function. Here's the code:
[conn] = get_connection();
setdbprefs('DataReturnFormat','cellarray')
if isopen(conn)
query = 'SELECT img_id, img, img_grp FROM dataset WHERE img_grp = 0';
curs = exec(conn, query);
curs = fetch(curs);
curs.Data
img = curs.Data{1,2};
cd 'C:\Users\Inspiron 14\Desktop\testmatlabodbc'
parsebinary(img, 'PNG');
end
close(curs) close(conn)
Here's the error message:
Error using imread>get_format_info (line 491) Unable to determine the file format.
Error in imread (line 354) fmt_s = get_format_info(fullname);
Error in parsebinary (line 74) [x,map] = imread(['testfile.' lower(f)]);
Error in test1 (line 10) parsebinary(img, 'PNG');
Can someone help me with this? It's for our group's baby thesis project. Thanks so much!
4 Kommentare
Walter Roberson
am 20 Jan. 2018
parsebinary appears to possibly be the example at https://www.mathworks.com/help/database/ug/retrieve-image-data-types.html
I would suspect that what was written to the database for img does not match the format expected by parsebinary .
clarens
am 23 Jan. 2018
Walter Roberson
am 23 Jan. 2018
I think it likely that the difference is important.
Adnan Shah
am 4 Feb. 2018
I am facing same problem. is there any solution with JDBC???

Antworten (0)
Kategorien
Mehr zu Database Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!