How Import image from MS SQL?

2 visualizaciones (últimos 30 días)
Vladimir Malin
Vladimir Malin el 24 de Dic. de 2018
Respondida: Vladimir Malin el 27 de Dic. de 2018
In stock:
1. MS SQL Database
2. Table of images Images
3. Running BigBase ODBC connection ('Microsoft SQL Server' driver '13 .00.1601 ')
4. Code reading photos using MatLab:
clear all;
close all;
cd 'D:\NEWDoc\MATLAB';
% Make connection to database. Note that the password has been omitted.
% Using ODBC driver.
conn = database ('BigBase', 'user', 'pass');
% Read data from database.
st = 'select top 10 RecID, Image from images';
data = fetch (conn, st);
5. The results:
RecID Image
6143047 5999x1 uint8
224233 8000x1 uint8
4200382 6130x1 uint8
13687913 8000x1 uint8
2212046 8000x1 uint8
8346866 6400x1 uint8
1305479 6760x1 uint8
7806085 6641x1 uint8
6851834 7164x1 uint8
7084710 6550x1 uint8
As you can see, some fields, when imported, are cropped to 8000x1 uint8 it turns out that when importing, large images are lost.
Why? How to fix it?
Additional Information:
In the database, the field Image type - (blob)
  5 comentarios
Kojiro Saito
Kojiro Saito el 26 de Dic. de 2018
What is the data type of Image column? Are you using varbinary or varbinary(MAX)?
Vladimir Malin
Vladimir Malin el 26 de Dic. de 2018
[Image] [varbinary](max) NOT NULL

Iniciar sesión para comentar.

Respuestas (1)

Vladimir Malin
Vladimir Malin el 27 de Dic. de 2018
I personally managed to solve my problem.
But there were questions.
Solution: I used the MS SQL driver
11.png
In theory, all these drivers should work fine.
But only one MS SQL gave the correct result:
6143047 5999x1 uint8
224233 24889x1 uint8
4200382 6130x1 uint8
13687913 28456x1 uint8
2212046 8511x1 uint8
8346866 6400x1 uint8
1305479 6760x1 uint8
7806085 6641x1 uint8
6851834 7164x1 uint8
7084710 6550x1 uint8

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by