Ask Your Question
0

What type of image is this?

asked 2015-04-02 02:25:33 -0600

thdrksdfthmn gravatar image

updated 2015-04-02 02:26:29 -0600

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.

edit retag flag offensive close merge delete

Comments

2
LBerger gravatar imageLBerger ( 2015-04-02 02:45:07 -0600 )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 ( 2015-04-02 03:27:37 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2015-04-02 03:53:45 -0600

JohannesZ gravatar image

updated 2015-04-02 03:55:22 -0600

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...

edit flag offensive delete link more

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 ( 2015-04-02 04:10:03 -0600 )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 ( 2015-04-02 04:44:59 -0600 )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 ( 2015-04-02 06:33:53 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-04-02 02:25:33 -0600

Seen: 1,274 times

Last updated: Apr 02 '15