RayTracer.jl a differentiable ray tracer

What with the publication in JuliaCon, I can’t help wondering if this thing can be used to calibrate actual cameras. In my field we record animal behavior in the field or in the lab using a video camera. To convert the pixel coordinates of the trajectory or location of the animal to real-world coordinates (i.e. in cm), we first calibrate the camera with a checkerboard (see here for instance). This is a bit of an involved process that I’d love to improve. I’m wondering if this can some how improve on that…

1 Like

I don’t think there is much literature that explores this particular idea. However, I gave a talk on this topic at JuliaCon. The video is here.

3 Likes

Thanks I saw the talk and I am sold on the idea, great work :slight_smile:

1 Like

Updating this thread. A paper on an Non Line Of Sight camerasystem was presented at SIGGRAPH

https://sciencenode.org/feature/Seeing%20around%20corners.php

Github with Matlab code here: GitHub - computational-imaging/nlos-fk: Processing code for "Wave-Based Non-Line-of-Sight Imaging using Fast f-k Migration"

1 Like

@avikpal started: Calibrating Camera Parameters - Nextjournal

This is awesome!!! Hope this matures to a camera calibrating toolbox!!!

4 Likes

@johnh I actually recently posted a Julia project regarding the nlos-fk paper/code you linked to.

https://github.com/analytech-solutions/fkMigration.jl

1 Like

Hi there,
This is a really interesting project, I am new to Julia but I wanted to give it ago hence I have installed everything yesterday, however when I try to run one of the examples I get the following errors:

~/projects/raytracer.jil/examples$ julia --project=. --color=yes teapot_rendering.jl 
┌ Warning: Package MacroTools does not have Markdown in its dependencies:
│ - If you have MacroTools checked out for development and have
│   added Markdown as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with MacroTools
└ Loading Markdown into MacroTools from project dependency, future warnings for MacroTools are suppressed.
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for ZygoteRules [700de1a5-db45-46bc-99cf-38207098b444]
│   exception = Required dependency MacroTools [1914dd2f-81c6-5fcd-8719-6d5c9610ff09] failed to load from a cache file.
└ @ Base loading.jl:1041
┌ Warning: Package MacroTools does not have Markdown in its dependencies:
│ - If you have MacroTools checked out for development and have
│   added Markdown as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with MacroTools
└ Loading Markdown into MacroTools from project dependency, future warnings for MacroTools are suppressed.
┌ Warning: Package Requires does not have UUIDs in its dependencies:
│ - If you have Requires checked out for development and have
│   added UUIDs as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with Requires
└ Loading UUIDs into Requires from project dependency, future warnings for Requires are suppressed.
ERROR: LoadError: ArgumentError: Package SpecialFunctions does not have OpenSpecFun_jll in its dependencies:
- If you have SpecialFunctions checked out for development and have
  added OpenSpecFun_jll as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with SpecialFunctions
Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:905
 [2] include(::Module, ::String) at ./Base.jl:377
 [3] top-level scope at none:2
 [4] eval at ./boot.jl:331 [inlined]
 [5] eval(::Expr) at ./client.jl:449
 [6] top-level scope at ./none:3
in expression starting at /Users/rbonfiglioli/.julia/packages/SpecialFunctions/5QYEE/src/SpecialFunctions.jl:3
ERROR: LoadError: LoadError: Failed to precompile SpecialFunctions [276daf66-3868-5448-9aa4-cd146d93841b] to /Users/rbonfiglioli/.julia/compiled/v1.4/SpecialFunctions/78gOt_IFofr.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
 [3] _require(::Base.PkgId) at ./loading.jl:1029
 [4] require(::Base.PkgId) at ./loading.jl:927
 [5] require(::Module, ::Symbol) at ./loading.jl:922
 [6] include(::Module, ::String) at ./Base.jl:377
 [7] include(::String) at /Users/rbonfiglioli/.julia/packages/Zygote/iOhwI/src/Zygote.jl:1
 [8] top-level scope at /Users/rbonfiglioli/.julia/packages/Zygote/iOhwI/src/Zygote.jl:24
 [9] include(::Module, ::String) at ./Base.jl:377
 [10] top-level scope at none:2
 [11] eval at ./boot.jl:331 [inlined]
 [12] eval(::Expr) at ./client.jl:449
 [13] top-level scope at ./none:3
