Access to image data

QiaoQiao Global Mapper UserPosts: 74Trusted User
edited September 2011 in Raster Data
Hi Mike,

I might have asked this question before. Does GM SDK support any direct access to the image data (2D array) of a raster layer? I think we can use "GM_GetPixelColor" function to get the pixel values for a small area. But for the entire image or a big area, this is just too slow.

Thanks,

Qiao

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2010
    Qiao,

    There isn't currently any way to directly access an entire 2D array for an image, primarily because most images don't have an entire 2D array available in memory but instead are read from disk as-needed with rows or tiles cached for fast access.

    What we have done is recently add a GM_GetPixelElevationRow function to allow quickly receiving an entire row of elevation values. If needed we could add a GM_GetPixelColorRow function to allow doing the same for color values.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • QiaoQiao Global Mapper User Posts: 74Trusted User
    edited November 2010
    Thanks Mike.

    I understand the issue here. Adding a new function like GM_GetPixelColorRow will certainly help. Could we get a test version at some point? One question, each time we call this function or GM_GetPixelColor, does the system have to get the data from the data file on the disk (by some indexing I guess)? Just thinking whether this will be slowing things down.

    What will really help (to us at least) is to provide some function like "GM_ReadRaster" to return the geo-reference info (header) and the 2D image data. For example, Matlab's Mapping toolbox has a function for this purpose: geotiffread.

    Regards,

    Qiao
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited November 2010
    Qiao,

    I have completed adding a new GM_GetPixelColorRow function for getting an entire row at a time. There is a new build with this at http://www.globalmapper.com/GlobalMapperSDK_v135_beta.zip.

    For many raster layers getting the entire thing at once in memory simply wouldn't be possible. For example some ECW/MrSID/JPEG2000 images may be hundreds of gigabytes in size when uncompressed. If you really need the entire image you could call it for each row in the image to fill in your own buffer.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • QiaoQiao Global Mapper User Posts: 74Trusted User
    edited November 2010
    Hi Mike,

    Thanks again. We will try your new function and hopefully it meets our current needs.

    Regards,

    Qiao
  • EmanueleEmanuele Global Mapper User Posts: 2
    edited September 2011
    Hi Mike,
    I'm using the SDK and I would to find the fastest way to access and display the RASTER maps (I'm interested in standards CADRG,ASRP, CIB and GEOTiff).

    I tried the API GM_LoadLayerListEx to access to the data layers, but I noticed that this operation is quite slow, for my purpose. Once loaded and displayed I would to be able to pan the displayed map.

    1) Is There an alternative API to call for the first access to the data?

    2) Could you suggest me the list of the API to call for obtaining my goal?

    Thank you
    Ciao
    Emanuele
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited September 2011
    Emanuele,

    Is the load operation itself slow? I would expect the GM_LoadLayerListEx call to be pretty fast for those data types. You would then draw the data using GM_DrawLayerList.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • EmanueleEmanuele Global Mapper User Posts: 2
    edited September 2011
    Mike,
    I'm using the SDK v1.24 and using the API GM_LoadLayerListEx the access to layers of some source data (placed into the Hard Drive) is up to 20-30 sec.
    1) Maybe, the last version of SDK is faster using that API?

    Moreover, my application uses OpenGl and works with different viewports countinuously re-drawn.
    I did some tests using the API GM_DrawLayer, specifiyng the layer to be displayed, and the device context to draw to, but the result was unsatisfactory: the image was flickering, as if the two thread (Globalmapper and Application) was not synchronized.
    Now I Would try the API GM_DrawLayerListToMemory, in order to texture and re-draw only it is necessary.
    2) Could you explain the use of the parameter aRowWidthBytes and the link with the aDataBuf ?

    Thank you Mike

    Emanuele
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited September 2011
    Emanuele,

    I would definitely first suggest getting the v1.37 SDK release from the Developers page at http://www.globalmapper.com/ and see if that helps.

    I'm not sure about the flickering, it sounds like you need to double buffer rather than erasing your main device context and then drawing directly to it. Just draw to a memory device context, then when that completes BitBlt the results of that to your main DC which should avoid the flickering.

    The aRowWidthBytes is how many bytes wide each row in the data buffer that you provide is. Typically you just say 0 and then it is the width of your memory buffer in pixels multiplied by the specified bit depth.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
Sign In or Register to comment.