bondscell_results$1feb465a-e51e-11ea-3bca-8b7634072120queued¤logsrunning¦outputbody
Enable webcam
mimetext/htmlrootassigneelast_run_timestampA!persist_js_state·has_pluto_hook_features§cell_id$1feb465a-e51e-11ea-3bca-8b7634072120depends_on_disabled_cells§runtimeGApublished_object_keysdepends_on_skipped_cells§errored$762e167e-e51d-11ea-0721-e566ca397423queued¤logsrunning¦outputbody-camera_input (generic function with 1 method)mimetext/plainrootassigneelast_run_timestampAvGpersist_js_state·has_pluto_hook_features§cell_id$762e167e-e51d-11ea-0721-e566ca397423depends_on_disabled_cells§runtime}$b395e806-e51e-11ea-12f1-7f05ee45cbbdprecedence_heuristic cell_id$b395e806-e51e-11ea-12f1-7f05ee45cbbddownstream_cells_mapprocess_raw_camera_dataupstream_cells_mapUInt8:RGBreshape/adjointconjend$60d58bd8-e51e-11ea-328c-29f3c0d3d6bbprecedence_heuristic cell_id$60d58bd8-e51e-11ea-328c-29f3c0d3d6bbdownstream_cells_mapupstream_cells_mapi$1feb465a-e51e-11ea-3bca-8b7634072120cell_execution_order$762e167e-e51d-11ea-0721-e566ca397423$1feb465a-e51e-11ea-3bca-8b7634072120$60d58bd8-e51e-11ea-328c-29f3c0d3d6bb$b395e806-e51e-11ea-12f1-7f05ee45cbbdlast_hot_reload_timeshortpathcamera_old.jlprocess_statusreadypathC/home/runner/work/disorganised-mess/disorganised-mess/camera_old.jlpluto_versionv0.19.47last_save_timeAժcell_order$60d58bd8-e51e-11ea-328c-29f3c0d3d6bb$1feb465a-e51e-11ea-3bca-8b7634072120$762e167e-e51d-11ea-0721-e566ca397423$b395e806-e51e-11ea-12f1-7f05ee45cbbdpublished_objectsnbpkginstall_time_nsΨsLinstantiatedòinstalled_versionsterminal_outputsnbpkg_sync Instantiating... ===  No Changes to `/tmp/jl_Pz4b9D/Project.toml`  No Changes to `/tmp/jl_Pz4b9D/Manifest.toml` Resolving... ===  No Changes to `/tmp/jl_Pz4b9D/Project.toml`  No Changes to `/tmp/jl_Pz4b9D/Manifest.toml` Precompiling... ===  Activating new project at `/tmp/jl_Pz4b9D`enabled÷restart_recommended_msgrestart_required_msgbusy_packageswaiting_for_permission,waiting_for_permission_but_probably_disabled«cell_inputs$1feb465a-e51e-11ea-3bca-8b7634072120cell_id$1feb465a-e51e-11ea-3bca-8b7634072120code@bind i camera_input()metadatashow_logsèdisabled®skip_as_script«code_folded$762e167e-e51d-11ea-0721-e566ca397423cell_id$762e167e-e51d-11ea-0721-e566ca397423code>function camera_input(;maxsize=200, default_url="https://i.imgur.com/VGPeJ6s.jpg") """
Enable webcam
""" |> HTML endmetadatashow_logsèdisabled®skip_as_script«code_folded$b395e806-e51e-11ea-12f1-7f05ee45cbbdcell_id$b395e806-e51e-11ea-12f1-7f05ee45cbbdcodefunction process_raw_camera_data(raw_camera_data) # the raw image data is a long byte array, we need to transform it into something # more "Julian" - something with more _structure_. # The encoding of the raw byte stream is: # every 4 bytes is a single pixel # every pixel has 4 values: Red, Green, Blue, Alpha # (we ignore alpha for this notebook) # So to get the red values for each pixel, we take every 4th value, starting at # the 1st: reds_flat = UInt8.(raw_camera_data["data"][1:4:end]) greens_flat = UInt8.(raw_camera_data["data"][2:4:end]) blues_flat = UInt8.(raw_camera_data["data"][3:4:end]) # but these are still 1-dimensional arrays, nicknamed 'flat' arrays # We will 'reshape' this into 2D arrays: width = raw_camera_data["width"] height = raw_camera_data["height"] # shuffle and flip to get it in the right shape reds = reshape(reds_flat, (width, height))' / 255.0 greens = reshape(greens_flat, (width, height))' / 255.0 blues = reshape(blues_flat, (width, height))' / 255.0 # we have our 2D array for each color # Let's create a single 2D array, where each value contains the R, G and B value of # that pixel RGB.(reds, greens, blues) endmetadatashow_logsèdisabled®skip_as_script«code_folded$60d58bd8-e51e-11ea-328c-29f3c0d3d6bbcell_id$60d58bd8-e51e-11ea-328c-29f3c0d3d6bbcodeimetadatashow_logsèdisabled®skip_as_script«code_folded«notebook_id$1ab5ee0a-4aaa-11f0-3cbe-11f5d87ab455in_temp_dir¨metadata