D3.js contour plot not working (Possible bug of d3 contour) - d3.js

I am plotting a d3.js contour plot. I am following the same steps as shown in the link http://bl.ocks.org/mbostock/4241134 and https://gist.github.com/mbostock/4241134. But the problem is my code is not working. The size of my 2D matrix for contour plot is dx=82 and dy=141. My code is not plotting anything instead its hanging the browser. I wonder is there any size restriction of matrix on the contour plot? Do you have any idea?

Actually its not really a bug, it's just that the data is incompatible with the colour domain you have specified. For example, the colour domain runs from 95 to 195 and your data is all 10. So there is no intersection between the data and the contours. This is the failure mode.
If you change your contour domain or your data so that they intersect it will be fine.

Related

How to bold legend and axis in 3d scatter plot in Matlab

I have one question. How to bold legend and axis in 3d scatter plot in Matlab?
Anyone can help me.
Thank you
Run this after the figure is created, it sets all text elements of the current figure to bold:
set(findall(gcf,'type','text'), 'FontWeight','bold')
It is not 3D scatter specific and is answered here as well: Changing Fonts in Matlab Plots

How to saturare Point Cloud Material in Three.js

I've a point cloud object in Three.js with thousands of 2d geo location points. They are laying on the same z plane.
Currently, with using normal blending with semitransparent points, I can achieve the first result of the image below, blending the colors of the overlapping points to achieve an alpha value of 1.
I'm interested to achieve the saturation of the second image where overlapping points saturate to white. Is it possible using only blending? or I need something else like Effect Composer?
Thanks

Find my camera's 3D position and orientation according to a 2D marker

I am currently building an Augmented Reality application and stuck on a problem that seem quite easy but is very hard to me ... The problem is as follow:
My device's camera is calibrated and detect a 2D marker (such as a QRCode). I know the focal length, the sensor's position, the distance between my camera and the center of the marker, the real size of the marker and the coordinates of the 4 corners of the marker and of it center on the 2D image I got from the camera. See the following image:
On the image, we know the a,b,c,d distances and the coordinates of the red dots.
What I need to know is the position and the orientation of the camera according to the marker (as represented on the image, the origin is the center of the marker).
Is there an easy and fast way to do so? I tried some method imagined by myself (using Al-Kashi's formulas), but this ended with too much errors :(. Could someone point out a way to get me out of this?
You can find some example code for the EPnP algorithm on this webpage. This code consists in one header file and one source file, plus one file for the usage example, so this shouldn't be too hard to include in your code.
Note that this code is released for research/evaluation purposes only, as mentioned on this page.
EDIT:
I just realized that this code needs OpenCV to work. By the way, although this would add a pretty big dependency to your project, the current version of OpenCV has a builtin function called solvePnP, which does what you want.
You can compute the homography between the image points and the corresponding world points. Then from the homography you can compute the rotation and translation mapping a point from the marker's coordinate system into the camera's coordinate system. The math is described in the paper on camera calibration by Zhang.
Here's an example in MATLAB using the Computer Vision System Toolbox, which does most of what you need. It is using the extrinsics function, which computes a 3D rotation and a translation from matching image and world points. The points need not come from a checkerboard.

unable to plot polygons in d3.js "format" over leaflet.js

I am doing a very simple implementation of plotting polygons in Leaflet.js using d3.js
I am following this: http://bost.ocks.org/mike/leaflet/
Polygons are plotted correctly, but when zooming in/out most of them are not visualized (even if in DOM I can see these hidden polygons)
You can check http://bl.ocks.org/pere/7370413
Any ideas?
The bounds were being calculated outside of the reset function so it was using the original zoom (I think this might be a small error in Mikes Bl.ock, although experience has taught me this is rarely the case). Because the bounds were calculated outside of reset it was using the original zooms bounds and hence you saw the polygons drift. Also, this stops the polygons being "cut-off" (which occurs in Mike's Bl.ock).
Anyway I bumped your Bl.ock to here. There are some other minor changes as well.
Hope this helps.

jqPlot Cursor follow series line

I have a line graph using jqPlot with one series and several data points across it and smoothed lines. I'm using the Cursor plugin to show crosshairs and a tooltip to show x and y points.
Is it possible to have the cross hairs follow the line on the series? So the horizontal line would fix to the y position of the line and not following the mouse. I see you can get the x/y position of each data point but not of the lines inbetween points.
Thanks
If you are using the built in smoothing options the smoothed data points are stored at:
plotObj.series[0].renderer._smoothedPlotData
with pixel locations at:
plotObj.series[0].renderer._smoothedData

Resources