In Javascript this is bound in unexpected ways. Functions, in particular, create a new 'this' and so when you want to keep a reference to an "outer" object you sometimes see the pattern:
var self = this;
as in:
var self = this;| class Calibration: | |
| """Calibration matrices and utils. | |
| 3d XYZ are in 3D egovehicle coord. | |
| 2d box xy are in image coord, normalized by width and height | |
| Point cloud are in egovehicle coord | |
| :: | |
| xy_image = K * [R|T] * xyz_ego |
| # install_certifi.py | |
| # | |
| # sample script to install or update a set of default Root Certificates | |
| # for the ssl module. Uses the certificates provided by the certifi package: | |
| # https://pypi.python.org/pypi/certifi | |
| import os | |
| import os.path | |
| import ssl | |
| import stat |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Polygon Collision</title> | |
| <link rel="stylesheet" href="style.css" /> | |
| <script src="index.js"></script> | |
| </head> |
| #include <string.h> | |
| #include <gst/gst.h> | |
| #include <signal.h> | |
| #include <unistd.h> | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| // v4l2src ! tee name=t t. ! x264enc ! mp4mux ! filesink location=/home/rish/Desktop/okay.264 t. ! videoconvert ! autovideosink | |
| static GMainLoop *loop; |
| // This event emitter emits events, but reserves the right to publish events to | |
| // for its creator. It uses a WeakMap for true encapsulation. | |
| const eesToEventMaps = new WeakMap(); | |
| export default class EventEmitter { | |
| constructor(publisher) { | |
| const eventMap = Object.create(null); | |
| eesToEventMaps.set(this, eventMap); |
| var flattenObject = function(ob) { | |
| var toReturn = {}; | |
| for (var i in ob) { | |
| if (!ob.hasOwnProperty(i)) continue; | |
| if ((typeof ob[i]) == 'object') { | |
| var flatObject = flattenObject(ob[i]); | |
| for (var x in flatObject) { | |
| if (!flatObject.hasOwnProperty(x)) continue; |