eyes-on-exoplanets

Poker beta test

GIANTMONSTER gif

Monte Carlo link h
https://www.ibm.com/topics/monte-carlo-simulation

Shiny object AI, lightweight Python 
Smartphone to contact lens
Poker match
Eyeglasses, sunglasses, eyeball reflection utilized zoom
https://www.contactlensjournal.com/article/S1367-0484(21)00021-7/abstract

Video m, n
Casino Royale (2006) - Final Poker Scene

DR. NO | "Bond, James Bond" – Sean Connery, Eunice Gayson | James Bond


Las Vegas casino test
SLAM for multiple extended targets using 6G, WIFI, & satellite signal
saline power system

example for ORCa:

slim Python embedded on lens microprocessor example:
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Computing Virtual Cones for case of sphere "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Objective\n",
    "Given spherical surface , set of camera rays and camera points, find virtual cones for each camera ray in parallel.\n",
    "\n",
    "Starting with including required packaged and adding some helper functions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib widget\n",
    "import torch\n",
    "from torch import autograd\n",
    "from functools import partial\n",
    "from mpl_toolkits.mplot3d import Axes3D\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import sys\n",
    "sys.path.append('.')\n",
    "from utils.viz_util import (plot3d_arrow, plot3d_sphere, \n",
    "                            plot3d_point, plot3d_cone)\n",
    "\n",
    "dot = lambda x,y: (x*y).sum(-1, keepdim=True)\n",
    "norm = lambda x: torch.sqrt((x**2).sum(-1, keepdim=True))\n",
    "transp = lambda x: x.transpose(-2,-1)\n",
    "normalize = lambda x: x/(1e-7+norm(x))\n",
    "to_np = lambda x: x[0,0].detach().cpu().numpy()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Given quantities\n",
    "\n",
    "$N$: Number of primary rays\n",
    "\n",
    "$P$: Number of intersection points per primary ray\n",
    "\n",
    "$\\mathbf{o}$: Primary ray origin ($N \\times P \\times 3$)\n",
    "\n",
    "$\\mathbf{d}$: Primary ray direction ($N\\times P \\times 3$)\n",
    "\n",
    "$t$: Distance along ray for intersection points($N\\times P \\times 1$) \n",
    "\n",
    "$r$: Radius of primary cone ($N \\times P \\times 3$)\n",
    "\n",
    "$\\mathbf{n}$: Surface normals at intersection normals ($N \\times P \\times 3$) \n",
    "\n",
    "$R$: Radius of curvature at the surface ($N \\times P \\times 3$)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Defining one primary ray,then repeating it to $N\\times P$ values to test out the performance of this module in ORCa. Overall code should work with $N$ different primary rays"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "N = 128\n",
    "P = 192\n",
    "\n",
    "expand_NP = lambda x: x[None,None].expand(N,P,-1)\n",
    "\n",
    "# Example visualization\n",
    "o = expand_NP(torch.cuda.FloatTensor([3.,0.,0.])) # (N,P,3)\n",
    "d = expand_NP(normalize(torch.cuda.FloatTensor([-1,0.2,0]))) # (N,P,3)\n",
    "r = expand_NP(torch.cuda.FloatTensor([0.05])) # (N,P,1)\n",
    "up = expand_NP(torch.cuda.FloatTensor([0.,1.,0]))# Up vector of camera Useful for cone rays"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here we obtain $t$ value from ray sphere intersection. But in ORCa pipeline, SDFNet would give us t values. Here consider center $c$ and radius of sphere $R$ are known. In ORCa, center won't be needed and radius can be computed from SDF."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "def intersect_ray_sphere(o, d, c, R):\n",
    "    # Sphere given by <x-c,x-c>=R**2\n",
    "    # Ray given by x = o+td\n",
    "    # Point of intersection t follows:\n",
    "    # a2t^2 + a1t + a0 with following values\n",
    "    a2 = 1.\n",
    "    a1 = 2*dot(d, o-c)\n",
    "    a0 = norm(o-c)**2 - R**2\n",
    "    # Using quadratic formula finding the smaller of the two roots\n",
    "    t_int = (-a1 - torch.sqrt(a1**2 - 4*a2*a0))/(2*a2)\n",
    "\n",
    "    return o+t_int*d\n",
    "\n",
    "\n",
    "R = expand_NP(torch.cuda.FloatTensor([1.])) # (N,P,1)\n",
    "c = expand_NP(torch.cuda.FloatTensor([0., 0., 0.])) # (N,P,3)\n",
    "\n",
    "p = intersect_ray_sphere(o,d,c,R)\n",
    "# t is distance along ray\n",
    "t = norm(p-o) # (N,P,1)\n",
    "# surface normal points outwards from center\n",
    "n = normalize(p-c) # (N, P, 3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here we visualize the known quantities. As all the $N \\times P$ values are the same we just visualize the first one. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "f3cec8a9cf19491182a91b364c9cf959",
       "version_major": 2,
       "version_minor": 0
      },
      "image/png": 
MIT License Copyright (c) 2023 Kushagra Tiwary


Project G
Alpha 008

No comments:

Post a Comment