Registered Member
|
Problem Scope: I have a project where I need to read in DTED level 1 and 2 data from files using GDAL. I have GDAL reading the data in blocks into a short array.
Goal: To create a Eigen Map that contains a N x M tiles of DTED data. For example if am reading DTED2 level 2 data (3601x3601) starting at a given coordinate (latitude,longitude) spanning two rows and two columns. The resulting Map should be able to hold the (7201x7201) elements. (NOTE: The 3601st entry is a copy of the first row of the next tile) For example, say I have a simplified DTED tile that is 2x2 elevation points for latitude 20N and longitude 30E where I want to read for 1 degrees above 20N (2 rows) and 1 degrees to east of 30E (2 columns). The destination matrix would be a size of 4x4:
I would like to be able to copy each DTED tile into the matrix. So the tile at 20N,30E would go into the matrix as:
and 20N,31E would go in as:
Code:
Where m_elevation_data is defined as:
As well as WritePosition is defined as:
Error: The error is the user of Eigen and not Eigen itself. I am new to this set of headers and therefore I am sure I am not using it quite correctly. What I am concerned about is the conversion from a set of signed 16-bit integer values into the Eigen Map. The code above results in the following set of error messages:
|
Registered Member
|
This error means that the Eigen::Map<MatrixXi> constructor wants a int* pointer and you're trying to pass it a short int*. In Eigen, the type suffix 'i' means int, not short int. Eigen 2 has limited support for other integer types out of the box (but it's very easy to add support for more types). Eigen 3, on the other hand, supports every integer type out of the box, so you can without problem do: typedef Matrix<short int, Dynamic, Dynamic> MatrixXsi; and then use that type with Map<MatrixXsi>.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
I used the example you gave above with the Eigen 2 code. I now get an error with the NumTraits which is what I think you said Eigen 3 takes care of for me. Which version of Eigen was I suppose to use with the typedef for MatrixXsi you gave me? Start of errors:
|
Registered Member
|
This was intended for eigen 3. With Eigen 2, you'll have to add support for short ints, as explained here: http://eigen.tuxfamily.org/dox/Customiz ... ScalarType
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]