Reproducing KITTI calibration format from Autoware lidar-camera calibration - camera-calibration

Autoware calibration file for the camera-LiDAR setup:
%YAML:1.0
CameraExtrinsicMat: !!opencv-matrix
rows: 4
cols: 4
dt: d
data: [ 5.7485824720057921e-02, -2.2015060517438068e-02,
9.9810356029155001e-01, 1.5871758460998535e+00,
-9.9773309474674776e-01, -3.6302750979794518e-02,
5.6663761950436042e-02, 3.3742961287498474e-01,
3.4986448852825702e-02, -9.9909831717489750e-01,
-2.4052048040780927e-02, -7.8092020750045776e-01, 0., 0., 0., 1. ]
CameraMat: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 3.4264173924362385e+03, 0., 1.1750055482979822e+03, 0.,
3.4271319432011160e+03, 7.0638529565366980e+02, 0., 0., 1. ]
DistCoeff: !!opencv-matrix
rows: 1
cols: 5
dt: d
data: [ -3.9114669187524842e-01, 2.0517211877662116e+00,
1.3425702389588642e-03, -1.0323895351449207e-03,
-8.2463512974303352e+00 ]
ImageSize: [ 2064, 1544 ]
ReprojectionError: 0
DistModel: plumb_bob
KITTI calibratio file for a pair of image and its corresponding velodyne point cloud:
P0: 7.215377000000e+02 0.000000000000e+00 6.095593000000e+02 0.000000000000e+00 0.000000000000e+00 7.215377000000e+02 1.728540000000e+02 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00
P1: 7.215377000000e+02 0.000000000000e+00 6.095593000000e+02 -3.875744000000e+02 0.000000000000e+00 7.215377000000e+02 1.728540000000e+02 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00
P2: 7.215377000000e+02 0.000000000000e+00 6.095593000000e+02 4.485728000000e+01 0.000000000000e+00 7.215377000000e+02 1.728540000000e+02 2.163791000000e-01 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 2.745884000000e-03
P3: 7.215377000000e+02 0.000000000000e+00 6.095593000000e+02 -3.395242000000e+02 0.000000000000e+00 7.215377000000e+02 1.728540000000e+02 2.199936000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 2.729905000000e-03
R0_rect: 9.999239000000e-01 9.837760000000e-03 -7.445048000000e-03 -9.869795000000e-03 9.999421000000e-01 -4.278459000000e-03 7.402527000000e-03 4.351614000000e-03 9.999631000000e-01
Tr_velo_to_cam: 7.533745000000e-03 -9.999714000000e-01 -6.166020000000e-04 -4.069766000000e-03 1.480249000000e-02 7.280733000000e-04 -9.998902000000e-01 -7.631618000000e-02 9.998621000000e-01 7.523790000000e-03 1.480755000000e-02 -2.717806000000e-01
Tr_imu_to_velo: 9.999976000000e-01 7.553071000000e-04 -2.035826000000e-03 -8.086759000000e-01 -7.854027000000e-04 9.998898000000e-01 -1.482298000000e-02 3.195559000000e-01 2.024406000000e-03 1.482454000000e-02 9.998881000000e-01 -7.997231000000e-01
For extrinsic camera-LiDAR calibration and sensor fusion, I used the Autoware camera-LiDAR calibration tool. Now I want to use the KITTI calib format and use its files for road detection. I could not figure out how it is possible to use extrinsic matrix obtained by autoware in the kitti format. If you used this before, can you help me out how I should use rotation and transformation metrices for this purpose?

Related

Opengl matrix without glm [duplicate]

This question already has an answer here:
How do I compose a rotation matrix with human readable angles from scratch?
(1 answer)
Closed 11 months ago.
Does anybody know what the order of a 4x4 GLfloat array matrix for transforming a 2D rectangle is? I don't want to use glm or cglm to make my life easy. I'm trying to use the least amount of libraries as possible.
Is the order something like this:
{ px, sx, rx, 0, py, sy, ry, 0, pz, sz, rz, 0, 0, 0, 0, 1 } ?
If not what is it?
Thanks!
4x4 matrix is for 3D.
Xx Yx Zx Tx
Xy Yy Zy Ty
Xz Yz Zz Tz
0 0 0 1
(Xx, Xy, Xz) - left (or right) vector
(Yx, Yy, Yz) - up vector
(Zx, Zy, Zz) - forward vector
(Tx, Ty, Tz) - translation (position) vector
indices:
m00 m01 m02 m03
m10 m11 m12 m13
m20 m21 m22 m23
m30 m31 m32 m33
Order: m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33
If you need only 2D transformations you can use a 3x3 matrix.
Xx Yx Tx
Xy Yy Ty
0 0 1
Order: m00, m10, m20, m01, m11, m21, m02, m12, m22
Or you want this?
Xx Yx 0 Tx
Xy Yy 0 Ty
0 0 1 0
0 0 0 1

