Sorry, this content is no longer available

Ask Your Question
0

What type of image is this?

asked Apr 2 '15

thdrksdfthmn gravatar image

updated Apr 2 '15

I know that it isn't very related to OpenCV, but I think that maybe someone has met this problem too:

I have met a file that should be an image. I know the headers of some types, like jpeg, jfif, gif etc, but now I have met a file that I am not sure what it is. It starts with \FF\D8\FF\E1Z\8CExif\00\00II*\00 and somewhere in the first line it has Canon\00Canon EOS 700D and in another place a date and an hour: 2015:03:24 10:23:31. So I am wandering if it is a raw file?

The extension is jpg, but this because of renaming of some other program.

Preview: (hide)

Comments

2
LBerger gravatar imageLBerger (Apr 2 '15)edit
1

And OpenCV seems not to arrive to decode this type of image... Is there something to be done for making it decode the image?

thdrksdfthmn gravatar imagethdrksdfthmn (Apr 2 '15)edit

1 answer

Sort by » oldest newest most voted
2

answered Apr 2 '15

JohannesZ gravatar image

updated Apr 2 '15

Well, openCV ist not so strong in reading raw image files. You should give a try to FreeImage, which is an open source library, especially for raw image loading and converting e.g. tone mapping.

Since it is a Canon camera, what is the file size of the images? If these are 15+ megabytes, it should be a raw image with ending ".CR2" or ".CRW". So, what do you mean with "renaming of some other program"?.

Try to make a copy of the image file and change it to ".CR2", for example. In FreeImage, which builds also upon LibRaw an image loading would be:

const std::string inpath = "input.cr2";  
const FREE_IMAGE_FORMAT infif = FreeImage_GetFIFFromFilename(inpath.c_str());

FIBITMAP* dib = FreeImage_Load(infif, inpath.c_str());

A conversion to openCV is normally possible. For testing purposes you could write this image to disk and see whats happening...

Preview: (hide)

Comments

As I have mentioned the image is .jpg because it has some rename before I get to it... so I cannot know the extension and the size is tiny: 9.7 KB. Maybe it is even incomplete...

thdrksdfthmn gravatar imagethdrksdfthmn (Apr 2 '15)edit

9.7 Kilobytes?! This is too less for a raw image file, thats for sure. Even for JPEG to less... try to load the jpeg file with the code above and see what's happening. Maybe its some kind of a thumbnail image ;-)

JohannesZ gravatar imageJohannesZ (Apr 2 '15)edit

I think it is just the header... If I print dib it prints 0. It is true I couldn't open it with more image viewers, or they show black image. Maybe OpenCV can decode it, but because there is no info, the Mat is empty...

thdrksdfthmn gravatar imagethdrksdfthmn (Apr 2 '15)edit

Question Tools

1 follower

Stats

Asked: Apr 2 '15

Seen: 1,334 times

Last updated: Apr 02 '15