API Terrain RGB v4: tile with no data pixels row - mapbox

Calling Mapbox Terrain RGB API v4, i found some tiles with southest row of pixel having no data.
This is an example (blue pixels on last row):
https://api.mapbox.com/v4/mapbox.terrain-rgb/16/34162/23551#2x.pngraw?access_token=pk...
Error data or is an expected behavior?

Related

How can I measure the distance from vector coordinate to a raster pixel?

I have a file of geocoded point data (not pictured) that overlays a 30m cell size raster with the pixels of interest shown in green (image below).
For each point I want to calculate the distance to nearest green pixel. I tried raster to point (an attempt to convert each pixel to a point), but this process takes a long time to complete (days). Are there other viable options for me?
Is there something I can first do to the raster to preprocess it in order to make it a smaller file (dropping pixels if they are not pixels of interest) before attempting the raster to point conversion?
One way this can be done is by reducing the number of pixels to the pixels of interest. For now, I'm using this workflow below. Although it takes some time, it works.
Reproject raster and/or point data, if necessary
Reclassify the raster (No Data applied to the non-interest pixels)
Raster to point
Near tool for distance to nearest point

Mapbox Terrain v2: how do I modify contour elevation range?

I'm using Mapbox Terrain vector tileset to show elevation contours on my map. But my region of interest is quite flat, so there aren't any visible contours in that area. (basically, I see contours all around my region, but not in the actual region I need the contours for.)
How do I modify the ele field of the contour layer to change the contour density? Thank you!
Mapbox Terrain-v2, #contour, ele field
Based on the documentation, you have to use the exaggeration param, that will exaggerates the elevation of the terrain by multiplying the data from the DEM with this value
map.setTerrain({
'source': 'mapbox-dem',
'exaggeration': 1.5 // x1.5 multiplier to exaggerate DEM data
});

Coordinate of a pixel of an image to coordinate on the texture

A Texture2D is mapped on a sphere. Thanks to GetPixel(raycastHit.texturecoord) I can get the pixel value of this texture, when, for instance, a ray hit the sphere. So if I convert an image I to a texture T and map T on a GameObject G, I can get the pixel value from G to I (G--textureCoord-->T--GetPixel-->I). If I convert those (x,y) coordinates into world coordinates, I can trigger event on certain colors, so it works. I use this solution to perform pixel to world position.
But I can't do the opposite. Imagine that I have a list of bounding boxes for different objects on the image I (so with coordinates between I.width and I.height). If I convert those coordinates (bx1, bx2) into world coordinates it simply doesn't work.
I noticed that when I compare the GetPixel value when I target a given color on G with my controller, I don't get the same pixel coordinates as the one on the original image.
In the end I want to get the texture coordinate from an image (G<--textureCoord_to_word_coordinates--T<--?????---I).

Matlab - Indexes of image pixels in bwconncomp function

I've been writing a text detection code and I'm working with a binary map as a mask to work on the image. After I get the candidate text regions I apply the bwconncomp function on the image after applying the mask on it to get the position of those regions.
Now I've created a loop to discard the regions that don't satisfy some "clauses". When it doesn't, I put all the pixels in that region to 0 (image(cc.PixelIdxList{region})=0) and the same thing with the binary map (map(cc.PixelIdxList{region})=0).
When I plot the map and the image before getting in the loop they tally, but after it they don't. When I plot the image after the loop it shows that it erased the region perfectly, but that's not the case with the map. Sometimes there are left some pixels that are within the region.
So my guess is: the pixel indexes that bwconncomp gives to the pixels in the image are not exactly the same as those in the map, that's why some pixels in the map aren't erased when they should be. Am I right? Or should I be looking somewhere else?
I was using the grayscale image to compute the connected components and not the binary map, so when some of those regions had pixels with value 0, the bwconncomp function computed them as they weren't part of the region. So then when I erased a region those pixels stayed at value 0 while the pixels on the map weren't erased.

Mapping Depth onto RGB Kinect using MATLAB

I am trying to map the Depth map onto the RGB image on the Kinec using MATLAB.
So here are the steps that I took:
(1) Obtain the images using a C++ program.
(2) Using the depth value from each pixel on MATLAB, I was able to obtain the XYZ distances of all the pixels in mm.
(3) Then using some equations, I was able to obtain the XY pixel coordinates of those depth pixels on the RGB image.
So I am left with a huge cell containing all the locations of the depth map w.r.t the color image.
So my question is now if I want to overlay the depth image on the color image, how can I do that?
Can anyone help me?
Thanks;