create a layer to return images from a postgis DB - geoserver

I'd like to identify a solution to create a WMS layer in geoserver that returns an image stored in the DB (postgis) projected (moved, scaled and rotated) to specific coordinates.
In the DB I store the house floor plans as jpeg and I need to rotate, scale, move those image to a given latitude and longitude so that I can overlap to OSM map in open layer.

Yes my web app is based on openlayer, my collegue succeeded in trasforing the image (traslate, rotate, resize) in openlayer, but I think it should be performed on the backend that is postgis+geoserver
My images are stored as jpeg (or raster) in the postgis, but I do not know how geoserver can read them directly from the DB and transform them based on some parameters.
Thank you
Federico

Related

PNG Tiles for Geoserver

I have png tiles structured in folders (generated by Mapnik and Maperitive). What is the best way to use these tiles in Geoserver to create wms? I need this base layer from tiles with second one layer of route and provide it to client. When I try load it with ImagePyramid plugin, I've got error about 404000 projection:
Caused by: org.opengis.referencing.operation.OperationNotFoundException: No transformation available from system "EngineeringCRS[Wildcard 2D cartesian plane in metric unit]" to "GeographicCRS[WGS84(DD)]".
There is no out of the box way to expose those tiles, you'll have to write some java code in the GeoWebCache project

Get dimensions of objects within an image

i'm planning to build a web app where following feature is used:
Imagine uploading an image,
and the dimensions within the image need to be retrieved
e.g. I would like to know the height and width of the input field.
given the fact I can provide the base image sizes and aspect ratio's.
How would one go about getting the marked dimensions out of the given image?
is there an open API that could do this?
Is this even a possiblity?

How to make curve and rounded image in Blackberry 10 native?

I am trying to curve and round the image but I am not able to do it perfectly. I have tried to create an .amd file and set it as the background but this is not working perfectly. Is there any other way through which I can make the image round as well as curved on a Blackberry - 10.?
I am getting an image as a response from the server like below:
I want something like the following images.Images are not static they are dynamic it's comes from web service.
I have checked the links from the BlackBerry forums also but did not get a proper solution. If anyone knows then please let me know.
To put rounded corners on an image I would use the the Nine Slice feature described in the API. Using a drawing program crreate a small square example of the frame. Using the nine slice system to scale it to the size of your image and lay it over your image.
The same procedure will work for cicularly vignetting images. Depending on howmany sizes you want you may have to draw them on the fly or have several sizes and scale to other sizes.

Image similarity detection

I've been playing around writing a scraper that scrapes Deviantart.com. It saves a copy of new images locally, and also creates a record in a Postgresql DB for the image. My problem: as new images come in, how do I know if this new image corresponds to an image I've seen before? Dupes are fairly rare on DA, but at the same time, this is an interesting problem in a more general sense.
Thoughts on ways to proceed?
Right now the Postgresql DB is populated as I scrape images, and which has a table which looks like:
CREATE TABLE Image
(
id SERIAL PRIMARY KEY NOT NULL,
url varchar(5000) UNIQUE NOT NULL,
dateadded timestamp without time zone default (now() at time zone 'utc'),
width int,
height int
);
Where url is the link to the image as I scraped it from DA (ex: http://th05.deviantart.net/fs70/PRE/f/2014/222/2/3/sketch_dump_56_by_lilaira-d7uj8pe.png), dateadded is the datetime the scraper found the image, and width & height are the image dimensions.
I currently don't store the image itself in the database, but I do keep a local mirror -- I take the url for the image and wget -r -nc the file. So for a url: http://th05.deviantart.net/fs70/PRE/f/2014/222/2/3/sketch_dump_56_by_lilaira-d7uj8pe.png I keep a local copy at <somedir>/th05.deviantart.net/fs70/PRE/f/2014/222/2/3/sketch_dump_56_by_lilaira-d7uj8pe.png
Now, image recognition in the general case is quite hard. I want to be able to handle things like slight resizes, which I could account for by normalizing all images kept to a specific resolution, and normalize the query image to that same resolution at query time. I want to be able to handle things like change of format (PNG vs JPG vs etc) which I could do by reading an image file into a normalized format (ex: uncompressed RGB values for each pixel, though ideally some "slack" would be tolerated here).
Nice to haves (would be willing to give up for simplification/better accuracy):
I'd like to be able to handle cropping an image (ex: I've previously seen imageA, and somebody takes imageA and crops it and uploads it as imageB I'd like to notice that as a duplicate).
I'd like to be able to handle watermarking an image with a logo
I'd like to be able to handle cropping in a case where the new image to classify is a subimage of a previously seen image (ie - I have imageA stored, somebody takes imageA and crops it, I'd like to be able to map that cropped image to imageA)
Constraints/extra info:
I'm not at all interested in finding images that are different yet similar (ex: two distinct photos of the same Red Bus should be reported as two distinct images)
while I'm not entirely opposed to using metadata (ex: artist, image category, etc), I'd like to keep this as constrained to just the image data (EXIF data, resolution, RBG colour values) as possible.
an image that is sized down and appears in a new larger image I wish to consider as different. Ex: I have imageA, I resize it to 50x50, and that 50x50 grid appears in a new image, I would not consider the new image "the same" as imageA (though I suppose by the criteria outlined previously I would consider imageA a duplicate of the new image)
It would be nice but not required if one could detect "minor" revisions in the image (ex: a blanket change to the the gamma value in an image, etc)
Thoughts? Suggestions?
For my use case I'm far more concerned about false positives than false negatives, and as such a "fuzzy match" approach should err on the side of caution.
In case it matters I'm writing all of this in Python, though TBH I'm happy to use an alternate tech if it solves my problem elegantly/efficiently.
I would grab a small subimage somewhere not near the edges, and cross correlate this within the vicinity of its source location in your database images. You can resample it prior to cross correlation to account for small resizes, and you can choose the size of the vicinity that you match against to account for asymmetrical crops of a certain percentage.
To avoid percect fits on featureless regions (e.g. the sky) you could use local image variation as a selection criterion for the subimage location.
This would still be quite slow, so it will be necessary to use a global image metric to first select candidate duplicates from the database (e.g. the color histograms mentioned by danf).

custom satellite image as background in ggplot

I want to use a satellite image as a background for plotting polygons, points, etc ... using ggplot.
I managed to use google earth imagery with the ggmap function but I'd rather have a false colour composite from my own image as a background. As this image is rather heavy (>2GB) I prepared the false colour composite in Arcmap and exported it as .jpeg with coordinates attached (.jgw) to reduce resolution.
The problem is how I can add this image as a (georeferenced base) layer in ggplot? When importing the jpeg (938 rows and 1743 columns) using readGDAL, a SpatialGridDataFrame is created with the three (RGB) bands.
All help appreciated
The core piece to a ggmap object is just a matrix of colors with some attributes (use the str function on one).
You should be able to read in your jpeg file and create a raster from it, then just change the attributes to match those of a ggmap object (mainly just the class and the bounding box information). You should then be able to use it with the ggmap function.

Resources