Giter VIP home page Giter VIP logo

Comments (6)

fhunleth avatar fhunleth commented on August 26, 2024

I tried the camera once and it worked, but that was a really long time ago. I've been pulling upstream changes in this area and it's entirely possible that one of them broke Picam.

Do you have any clues? Or it's like it doesn't work and doesn't give any messages?

from nerves_system_rpi4.

osterwood avatar osterwood commented on August 26, 2024

Thanks for the reply! The error from Picam is

iex(1)> Picam.Camera.start_link            
{:error, {:already_started, #PID<0.1630.0>}}
iex(2)> File.write!(Path.join(System.tmp_dir!, "frame.jpg"), Picam.next_frame)
** (exit) exited in: GenServer.call(Picam.FakeCamera, :next_frame, 5000)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
    (elixir 1.10.4) lib/gen_server.ex:1013: GenServer.call/3

already_started happens on the 3 and 4 due to the software I've loaded. I intentionally don't have a FakeCamera enabled. If I enable one, I get fake output.

Looking at dmesg output doesn't have any obvious errors, both the PI 3 and PI 4 have this:

bcm2835-v4l2: V4L2 device registered as video0 - stills mode > 1280x720
bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded.

and there is a /dev/video0 device on both systems (along with video10, video11, video12 on the PI 4).

Any ideas on how to dive deeper into this?

from nerves_system_rpi4.

osterwood avatar osterwood commented on August 26, 2024

Interestingly, if I stop the nerves software, I am able to run raspistill and save a JPG on the PI 4

iex> Application.stop(:camera)
iex> Application.stop(:picam) 
iex> System.cmd("/usr/bin/raspistill", ["-v", "-o", "/tmp/image.jpg"], stderr_to_stdout: true)

Output is

{"\"raspistill\" Camera App (commit 42df6e3e571c)
Camera Name ov5647
Width 2592, Height 1944, filename /tmp/image.jpg
Using camera 0, sensor mode 0
GPS output Disabled
Quality 85, Raw no
Thumbnail enabled Yes, width 64, height 48, quality 35
Time delay 5000, Timelapse 0
Link to latest frame enabled  no
Full resolution preview No
Capture method : Single capture
Preview Yes, Full screen Yes
Preview window 0,0,1024,768
Opacity 255
Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Flicker Avoid Mode 'off'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
Camera component done
Encoder component done
Starting component connection stage
Connecting camera preview port to video render.
Connecting camera stills port to encoder input port
Opening output file /tmp/image.jpg
Enabling encoder output port
Starting capture -1
Finished capture -1
Closing down
Close down completed, all components disconnected, disabled and destroyed",
 0}

from nerves_system_rpi4.

fhunleth avatar fhunleth commented on August 26, 2024

Could you rm -fr _build and try again?

Code that does this, https://github.com/elixir-vision/picam/blob/master/lib/picam.ex#L7, is notorious for causing confusion. It sets the choice of using FakeCamera at compile time and Elixir doesn't know to recompile it when you change your config.exs. The Picam code needs to be fixed so that Application.get_env(:picam, :camera, Picam.Camera) is called at runtime.

We should fix this, but first I want to make sure that what I'm telling you is the root cause. If you run into any issues, feel free to ping me on the Elixir Lang slack and we can figure out a time to do joint debug and knock this off and get a PR over to picam so it never happens again.

from nerves_system_rpi4.

osterwood avatar osterwood commented on August 26, 2024

Deleting _build and rebuilding worked! All is well on the PI 4.

Thanks for the help in diagnosing this issue.

from nerves_system_rpi4.

fhunleth avatar fhunleth commented on August 26, 2024

Great! Thanks for following up.

from nerves_system_rpi4.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.