Error in parsebinary function for converting int8 into an image file
이전 댓글 표시
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
Walter Roberson
2018년 1월 20일
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
2018년 1월 23일
Walter Roberson
2018년 1월 23일
I think it likely that the difference is important.
Adnan Shah
2018년 2월 4일
I am facing same problem. is there any solution with JDBC???

답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Database Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!