Image BLOB to image

조회 수: 2 (최근 30일)
Cha Yong Jong
Cha Yong Jong 2023년 3월 8일
댓글: Cha Yong Jong 2023년 3월 13일
I have a db file, which stores images. I use sqlite to fetch the db file, resulting in single columns vector (uint8) for every image. The vector size of every image are different which i believe is compressed by BLOB algorithms. Any ideas on how to generate human-readable image from these vectors
Below is the data for 8 images. Can't use reshape because the numbers can't be sqrt. In fact, they are all same size- squared images.

답변 (1개)

Image Analyst
Image Analyst 2023년 3월 8일
As you can see they are not all the same size, assuming those are the decompressed sizes. You should be able to use sqrt if they are really square images.
sqrt(658335)
ans = 811.3785
but from the last size, you can see the images are not square. Basically you will have to know the format of your vectors, like the number of rows, columns, and number of color channels each vector encodes. And if you retrieved a vector of bytes that is still compressed, you will have to decompress it first.
  댓글 수: 3
Image Analyst
Image Analyst 2023년 3월 8일
If they are still compressed you'd have to know the decompression algorithm. I'm sure there are many and I don't know which needs to be used.
If they are uncompressed you coul try dividing the length by all integers up to sqrt of the length and see which gives you another integer as the output
s = sqrt(vecLength)
for k = 1 : s
imageWidth = vecLength / k;
if imageWidth - floor(imageWidth) == 0
imageHeight = k;
grayimage = reshape(vec, [imageHeight, imageWidth]);
figure;
imshow(grayImage)
axis('on', 'image')
end
end
Cha Yong Jong
Cha Yong Jong 2023년 3월 13일
Glad to have your reply. But the aim of this query is to request for decompression algorithm suggestion as i searched through i dont find any useful. Thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by