how to use the retrieved blob data from MySQL and reconstruct it to its original image form?
Show older comments
Hi everyone! I'm building my school project wherein the main functionality is to store the image in MySQL. In my case, i only get the matrix value of an image (as what I've read other developers was recommending) to be stored in a blob type column. Currently, i have this following code that functioning well
% code
F='F0001';
colnames = {'F_ID','Matrix'};
data = {F img_temp};
tablename = 'Images';
%datainsert(conn,tablename,colnames,data)
the code above allows me to save an mxn matrix. Now i use the following code to retrieve the data under Matrix column:
% code
curs = exec(conn,'select Matrix from fingeprints where F_ID=''F0001''');
curs = fetch(curs);
curs.Data
What my problem is, the value I get back is a completely stranger to me!!! -> [11x1 int8]. Does anybody know how can I get back the original matrix value I inserted in the database so I display it as an image?
% code
imshow(curs.Data) is not working though. :(
Thanks a lot in advance folks, i hope you could help me solving this one. Have a good day! :D
Answers (1)
Image Analyst
on 29 Nov 2014
What does it show when you do this:
curs
whos curs.Data
8 Comments
Image Analyst
on 29 Nov 2014
I don't see an image in there. Data is a very small array of 11 numbers. Where is your image? Evidently it's not stored in curs.
Van
on 30 Nov 2014
Image Analyst
on 30 Nov 2014
I don't have the database toolbox so I can't really try anything. All I know is that I don't see any large image listed there, like a 768 by 1024 array of numbers. 11 by 1 is too small to be an image. Could it be that the image itself is not in there but just the pathname to it? Actually I don't even see a string like that. Perhaps you just didn't store or retrieve it correctly. Sorry, but I'm unfamiliar with database operations in MATLAB since I never have need to do that.
Van
on 30 Nov 2014
Image Analyst
on 24 Jan 2018
clarens, it doesn't sound like you have a database question but merely a question as to how to convert your in8 data to an image. What form is it in now? Is it a 2-D array of numbers? If so, it's already an image and you can view it simply by doing:
imshow(yourImage, []);
clarens
on 25 Jan 2018
Edited: Walter Roberson
on 25 Jan 2018
https://www.mathworks.com/matlabcentral/answers/378144-error-in-parsebinary-function-for-converting-int8-into-an-image-file I posted this question here. I'm getting an error message in using the parsebinary function.
Categories
Find more on Database Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!