Error in parsebinary function for converting int8 into an image file
Mostrar comentarios más antiguos
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 comentarios
Walter Roberson
el 20 de En. de 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
el 23 de En. de 2018
Walter Roberson
el 23 de En. de 2018
I think it likely that the difference is important.
Adnan Shah
el 4 de Feb. de 2018
I am facing same problem. is there any solution with JDBC???

Respuestas (0)
Categorías
Más información sobre Database Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!