Internal IplImage format? 
Posted: 03 November 2008 04:03 AM   [ Ignore ]
Rank
Joined  2008-10-27
Total Posts:  46
New Member

This is probably totaly wrong place to ask this question, but I am getting desperate. Been looking all over the web for an answer.

Is there any way to determine the internal format of the data in an IplImage? The amounts of bits per channel is there, all good. But a 32bit integer and a 32bit float is kinda different on bit level. How can I determine if I get feeded with floats or integers from the captures? Are they allways integers or can they deviate and be a float from time to time?

Assume that if no value in the feed is higher than 1.0 it’s a floats… but then on the other hand, a 0.001 float read as an int is way more than 1. =/

Profile
 
 
Posted: 03 November 2008 05:39 AM   [ Ignore ]   [ # 1 ]
Rank
Joined  2008-10-15
Total Posts:  63
New Member

http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html#SECTION00041000000000000000

The ‘depth’ variable on an IplImage should tell you what you need to know, if I’m understanding your question correctly. The last character on the predefined depth values correspond to ‘unsigned’, ‘signed’, and ‘float’.

Profile
 
 
Posted: 03 November 2008 08:33 AM   [ Ignore ]   [ # 2 ]
Rank
Joined  2008-10-27
Total Posts:  46
New Member

You solved it, and another problem without knowing it! The last letter on the define sure is what kind of storage type it is.
Double checking it and stumbling over the header files (oh why didn’t I look there to begin with?) I noticed that there is a flag in the bits per channel for those different types. The day I start reading the manual before hitting my head in a brick wall I might actually become something.
And that explains why I got so strange results in getting the the amounts of bits per channel, a negative 2 billion seemed a bit wrong but as it’s C++ it’s always pointer error. =P

Profile