in expression starting at /Users/rbonfiglioli/.julia/packages/Zygote/iOhwI/src/lib/number.jl:1
in expression starting at /Users/rbonfiglioli/.julia/packages/Zygote/iOhwI/src/Zygote.jl:24
ERROR: LoadError: Failed to precompile Zygote [e88e6eb3-aa80-5325-afca-941959d7151f] to /Users/rbonfiglioli/.julia/compiled/v1.4/Zygote/4kbLI_IFofr.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
 [3] _require(::Base.PkgId) at ./loading.jl:1029
 [4] require(::Base.PkgId) at ./loading.jl:927
 [5] require(::Module, ::Symbol) at ./loading.jl:922
 [6] include(::Module, ::String) at ./Base.jl:377
 [7] top-level scope at none:2
 [8] eval at ./boot.jl:331 [inlined]
 [9] eval(::Expr) at ./client.jl:449
 [10] top-level scope at ./none:3
in expression starting at /Users/rbonfiglioli/.julia/packages/RayTracer/VcDKP/src/RayTracer.jl:3
ERROR: LoadError: Failed to precompile RayTracer [60dacb86-48ff-11e9-0f01-03ab8794bbc9] to /Users/rbonfiglioli/.julia/compiled/v1.4/RayTracer/sUryZ_IFofr.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
 [3] _require(::Base.PkgId) at ./loading.jl:1029
 [4] require(::Base.PkgId) at ./loading.jl:927
 [5] require(::Module, ::Symbol) at ./loading.jl:922
 [6] include(::Module, ::String) at ./Base.jl:377
 [7] exec_options(::Base.JLOptions) at ./client.jl:288
 [8] _start() at ./client.jl:484
in expression starting at /Users/rbonfiglioli/projects/raytracer.jil/examples/teapot_rendering.jl:11

Mayve @avikpal himself has a hint? I am on OSX Mojave and installed Julia 1.4

Hi @winterismute, this issue has been fixed on master, and will be soon reflected on the tagged version.

I’m seeing this error when I try to run:

$ julia --project=. --color=yes teapot_rendering.jl
┌ Warning: Package Colors does not have Printf in its dependencies:
│ - If you have Colors checked out for development and have
│ added Printf as a dependency but haven’t updated your primary
│ environment’s manifest file, try Pkg.resolve().
│ - Otherwise you may need to report an issue with Colors
└ Loading Printf into Colors from project dependency, future warnings for Colors are suppressed.
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for Flux [587475ba-b771-5e3f-ad9e-33799f191a9c]
│ exception = Required dependency Colors [5ae59095-9a9b-59fe-a467-6f913c188581] failed to load from a cache file.
└ @ Base loading.jl:1041
┌ Warning: Package Colors does not have Printf in its dependencies:
│ - If you have Colors checked out for development and have
│ added Printf as a dependency but haven’t updated your primary
│ environment’s manifest file, try Pkg.resolve().
│ - Otherwise you may need to report an issue with Colors
└ Loading Printf into Colors from project dependency, future warnings for Colors are suppressed.
WARNING: ImageQualityIndexes.psnr is deprecated, use assess_psnr instead.
likely near /home/phil/.julia/packages/Images/0SDGT/src/Images.jl:60
┌ Warning: Package RayTracer does not have CUDAnative in its dependencies:
│ - If you have RayTracer checked out for development and have
│ added CUDAnative as a dependency but haven’t updated your primary
│ environment’s manifest file, try Pkg.resolve().
│ - Otherwise you may need to report an issue with RayTracer
└ Loading CUDAnative into RayTracer from project dependency, future warnings for RayTracer are suppressed.
ERROR: LoadError: LoadError: LoadError: UndefVarError: @nograd not defined
Stacktrace:
[1] top-level scope
[2] include(::Module, ::String) at ./Base.jl:377
[3] include(::String) at /home/phil/.julia/packages/RayTracer/rEd4h/src/RayTracer.jl:1
[4] top-level scope at /home/phil/.julia/packages/RayTracer/rEd4h/src/RayTracer.jl:24
[5] include(::Module, ::String) at ./Base.jl:377
[6] top-level scope at none:2
[7] eval at ./boot.jl:331 [inlined]
[8] eval(::Expr) at ./client.jl:449
[9] top-level scope at ./none:3