custom satellite image as background in ggplot - image

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.

Related

Xcode custom symbol image set asset

From Apples documentation I read:
An alternative to creating bitmap images is to use template images or symbol images instead. Template images specify the shape you want to draw, but not the associated color information. Symbol images are similar to template images but are vector based, so they scale to different sizes. Both types of images simplify the process for supporting Dark Mode. They also reduce the number of image assets you must ship with your app.
Do I understand this correct that I can not use a vector based symbol image set as a replacement for bitmap but scalable?
Update
My situation:
I've an Image Set in my iOS project. There I can add three bitmaps for the three scaling options iOS devices support. Those images must be of type *.png
Now I would like to replace those three bitmaps with a single vector graphic file *.svg. This seems not possible. If I want to use vector graphic images I've to add another asset type called "symbol image set" (Xcode -> Editor -> Add Assets -> New Symbol Image Set).
So far so good but now my question. Those "symbol image set" assets only the the shape but not the color information into account. That's why I would like the "old" way where the color information is taken into account but the file being a vector graphics file (*.svg).
You don't actually need a Symbol Set for what you are trying to achieve.
All you need is a vector image in pdf format, marking it as Single Scale
Then, you can mark the asset as template (meaning you can tint it with any color) or original if you want to retain its original colors.
Finally, note that although you supply vector images, Xcode by default will produce png versions for all scales behind the scenes. If you need to preserve the vector data (which can help in some cases where you need to upscale) you can enable Preserve Vector Data as well.

How can I create a pixel labelled image for Semantic Segmentation?

I am following the Semantic Segmentation Examples tutorial by MathWorks.
I understand that I can load pixel labeled images
pxDir = fullfile(dataDir,'buildingPixelLabels');
Define the class names.
classNames = ["sky" "grass" "building" "sidewalk"];
Define the label ID for each class name.
pixelLabelID = [1 2 3 4];
and create a pixelLabelDatastore.
pxds = pixelLabelDatastore(pxDir,classNames,pixelLabelID);
But, how do I create a custom pixel labelled image where every pixel value represents the categorical label of that pixel?
I would then proceed by writing:
pxDir = fullfile(dataDir,'myCustomPixelLabels');
If I understood correctly, imageDatastore holds the actual image and not the pixel labels for that image.
EDIT:
On my system pxDir points to 'C:\Program Files\MATLAB\R2017a\toolbox\vision\visiondata\buildingPixelLabels'. Since I am on Matlab2017a so this example is not included by default, and I cannot compare or view the file to get a better understanding of what I need to do to reproduce this example.
The answer can be found here.
Matlab 2017a
Go to the APPS tab, and search for Image Labeler, or Training Image Labeler
Click on Add Images to add your training images.
Click on Add ROI Labels to add class names for the regions of interest.
Proceed to select the regions of interest manually from the uploaded images.
Once areas are selected, the data can be exported to workspace as a Ground Truth object.

DX11 add a simple black box on a texture

I want to add a simple black box(like this: effect) on a texture(ID3D11ShaderResourceView), is there a simple way to do it in DX11? don't want write a shadow to do it.
Well, what you're trying to do is actually "initializing texture programmatically". Textures from D3D POV are nothing more than pieces of memory with clearly defined layout. Normally, you create a texture resource, read data from a texture file (like *.BMP for example), put the data in the texture and then feed it to the pipeline for sampling.
In your case though, you need an additional step:
Create texture resource using either D3D11_USAGE_DEFAULT or D3D11_USAGE_DYNAMIC flag - so you can access it from the CPU
Read the color map to your texture
Depending on the chosen type, either add your data to the initial data or Map/Unmap and add your data (by your data I mean overwrite each edge of the image with black color)
This can be also done to kind of "generate" textures, like for example checker-board or clouds.
All the information you need can be found here.

Matlab gui image incorrectly blue

I am creating a GUI containing an image using the following code:
try
Imagenamehere = imread('Imagenamehere.jpg');
axes(handles.Logo)
image(Imagenamehere)
set(gca,'xtick',[],'ytick',[])
catch
msgbox('Please download all contents from the zipped file into working directory.')
end
The image shows up but for some reason is completely coloured blue as if put through a blue filter. I don't think it would be wise to upload the image but it is a simple logo coloured black and white.
Anyone know what could be causing this?
Check the size, type (probably uint8) and range of your image. It sounds like for some reason your images are being displayed with colormap as jet (the default), and possibly also that your range is not what MATLAB expects (e.g. 0 to 1 not 0 to 255), resulting in all your values being relatively low (blue on the jet colormap).
"black and white" is just one way of interpreting an image file which contains only two colors. MATLAB makes several assumptions when you pass data into a display function like image. If you don't specify colormap and image data range, it will make a guess based off things like data type.
One possibility is that your logo file is an indexed image. In these cases you need to do:
[Imagenamehere map] = imread('Imagenamehere.jpg');
colormap(map);

Parametric Image Generator

I am looking for a parametric image generator that can for a specified parameters produce different images of the same object (e.g. lobster images where each image contains the same lobster of different fatness).
I need to be able to control parameters (e.g. set lobster's fatness). The image and the object it represents could be basically anything.
Is there any existing library/software that produces such images?
Blender,
Google Sketchup,
Autocad,
3D Canvas,
MeshLab (just for the geometry part)

Resources