Extracting Z (Elevation in meters) value any any point of a 3D Building file in 3D Tiles format using RayCasting on iTowns based on Three.js

I have loaded a 3D building mesh file in 3D Tiles (Cesium 3D Tiles) format on iTowns (http://www.itowns-project.org/). When I click on any point of the building, I am getting the longitude and latitude (X and Y). But, I also want to get the height (Z) of the particular point of the building on which I am clicking. I am trying to do three.js Raycasting (https://threejs.org/docs/#api/en/core/Raycaster) for extracting the Z value when I click any point on the building.
<script type="text/javascript">
var THREE = itowns.THREE;
var long_rad = -1.31968;
var lat_rad = 0.698874;
// Longitude and Latitude from tileset.json
var long_deg = THREE.Math.radToDeg( long_rad );
var lat_deg = THREE.Math.radToDeg( lat_rad );
var placement = {
coord: new itowns.Coordinates('EPSG:4326', long_deg, lat_deg, 0),
range: 2000
}
var viewerDiv = document.getElementById('viewerDiv');
var view = new itowns.GlobeView(viewerDiv, placement);
view.camera.camera3D.near = 5;
setupLoadingScreen(viewerDiv, view);
var menuGlobe = new GuiTools('menuDiv', view, 300);
itowns.Fetcher.json('./layers/JSONLayers/OPENSM.json').then(function _(config) {
config.source = new itowns.TMSSource(config.source);
var layer = new itowns.ColorLayer('Ortho', config);
view.addLayer(layer).then(menuGlobe.addLayerGUI.bind(menuGlobe));
});
var $3dTilesLayerDiscreteLOD = new itowns.C3DTilesLayer('3d-tiles-discrete-lod', {
name: 'DiscreteLOD',
sseThreshold: 0.05,
source: new itowns.C3DTilesSource({
url: 'http://localhost:8080/Data/Cesium3DTiles/Tilesets/Tileset/tileset.json',
}),
}, view);
itowns.View.prototype.addLayer.call(view, $3dTilesLayerDiscreteLOD);
var $3dTilesLayerRequestVolume = new itowns.C3DTilesLayer('3d-tiles-request-volume', {
name: 'RequestVolume',
source: new itowns.C3DTilesSource({
url: 'http://localhost:8080/Data/Cesium3DTiles/Tilesets/TilesetWithViewerRequestVolume/tileset.json',
}),
sseThreshold: 1,
}, view);
var pickingArgs = {};
pickingArgs.htmlDiv = document.getElementById('featureInfo');
pickingArgs.view = view;
pickingArgs.layer = $3dTilesLayerRequestVolume;
itowns.View.prototype.addLayer.call(view,
$3dTilesLayerRequestVolume).then(function _() {
window.addEventListener('mousemove',
(event) => fillHTMLWithPickingInfo(event, pickingArgs),false);
//(event) => picking(event, pickingArgs.htmlDiv, pickingArgs.view, pickingArgs.layer), false);
});
var d = new debug.Debug(view, menuGlobe.gui);
debug.createTileDebugUI(menuGlobe.gui, view, view.tileLayer, d);
debug.create3dTilesDebugUI(menuGlobe.gui, view, $3dTilesLayerDiscreteLOD, d);
debug.create3dTilesDebugUI(menuGlobe.gui, view, $3dTilesLayerRequestVolume, d);
d.zoom = function() {
view.camera.camera3D.position.set(long_rad, lat_rad, 0);
view.notifyChange(view.camera.camera3D);
}
menuGlobe.gui.add(d, 'zoom').name('Go to point cloud');
function mouseclick_actions() {
var cameraTargetPosition = view.controls.getLookAtCoordinate();
viewerDiv.addEventListener("click", event => {
var a = view.controls.pickGeoPosition(view.eventToViewCoords(event));
cameraTargetPosition['x'] = a["x"];
cameraTargetPosition['y'] = a["y"];
console.log('a = ', a);
event_norm_coord = view.eventToNormalizedCoords(event);
console.log("event_norm_coord = ", event_norm_coord);
//Raycasting process
let rayCast = new THREE.Raycaster();
rayCast.setFromCamera(event_norm_coord, view.camera.camera3D);
console.log("rayCast = ", rayCast);
console.log("rayCast.ray = ", rayCast.ray);
console.log("rayCast.ray.origin = ", rayCast.ray.origin);
o = createSphere(rayCast.ray.at(100));
console.log("o = ", o);
dist = rayCast.ray.distanceSqToPoint(rayCast.ray.origin);
console.log("dist = ", dist);
});
}
// Listen for globe full initialisation event
view.addEventListener(itowns.GLOBE_VIEW_EVENTS.GLOBE_INITIALIZED, function globeInitialized() {
mouseclick_actions();
});
let createSphere = function(pos) {
const RADIUS = 5;
console.log("pos = ", pos);
let material_mesh = new THREE.MeshPhongMaterial({color: 0X4a57fa, shininess: 100, side: THREE.DoubleSide});
let geometry_mesh = new THREE.SphereGeometry(RADIUS, 30, 30);
let sphere = new THREE.Mesh(geometry_mesh, material_mesh);
sphere.position.set(pos.x, pos.y, pos.z);
view.scene.add(sphere);
}
</script>
console.log() outputs are:-
a = Coordinates {isCoordinates: true, crs: "EPSG:4326", x: -75.61200231318375, y: 40.041814443380126, z: -0.13751138653606176, …}crs: "EPSG:4326"isCoordinates: truex: -75.61200231318375y: 40.041814443380126z: -0.13751138653606176_normal: Vector3 {x: 0, y: 0, z: 0}_normalNeedsUpdate: truealtitude: (...)geodesicNormal: (...)latitude: (...)longitude: (...)__proto__: Object
event_norm_coord = Vector2 {x: 0.1967741935483871, y: -0.20081549439347612}x: 0.9887096774193549y: -0.5372069317023445height: -0.5372069317023445width: 0.9887096774193549__proto__: Objectadd: ƒ ( v, w )addScalar: ƒ ( s )addScaledVector: ƒ ( v, s )addVectors: ƒ ( a, b )angle: ƒ ()applyMatrix3: ƒ ( m )ceil: ƒ ()clamp: ƒ ( min, max )clampLength: ƒ ( min, max )clampScalar: ƒ ( minVal, maxVal )clone: ƒ ()copy: ƒ ( v )cross: ƒ ( v )distanceTo: ƒ ( v )distanceToManhattan: ƒ ( v )distanceToSquared: ƒ ( v )divide: ƒ ( v )divideScalar: ƒ ( scalar )dot: ƒ ( v )equals: ƒ ( v )floor: ƒ ()fromArray: ƒ ( array, offset )fromAttribute: ƒ ( attribute, index, offset )fromBufferAttribute: ƒ ( attribute, index, offset )getComponent: ƒ ( index )isVector2: truelength: ƒ ()lengthManhattan: ƒ ()lengthSq: ƒ ()lerp: ƒ ( v, alpha )lerpVectors: ƒ ( v1, v2, alpha )manhattanDistanceTo: ƒ ( v )manhattanLength: ƒ ()max: ƒ ( v )min: ƒ ( v )multiply: ƒ ( v )multiplyScalar: ƒ ( scalar )negate: ƒ ()normalize: ƒ ()random: ƒ ()rotateAround: ƒ ( center, angle )round: ƒ ()roundToZero: ƒ ()set: ƒ ( x, y )setComponent: ƒ ( index, value )setLength: ƒ ( length )setScalar: ƒ ( scalar )setX: ƒ ( x )setY: ƒ ( y )sub: ƒ ( v, w )subScalar: ƒ ( s )subVectors: ƒ ( a, b )toArray: ƒ ( array, offset )constructor: ƒ Vector2( x, y )height: (...)width: (...)get height: ƒ ()arguments: (...)caller: (...)length: 0name: "get"prototype: {constructor: ƒ}__proto__: ƒ ()[[FunctionLocation]]: three.module.js?5a89:619[[Scopes]]: Scopes[5]set height: ƒ ( value )get width: ƒ ()set width: ƒ ( value )__proto__: Object
rayCast = Raycaster {ray: Ray, near: 0, far: Infinity, camera: PerspectiveCamera, layers: Layers, …}camera: PerspectiveCamera {uuid: "8CE2A7FF-28F4-4CBD-9B56-316C193EF7DC", name: "", type: "PerspectiveCamera", parent: null, children: Array(0), …}far: Infinitylayers: Layers {mask: 1}near: 0params: LOD: {}Line: {threshold: 1}threshold: 1__proto__: ObjectMesh: {}Points: {threshold: 1}Sprite: {}PointCloud: (...)get PointCloud: ƒ ()__proto__: Objectray: Raydirection: Vector3x: -0.07883103464612029y: 0.7740105989626435z: 0.6282461783967429__proto__: Objectorigin: Vector3 {x: 1215046.3152875216, y: -4736495.215309124, z: 4081428.7261119974}__proto__: ObjectlinePrecision: (...)__proto__: Object
rayCast.ray = Ray {origin: Vector3, direction: Vector3}direction: Vector3x: -0.07883103464612029y: 0.7740105989626435z: 0.6282461783967429__proto__: Objectorigin: Vector3x: 1215046.3152875216y: -4736495.215309124z: 4081428.7261119974__proto__: Object__proto__: Object
rayCast.ray.origin = Vector3 {x: 1215046.3152875216, y: -4736495.215309124, z: 4081428.7261119974}x: 1215046.3152875216y: -4736495.215309124z: 4081428.7261119974__proto__: Objectadd: ƒ ( v, w )addScalar: ƒ ( s )addScaledVector: ƒ ( v, s )addVectors: ƒ ( a, b )angleTo: ƒ ( v )applyAxisAngle: ƒ ( axis, angle )applyEuler: ƒ ( euler )applyMatrix3: ƒ ( m )applyMatrix4: ƒ ( m )applyNormalMatrix: ƒ ( m )applyProjection: ƒ ( m )applyQuaternion: ƒ ( q )ceil: ƒ ()clamp: ƒ ( min, max )clampLength: ƒ ( min, max )clampScalar: ƒ ( minVal, maxVal )clone: ƒ ()copy: ƒ ( v )cross: ƒ ( v, w )crossVectors: ƒ ( a, b )distanceTo: ƒ ( v )distanceToManhattan: ƒ ( v )arguments: (...)caller: (...)length: 1name: "distanceToManhattan"prototype: {constructor: ƒ}__proto__: ƒ ()[[FunctionLocation]]: three.module.js?5a89:49649[[Scopes]]: Scopes[5]distanceToSquared: ƒ ( v )divide: ƒ ( v )divideScalar: ƒ ( scalar )dot: ƒ ( v )equals: ƒ ( v )floor: ƒ ()fromArray: ƒ ( array, offset )fromAttribute: ƒ ( attribute, index, offset )fromBufferAttribute: ƒ ( attribute, index, offset )getColumnFromMatrix: ƒ ( index, matrix )getComponent: ƒ ( index )getPositionFromMatrix: ƒ ( m )getScaleFromMatrix: ƒ ( m )isVector3: truelength: ƒ ()lengthManhattan: ƒ ()lengthSq: ƒ ()lerp: ƒ ( v, alpha )lerpVectors: ƒ ( v1, v2, alpha )manhattanDistanceTo: ƒ ( v )manhattanLength: ƒ ()max: ƒ ( v )min: ƒ ( v )multiply: ƒ ( v, w )multiplyScalar: ƒ ( scalar )multiplyVectors: ƒ ( a, b )negate: ƒ ()normalize: ƒ ()project: ƒ ( camera )projectOnPlane: ƒ ( planeNormal )projectOnVector: ƒ ( v )random: ƒ ()reflect: ƒ ( normal )round: ƒ ()roundToZero: ƒ ()set: ƒ ( x, y, z )setComponent: ƒ ( index, value )setEulerFromQuaternion: ƒ ()setEulerFromRotationMatrix: ƒ ()setFromCylindrical: ƒ ( c )setFromCylindricalCoords: ƒ ( radius, theta, y )setFromMatrix3Column: ƒ ( m, index )setFromMatrixColumn: ƒ ( m, index )setFromMatrixPosition: ƒ ( m )setFromMatrixScale: ƒ ( m )setFromSpherical: ƒ ( s )setFromSphericalCoords: ƒ ( radius, phi, theta )setLength: ƒ ( length )setScalar: ƒ ( scalar )setX: ƒ ( x )setY: ƒ ( y )setZ: ƒ ( z )sub: ƒ ( v, w )subScalar: ƒ ( s )subVectors: ƒ ( a, b )toArray: ƒ ( array, offset )transformDirection: ƒ ( m )unproject: ƒ ( camera )constructor: ƒ Vector3( x, y, z )__proto__: Object
pos = Vector3 {x: 1215038.432184057, y: -4736417.814249228, z: 4081491.5507298373}x: 1215038.432184057y: -4736417.814249228z: 4081491.5507298373__proto__: Object
o = undefined
dist = 0
When I click on any point on the 3D Tiles file, I have to display X, Y and Z. I am getting X and Y (in this case, x: -75.61200231318375 and y: 40.041814443380126. But, I am getting z: -0.13751138653606176. Instead, what I want is to display the height of building from bottom to the particular point. For example, if I click on the the middle point of a building (example, middle point of 2nd floor out of 3 floors), then I have to get z=5 m if total height of building=10 m.
How can I solve this issue of extracting height value in units of meters?

For loop crashes in gnuplot

I am experiencing an erratic behaviour on a heavy lined gnuplot script.
The script intends to plot borderlines. Filledcurve and line styles are used. Also a mono-parametric family of curves are displayed via
plot for [i=1:4] f(x,i) title sprintf("f(x,i) i=%d",i) w l dt 2
I tweeted an example here https://pbs.twimg.com/media/DHbeEgXXkAAV6aS.jpg:large
After this plot I continued introducing Argentina. After a new lines of codes the dashed lines in blue started to behave erratically. Two of them simply vanished.
I started debugging the code and ultimately make use of the set table utility outputing the whole plot into a single file.
I found the for-loop was behaving erraticly. The title line showed that the loop variable i was correctly running from start to end values. However the function f(x,i) was not properly fed with the correct value of i.
On the first iteration the value the loop worked fine and the script plotted f(x,1). On the second iteration the function was correctly fed and displayed f(x,2). But hereafter the function was always fed with i=2 despite title string correctly showed the change in i
The resulting plot was
I would really appreciate a hint helping me to find the bug.
I will now add a few lines of code. The plot command
plot for [i=1:words(europa_cet)] countries u ($1+($2<36?1:0)*15):(mercator($2)) index (word(europa_cet,i)+0) w filledcurve lc rgb colorFondoCET,\
for [i=1:words(paises_wet)] countries u ($1+15+dst*word(dst_wet,i)*15):(mercator($2)) index (word(paises_wet,i)+0) w filledcurve lc rgb colorFondoWET,\
for [i=1:words(southAm)] countries u ($1+(4+dst*word(dstSouthAm,i))*15):(mercator(abs($2))) index int(word(southAm,i)) w filledcurve lc rgb colorFondoGET,\
"magallanes.dat" u (new!=2?$1+dst*15:1/0):(mercator($2)) w filledcurve lc rgb colorFondoEET,\
"no_magallanes.dat" u (new!=2?$1:1/0):(mercator($2)) w filledcurve lc rgb colorFondoEET,\
for [k=1:5:1] mercator(orto(x,real(b1)+real(k)*real(15.0))) tit sprintf("orto a %02d signo %d",k,Signo) w l lc rgb 'blue' dt 2 lw 3,\
mercator(orto(x,b1+1*15)) tit sprintf("no loop orto a %02d signo %d",1,Signo) w l lc rgb 'blue' dt 2 lw 3,\
mercator(orto(x,b1+2*15)) tit sprintf("no loop orto a %02d signo %d",2,Signo) w l lc rgb 'blue' dt 2 lw 3,\
mercator(orto(x,b1+3*15)) tit sprintf("no loop orto a %02d signo %d",3,Signo) w l lc rgb 'blue' dt 2 lw 3,\
mercator(orto(x,b1+4*15)) tit sprintf("no loop orto a %02d signo %d",4,Signo) w l lc rgb 'blue' dt 2 lw 3,\
mercator(orto(x,b1+5*15)) tit sprintf("no loop orto a %02d signo %d",5,Signo) w l lc rgb 'blue' dt 2 lw 3,\
mercator(orto(x,b1+0*15)) tit sprintf("no loop orto a %02d signo %d",0,Signo) w l lc rgb 'blue' dt 2 lw 3,\
The for-loop (line #6) do not work. Line-by-line calls (lines 7-12) do work.
And the output obtained from set table, first lines of each iteration
# Curve 43 of 104, 100 points FIRST iteration
# Curve title: "orto a 01 signo 1"
# x y type
-22.5 0.874361° i
-21.9697 0.887919° i
-21.4394 0.901287° i
-20.9091 0.914467° i
# Curve 44 of 104, 100 points SECOND iter
# Curve title: "orto a 02 signo 1"
# x y type
-22.5 0.407722° i
-21.9697 0.426936° i
-21.4394 0.445968° i
-20.9091 0.464814° i
# Curve 45 of 104, 100 points THIRD iter (REPEATS 2nd)
# Curve title: "orto a 03 signo 1"
# x y type
-22.5 0.407722° i
-21.9697 0.426936° i
-21.4394 0.445968° i
-20.9091 0.464814° i
# Curve 46 of 104, 100 points FOURTH iter (repeats 2nd)
# Curve title: "orto a 04 signo 1"
# x y type
-22.5 0.407722° i
-21.9697 0.426936° i
-21.4394 0.445968° i
-20.9091 0.464814° i
# Curve 47 of 104, 100 points FIFTH iter (repeats 2nd)
# Curve title: "orto a 05 signo 1"
# x y type
-22.5 0.407722° i
-21.9697 0.426936° i
-21.4394 0.445968° i
-20.9091 0.464814° i
Now I have isolated the problem.
I am pasting again the plot (multi)line. The plot line is run two times one for the left (sunrise) subplot, the second for the right (sunset) subplot in a multiplot environment. They differ in the definition of the function orto and the value for b1.
plot "usa.dat" u (usaBool?($1+6*15):1/0):(mercator($2)) w filledcurve lc rgb colorFondoFET,\
for [i=1:words(europa_cet)] countries u ($1+($2<36?1:0)*15):(mercator($2)) index (word(europa_cet,i)+0) w filledcurve lc rgb colorFondoCET,\
for [i=1:words(paises_wet)] countries u ($1+15+dst*word(dst_wet,i)*15):(mercator($2)) index (word(paises_wet,i)+0) w filledcurve lc rgb colorFondoWET,\
for [i=1:words(southAm)] countries u ($1+(4+dst*word(dstSouthAm,i))*15):(mercator(abs($2))) index int(word(southAm,i)) w filledcurve lc rgb colorFondoGET,\
"magallanes.dat" u (new!=2?$1+dst*15:1/0):(mercator($2)) w filledcurve lc rgb colorFondoEET,\
"no_magallanes.dat" u (new!=2?$1:1/0):(mercator($2)) w filledcurve lc rgb colorFondoEET,\
mercator(orto(x,b1+1*15)) tit sprintf("no loop orto a %02d signo %d",1,Signo) w l lc rgb 'blue' dt 2 lw 3,\
mercator(orto(x,b1+2*15)) tit sprintf("no loop orto a %02d signo %d",2,Signo) w l lc rgb 'blue' dt 2 lw 3,\
mercator(orto(x,b1+3*15)) tit sprintf("no loop orto a %02d signo %d",3,Signo) w l lc rgb 'blue' dt 2 lw 3,\
mercator(orto(x,b1+4*15)) tit sprintf("no loop orto a %02d signo %d",4,Signo) w l lc rgb 'blue' dt 2 lw 3,\
mercator(orto(x,b1+5*15)) tit sprintf("no loop orto a %02d signo %d",5,Signo) w l lc rgb 'blue' dt 2 lw 3,\
mercator(orto(x,b1+0*15)) tit sprintf("no loop orto a %02d signo %d",0,Signo) w l lc rgb 'blue' dt 2 lw 3,\
for [i=1:words(europa_cet)] countries u ($1+($2<36?1:0)*15):(mercator($2)) index (word(europa_cet,i)+0) w l lt 1 lc rgb colorLinea,\
for [i=1:words(paises_wet)] countries u ($1+15*(1+dst*word(dst_wet,i))):(mercator($2)) index (word(paises_wet,i)+0) w l lt 1 lc rgb colorLinea,\
for [i=1:words(southAm)] countries u ($1+(4+dst*word(dstSouthAm,i))*15):(mercator(abs($2))) index int(word(southAm,i)) w l lt 1 lc rgb colorLinea,\
"magallanes.dat" u (new!=2?$1+dst*15:1/0):(mercator($2)) w l lt 1 lc rgb colorLinea,\
"no_magallanes.dat" u (new!=2?$1:1/0):(mercator($2)) w l lt 1 lc rgb colorLinea,\
"usa.dat" u (usaBool?($1+6*15):1/0):(mercator($2)) w l lt 1 lc rgb 'gray50',\
for [i=0:2] "ciudadesChile.dat" u ($2-($6-1+((new==0&i==2)?-1:((new==2&i==1)?1:0))-dst*word(dstSouthAm,i+1))*15):(mercator(abs($1))) index i w p pt 7 lc 1 ps 1.5,\
"ciudadesUsa.dat" u (usaBool?($2+6*15):1/0):(mercator(abs($1))) w p pt 7 lc rgb 'blue' ps 1.5,\
for [k=1:5:1] mercator(orto(x,real(b1)+real(k)*real(15.0))) tit sprintf("orto a %02d signo %d",k,Signo) w l lc rgb 'green' dt 2 lw 10,\
for [i=0:2] "ciudadesChile.dat" u ($2-($6-1+((new==0&i==2)?-1:((new==2&i==1)?1:0))-dst*real(word(dstSouthAm,i+1)+0))*15-$4*.5):(mercator(abs($1+$5*1.1))):(stringcolumn($3)) index i w labels font "Arial-Bold,10" tc rgb word(corporativa,1),\
"ciudadesUsa.dat" u (usaBool?($2+6*15-$4*.5):1/0):(mercator(abs($1+$5*1.1))):3 w labels font "Arial-Bold,10" tc rgb 'blue',\
for [i=1:words(Coastlines)] coastline u 1:(mercator($2)) index (word(Coastlines,i)+0) w l lt 1 lc rgb 'gray50',\
Problem is with the 3rd line from bottom, the one starting with for [i=0:2].
If this line is removed; the loop for [k=1:5:1] operates ok.
If for [k=1:5:1] is placed after 3rd line from bottom, the script operates ok.
If for [k=1:5:1] is placed before 3rd line from bottom, the loop does not operate fine.
The for [i=0:2] prints names of Chilean and Argentinean cities. Column $1 is latitude, $2 is longitude. They are displaced from center throu $4 and $5. The variable i through index controls the country: Argentina=0 Chile=1 RegionMagallanes (Chile)=2. The variable new controls time zone in Chile new=0 is prior to 2015; new=1 is current status, new=2 refers to 2015. Column $6refers to a reference time zone (-3 Argentina and Magallanes, -4 Chile).
The script also controls winter (dst=0) or summer (dst=1) condition.
I have tried and remove pieces (monomials) of the for [i=0:2] line one by one. No success. Even I edited the ciudadesChile.dat file and changed a tab separating $1 and $2 to a space. No success.

The distance of two point which SDO_CLOSEST_POINTS returns is not the same as dist itself returns

When i query distance between two Geometries like this:
DECLARE
dist NUMBER;
geoma SDO_GEOMETRY;
geomb SDO_GEOMETRY;
BEGIN
SDO_GEOM.SDO_CLOSEST_POINTS(sdo_geometry('POINT(10 10)', 4326),
sdo_geometry('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))',
4326),
0.005,
NULL,
dist,
geoma,
geomb);
insert into test (info, geom1, geom2) values (dist, geoma, geomb);
END;
It returns like this:
info:1254057.74485897
geom1: 10,10
geom2: 2,2
But when i query the distance between the two points:
SELECT sdo_geom.sdo_distance(sdo_geom.sdo_geometry('POINT(10 10)', 4326),
sdo_geom.sdo_geometry('POINT(2 2)',
4326),
0.0001,
'unit=M') distance_in_m
from DUAL;
It returns :1251344.03770147
Why the distances are not the same?How it happen?
Thanks for anyone who will give me some idea.
Following the SDO_GEOMETRY documentation gives a different way of specifying shapes. Using this, the values are the same:
DECLARE
d1 NUMBER;
d2 NUMBER;
d3 NUMBER;
g1 SDO_GEOMETRY := SDO_GEOMETRY(
2003, -- 2 dimensional polygon,
NULL, -- No SRID / Co-ordinate System
NULL, -- SDO_POINT,
SDO_ELEM_INFO_ARRAY( 1, 1003, 3 ), -- Rectangle exterior
SDO_ORDINATE_ARRAY( 0,0, 2,2 ) -- Corners
);
g2 SDO_GEOMETRY := SDO_GEOMETRY(
2001, -- 2 dimensional point,
NULL, -- No SRID / Co-ordinate System
SDO_POINT_TYPE(10,10,NULL), -- SDO_POINT,
NULL, -- Not an array
NULL -- Not an array
);
g3 SDO_GEOMETRY := SDO_GEOMETRY(
2001, -- 2 dimensional point,
NULL, -- No SRID / Co-ordinate System
SDO_POINT_TYPE(2,2,NULL), -- SDO_POINT,
NULL, -- Not an array
NULL -- Not an array
);
ga SDO_GEOMETRY;
gb SDO_GEOMETRY
BEGIN
SDO_GEOM.SDO_CLOSEST_POINTS(
geom1 => g1,
geom2 => g2,
tolerance => 0.005,
unit => NULL,
dist => d1,
geoma => ga,
geomb => gb
);
d2 := SDO_GEOM.SDO_DISTANCE( g2, g3, 0.0001, NULL );
d3 := SDO_GEOM.SDO_DISTANCE( g1, g3, 0.0001, NULL );
DBMS_OUTPUT.PUT_LINE( d1 || ', ' || d2 || ', ' || d3 );
END;
/
Outputs:
11.3137084989848, 11.3137084989848, 11.3137084989848
As an added bonus, the distance is now SQRT(8*8 + 8*8) which is the Cartesian distance from (2,2) to (10,10) and you can also use SDO_DISTANCE with either the polygon or the point for the same answer.

What does the "16" refer to in "16-bit Bilevel Gray" and "Depth: 16/1-bit"

ImageMagick's identify command line tool provides information on sampled images contained in image files. I'm trying to understand what the "16" means in the context of what it reports back.
I'm pretty sure this is a monochrome image with just one bit of content and one transparency bit per pixel, so I don't understand the role the "16" plays here. Is it that the 1 represents a grey level "value" of 65535 (i.e. all white, in this case)? Or does this have something to do with the 1-bit of content channel and 1-bit of alpha/transparency channel being packed into a 16-bit word?
In non-verbose mode, it reports:
20140123124823096.pdf PDF 1008x612 1008x612+0+0 **16-bit Bilevel Gray** 77.2KB 0.000u 0:00.000
In verbose mode, it reports the following:
Image: 20140123124823096.pdf
Format: PDF (Portable Document Format)
Mime type: application/pdf
Class: DirectClass
Geometry: 1008x612+0+0
Resolution: 72x72
Print size: 14x8.5
Units: Undefined
Type: Bilevel
Base type: Bilevel
Endianess: Undefined
Colorspace: Gray
Depth: 16/1-bit
Channel depth:
gray: 1-bit
alpha: 1-bit
Channel statistics:
Gray:
min: 0 (0)
max: 65535 (1)
mean: 60686.5 (0.926017)
standard deviation: 17153.4 (0.261744)
kurtosis: 8.59646
skewness: -3.25522
Alpha:
min: 65535 (1)
max: 65535 (1)
mean: 65535 (1)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
Colors: 2
Histogram:
45640: ( 0, 0, 0,65535) #000000000000 graya(0,1)
571256: (65535,65535,65535,65535) #FFFFFFFFFFFF graya(255,1)
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Background color: graya(255,1)
Border color: graya(223,1)
Matte color: graya(189,1)
Transparent color: graya(0,0)
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 1008x612+0+0
Dispose: Undefined
Iterations: 0
Compression: Undefined
Orientation: Undefined
Properties:
date:create: 2014-01-23T12:41:20-08:00
date:modify: 2014-01-23T12:41:20-08:00
pdf:HiResBoundingBox: 1008x612+0+0
pdf:Version: PDF-1.4
signature: 94e55396cd1b4dea139dcb39458ada0c904d80810722d7c03a62691d710755ab
Artifacts:
filename: 20140123124823096.pdf
verbose: true
Tainted: True
Filesize: 53.1KB
Number pixels: 617K
Pixels per second: 15.42MB
User time: 0.040u
Elapsed time: 0:01.039
Version: ImageMagick 6.8.7-3 2013-11-20 Q16 http://www.imagemagick.org
Update: It turns out that the information that ImageMagick's tool is reporting is not actually the information about the image in the PDF file, but apparently the information about the image after it's gone through some kind of internal transformation! I looked at the PDF file in a text editor and can see that it's unambiguously a 1-bit-per-pixel monochrome image at 200 dpi (legal size), rather than the 72 dpi image with an alpha channel that ImageMagick was reporting. All that said, I'm still curious as to what the 16 means even in ImageMagick's artificial world.
Here's a description of the image as it actually exists in the PDF:
<</Type/XObject
/Subtype/Image
/Width 2800
/Height 1700
/BitsPerComponent 1
/ColorSpace/DeviceGray
/Filter /CCITTFaxDecode
/DecodeParms <</Columns 2800 /Rows 1700>>
/Length 142719
>>

Resources