KML + Google Earth: Fill a quadrilateral with a bitmap? - maps

I'm building a KML file to use as a map layer in Google Earth and whatever else handles KML/KMZ files.
What I want to do is this: Display a number of bitmap images such that each is stretched to fit into a specified quadrilateral, where the first vertex of the quadrilateral specified would, for example, be the top-left corner of the bitmap, the next vertex would be where the top-right corner fits, and so on. Is there a (relatively) simple way to do this? If distorting/stretching the image isn't possible in any simple way, just displaying it at a specified location, scaling and rotation would be acceptable.
Update: To clarify: Given a set of four geospatial coordinates that form a quadrilateral, I'd like to take a rectangular bitmap (either via a specified URL or included in a KMZ file) and lay it onto the map such that its four corners line up with the four corners of the aforementioned quadrilateral. If it's not possible to distort an image to fit any quadrilateral, it would be sufficient to just specify position, rotation and size. Hopefully that's a little clearer.
Any help would be much appreciated.
Thanks!

Figured it out; you use a LatLonQuad:
<GroundOverlay>
<name>Example Image Overlay</name>
<color>87ffffff</color>
<Icon>
<href>mypicture.jpg</href>
<viewBoundScale>0.75</viewBoundScale>
</Icon>
<gx:LatLonQuad>
<coordinates>
-115.8993079806076,36.72147153334678,0
-115.8990441694222,36.72500067085463,0
-115.9002128356738,36.72511090523616,0
-115.9005214644026,36.72164386079184,0
</coordinates>
</gx:LatLonQuad>
</GroundOverlay>

Related

how to scale an image with gimp and save the actual scale and all the white space

there are a ton of scaling instructions for GIMP but all of them tell you to scale and save easy peasy. I feel like I'm taking crazy pills.
This is what my save or export generates:
How can I simply export a selection? Shouldn't the GIMP instructions include this detail? Sorry for ranting.
In Gimp (and some other popular image editors) the image you work on is actually made of separate images (a.ka.a layers) held together on a "canvas". The "canvas" gives the size of the final image.
There are three different ways to scale things and you have to use the right one:
The Scale tool : scales the active layer by dragging corners. Doesn't change the size of the canvas. This is probably what you used.
Layer>Scale layer: scales the active layer by providing explicit dimensions. Doesn't change the size of the canvas.
Image>Scale image: scales the whole image contents and the canvas. This is probably what you should have used.
What happened to give you the image above is that you resized the layer using the Scale tool, so you got a tiny image in the corner of the canvas, which didn't change size. The uncovered part of the canvas was displayed as a checkerboard pattern. If you exported to a format that supports transparency such as PNG or GIF the image would have been transparent, but since you exported to JPG which doesn't support transparent images Gimp replaced the transparent part by the default background color.
Everything is well explained on their website. https://www.gimp.org/tutorials/GIMP_Quickies/

Efficient image translation by (x,y) pixels?

Looking to see if anyone can recommend a computationally efficient method for translating/shifting an image by (x,y) pixels.
Reason being, I have been part successful in implementing the fourier-mellin transform to determine the rotation and translation between image frames. Once the image is unrotated I would like to untranslate the image by the calculated pixel offset (x,y). Allowing me to test the image correlation after rotation and translation.
I would think that a efficient method would be to:
Make a border cv::copyMakeBorder().
Use a ROI e.g. make a new matrix header without copying data.
Good luck

Can I read a specific image row using libjpeg?

Using libjpeg, if possible, I would like to read a row from the middle of a JPEG image without reading all the preceding rows. Can this be done?
The answer is almost certainly "yes you can, but it will take more effort than you want".
A JPEG image is a stream of markers that contain either information global to the whole compressed image, or information related to specific portions of the image. The compression works by breaking the image into color planes, possibly changing color spaces to one where the color information can be down-sampled, and within each plane operating on 8x8 pixel blocks.
For instance, it is possible to rotate a compressed image by 90 degrees if it is sized such that it is made up of only whole blocks by only transposing the basic blocks and the coefficients inside each block; i.e. without uncompressing, rotating the real image, and recompressing.
Given that, your approach would be to parse the marker stream on the way into the library, passing all the markers that are global to the image, modifying any related to image size, and dropping markers containing coefficients that lie outside your cropping rectangle.
You will likely need to further crop the result if the restriction of cropping to complete basic blocks is too coarse.
What isn't clear to me is whether there is any real win over the alternative, which is to crop the results as it comes out of the library. The library is highly configurable, so you can provide an uncompressed data consumer function that discards all pixels outside your cropping rectangle and only saves pixels you want to keep.

Store large image

I'm looking for a way to store a very large image (e.g. 100.000x100.000 pixels) on a webserver. I must be able to retrieve parts of that image and write parts into it. The cherry on top would be a way to get parts of that image, resized to a specific resolution (for example, i want alle pixels from 0,0 to 10.000,10.000 resized to 1000x1000 pixels).
Anybody know a kind of DB, or a data-structure or any other way or service or programm that can handle something like that?
thx, tux
How about Tiles?
Just like what popular mapping application (Google Maps / Bing Maps ) does. Divide and pre-process your image in to tiles for various sizes (zoom levels). Display them on a webpage with zero margin, zero border.
While retrieving, calculate positioning of tiles (which tiles should be retrieved as whole and which ones as partial) and then return as single image.
http://143.117.54.5/idl/images/img_pyrm.gif
(image ack: http://143.117.54.5/idl/Image_Tiling.html)
Search for "map servers": there are a bunch of them already available. I'm sure they at least contain components that might be of interest for you.

Silverlight Image Positioning/Transformation

What I would like to do is the following:
Change the points of the four corners of an image.
What is possible now, is to change the top left corner. But that will only move the image.
I want to transform the image by changing the corner coordinates.
The effect will be a 3d-kind transformation.
A skew transformation will not do, I want to be able to position the corners freely.
Is this possible?
I don't think you can just place corners of an image arbitarily and have it distort accordingly. It might be better if you specified the effect you are trying to acheive.
There are couple of options which may or may not suit.
Would a Matrix3DProjection serve your purpose (as well as do a lot a math for you)?
Would using the image to Fill a path or using a path to clip the image get the effect you want.

Resources