Git Product home page Git Product logo

Comments (26)

htruong avatar htruong commented on May 29, 2024

You can access the camera root prompt:

https://hackaday.io/project/174479-raspberry-pi-0-hq-usb-webcam/log/182789-how-to-tweak-your-camera-settings

After logginfg in with root, you can type something like this:

/usr/bin/v4l2-ctl -c auto_exposure_bias=15
/usr/bin/v4l2-ctl -c contrast=0

That should be enough to improve the brightness. To see all the tweakable parameters, you can list it

/usr/bin/v4l2-ctl -L | less

Please report back what values worked for you!

from showmewebcam.

PSF1 avatar PSF1 commented on May 29, 2024

Thanks, I will try and then comment :)

from showmewebcam.

PSF1 avatar PSF1 commented on May 29, 2024

I get this quality, I think that it's not the best one, but I don't know anything about photography. :_ D

imagen

When I try to set "Codec Controls" I cant with:

# /usr/bin/v4l2-ctl -c h264_level=0
VIDIOC_S_EXT_CTRLS: failed: No such process
h264_level: No such process

Is it possible, or necessary, to modify those values?

This is my settings:

User Controls

                     brightness 0x00980900 (int)    : min=0 max=100 step=1 default=50 value=50 flags=slider
                       contrast 0x00980901 (int)    : min=-100 max=100 step=1 default=0 value=50 flags=slider
                     saturation 0x00980902 (int)    : min=-100 max=100 step=1 default=0 value=-40 flags=slider
                    red_balance 0x0098090e (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                   blue_balance 0x0098090f (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                horizontal_flip 0x00980914 (bool)   : default=0 value=0
                  vertical_flip 0x00980915 (bool)   : default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=3 default=1 value=3
                                0: Disabled
                                1: 50 Hz
                                2: 60 Hz
                                3: Auto
                      sharpness 0x0098091b (int)    : min=-100 max=100 step=1 default=0 value=100 flags=slider
                  color_effects 0x0098091f (menu)   : min=0 max=15 default=0 value=0
                                0: None
                                1: Black & White
                                2: Sepia
                                3: Negative
                                4: Emboss
                                5: Sketch
                                6: Sky Blue
                                7: Grass Green
                                8: Skin Whiten
                                9: Vivid
                                10: Aqua
                                11: Art Freeze
                                12: Silhouette
                                13: Solarization
                                14: Antique
                                15: Set Cb/Cr
                         rotate 0x00980922 (int)    : min=0 max=360 step=90 default=0 value=0 flags=modify-layout
             color_effects_cbcr 0x0098092a (int)    : min=0 max=65535 step=1 default=32896 value=32896

Codec Controls

             video_bitrate_mode 0x009909ce (menu)   : min=0 max=1 default=0 value=0 flags=update
                                0: Variable Bitrate
                                1: Constant Bitrate
                  video_bitrate 0x009909cf (int)    : min=25000 max=25000000 step=25000 default=10000000 value=25000000
         repeat_sequence_header 0x009909e2 (bool)   : default=0 value=0
            h264_i_frame_period 0x00990a66 (int)    : min=0 max=2147483647 step=1 default=60 value=60
                     h264_level 0x00990a67 (menu)   : min=0 max=11 default=11 value=11
                                0: 1
                                1: 1b
                                2: 1.1
                                3: 1.2
                                4: 1.3
                                5: 2
                                6: 2.1
                                7: 2.2
                                8: 3
                                9: 3.1
                                10: 3.2
                                11: 4
                   h264_profile 0x00990a6b (menu)   : min=0 max=4 default=4 value=4
                                0: Baseline
                                1: Constrained Baseline
                                2: Main
                                4: High

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=0 value=0
                                0: Auto Mode
                                1: Manual Mode
         exposure_time_absolute 0x009a0902 (int)    : min=1 max=10000 step=1 default=1000 value=1000
     exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=1
             auto_exposure_bias 0x009a0913 (intmenu): min=0 max=24 default=12 value=15
                                0: -4000 (0xfffffffffffff060)
                                1: -3667 (0xfffffffffffff1ad)
                                2: -3333 (0xfffffffffffff2fb)
                                3: -3000 (0xfffffffffffff448)
                                4: -2667 (0xfffffffffffff595)
                                5: -2333 (0xfffffffffffff6e3)
                                6: -2000 (0xfffffffffffff830)
                                7: -1667 (0xfffffffffffff97d)
                                8: -1333 (0xfffffffffffffacb)
                                9: -1000 (0xfffffffffffffc18)
                                10: -667 (0xfffffffffffffd65)
                                11: -333 (0xfffffffffffffeb3)
                                12: 0 (0x0)
                                13: 333 (0x14d)
                                14: 667 (0x29b)
                                15: 1000 (0x3e8)
                                16: 1333 (0x535)
                                17: 1667 (0x683)
                                18: 2000 (0x7d0)
                                19: 2333 (0x91d)
                                20: 2667 (0xa6b)
                                21: 3000 (0xbb8)
                                22: 3333 (0xd05)
                                23: 3667 (0xe53)
                                24: 4000 (0xfa0)
      white_balance_auto_preset 0x009a0914 (menu)   : min=0 max=10 default=1 value=1
                                0: Manual
                                1: Auto
                                2: Incandescent
                                3: Fluorescent
                                4: Fluorescent H
                                5: Horizon
                                6: Daylight
                                7: Flash
                                8: Cloudy
                                9: Shade
                                10: Greyworld
            image_stabilization 0x009a0916 (bool)   : default=0 value=0
                iso_sensitivity 0x009a0917 (intmenu): min=0 max=4 default=0 value=0
                                0: 0 (0x0)
                                1: 100000 (0x186a0)
                                2: 200000 (0x30d40)
                                3: 400000 (0x61a80)
                                4: 800000 (0xc3500)
           iso_sensitivity_auto 0x009a0918 (menu)   : min=0 max=1 default=1 value=1
                                0: Manual
                                1: Auto
         exposure_metering_mode 0x009a0919 (menu)   : min=0 max=2 default=0 value=2
                                0: Average
                                1: Center Weighted
                                2: Spot
                     scene_mode 0x009a091a (menu)   : min=0 max=13 default=0 value=0
                                0: None
                                8: Night
                                11: Sports

JPEG Compression Controls

            compression_quality 0x009d0903 (int)    : min=1 max=100 step=1 default=30 value=10

from showmewebcam.

PSF1 avatar PSF1 commented on May 29, 2024

How can I permanent changes? After reboot, it's reset.

from showmewebcam.

htruong avatar htruong commented on May 29, 2024

I am going to work on the facility to allow you to save the webcam settings.

from showmewebcam.

kmalinich avatar kmalinich commented on May 29, 2024

I'm using this camera which has the original 5MP Raspberry Pi camera sensor, and I had to set the auto exposure bias to 9, but then it looked pretty nice.

from showmewebcam.

tamis-laan avatar tamis-laan commented on May 29, 2024

You can access the camera root prompt:

https://hackaday.io/project/174479-raspberry-pi-0-hq-usb-webcam/log/182789-how-to-tweak-your-camera-settings

After logginfg in with root, you can type something like this:

/usr/bin/v4l2-ctl -c auto_exposure_bias=15
/usr/bin/v4l2-ctl -c contrast=0

That should be enough to improve the brightness. To see all the tweakable parameters, you can list it

/usr/bin/v4l2-ctl -L | less

Please report back what values worked for you!

Any reason these settings cannot be exposed to the client?

from showmewebcam.

htruong avatar htruong commented on May 29, 2024

No, it is just I haven't had time to bake in the ability to set those parameters somewhere.

from showmewebcam.

tamis-laan avatar tamis-laan commented on May 29, 2024

I see, well I'm waiting for my HQ camera to arrive, any way I can help you get this done? Any pointers where to look/start?

from showmewebcam.

PSF1 avatar PSF1 commented on May 29, 2024

I can help too :_ D
How can we expose the parameters?

from showmewebcam.

htruong avatar htruong commented on May 29, 2024

I think the general direction will be to expose a new file with tweakable parameters laid out so the users and freely change and save it. To achieve that:

  1. Mount the /boot partition on startup (fix /etc/fstab).
  2. Read a file say /boot/camera.txt and apply each parameter before running the start-webcam.sh script.

from showmewebcam.

tamis-laan avatar tamis-laan commented on May 29, 2024

This would be to change the default settings? But I assume there should also be some way to change the settings from a menu in the operating system (through driver configuration)?

If you are exposing a config file it would also be an idea to be able to set wifi settings, this way it could also function as an IP camera at the same time.

from showmewebcam.

kmalinich avatar kmalinich commented on May 29, 2024

@tamis-laan this is a buildroot setup with the wifi intentionally disabled to keep it as lightweight as possible, adding wifi back to it would kind of go against that..

@htruong if you used something like /boot/camera.cfg as a shell-sourceable file with variables in it (i.e. CAMERA_CONTRAST=55, you could source it from start-webcam.sh or multi-gadget.sh, and in one of those, do something like /usr/bin/v4l2-ctl -c "contrast=${CAMERA_CONTRAST-50}" which would use the ${CAMERA_CONTRAST} value from /boot/camera.cfg if it was present, but would use a value of 50 otherwise. Then it would be easily editable by any machine that can read the FAT /boot partition.

If you wanted to go overboard you could include some other forms of sanity checks on the values, but without a way to output the result of those checks, it might be a moot point, and therefore the responsibility of the user to not put something like CAMERA_CONTRAST=1000000 or CAMERA_CONTRAST=jdjjdila in /boot/camera.cfg (which IMO is totally fine - if the user can't handle that, they can buy a Logitech USB webcam or something)

from showmewebcam.

htruong avatar htruong commented on May 29, 2024

@tamis-laan @kmalinich I can add the wifi + a lightweight server to configure the camera, but that will take some time. I don't think it will make the image much larger, and perhaps we can disable it by default so we don't have to worry about security.

My camera was busted in the last two weeks because the ribbon cable just got bent too much and the camera died while I was using it and I couldn't figure out what was defective. I am working on the issue now as I got another one shipped to me and my setup is working again!

from showmewebcam.

htruong avatar htruong commented on May 29, 2024

Would someone help me test this build https://github.com/showmewebcam/showmewebcam/releases/tag/V1.30-preview

from showmewebcam.

tuyenld avatar tuyenld commented on May 29, 2024

@htruong
I tried to create camera.txt, but it seems the boot partition is Read-Only

# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                30.9M     30.9M         0 100% /
devtmpfs                193.9M         0    193.9M   0% /dev
tmpfs                   198.2M         0    198.2M   0% /dev/shm
tmpfs                   198.2M      2.8M    195.4M   1% /run
tmpfs                   198.2M         0    198.2M   0% /sys/fs/cgroup
tmpfs                   198.2M      2.8M    195.4M   1% /etc/machine-id
tmpfs                   198.2M         0    198.2M   0% /tmp
tmpfs                    64.0M    152.0K     63.9M   0% /var
/dev/mmcblk0p1           31.9M      9.4M     22.6M  29% /boot

# mount | grep mmcblk0p1
/dev/mmcblk0p1 on /boot type vfat (ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

from showmewebcam.

htruong avatar htruong commented on May 29, 2024

@tuyenld Sorry I forgot to mention how can you actually do it -- you have two choices:

  1. Modify the file in the boot partition on your computer.
  2. Connect via the ttyACM interface and remount the boot partition read-write:

mount -o remount,rw /boot

Then you'll be able to edit the file (use vi, it's a pain in the neck sorry), then reboot.

from showmewebcam.

tuyenld avatar tuyenld commented on May 29, 2024

@htruong
I tested with Pi Zero W + v1 5M Camera. It worked now!!!
New auto_exposure_bias was applied after reboot.

from showmewebcam.

tamis-laan avatar tamis-laan commented on May 29, 2024

I'm will be receiving the last camera components tonight and will give v1.3 a test run.

from showmewebcam.

PSF1 avatar PSF1 commented on May 29, 2024

I created the camera.txt file in /boot and work ok, but if we write a line with spaces around equal fail to read the file or that option. Something like this fail:
contrast = 0

but with this work ok:
contrast=0

I try adding blank lines and comments with '#' and work ok.

I will write now a file with the default options and comments to put it in the img file if you want it. I forked this repository but I don't know where to put the file. :_ D

from showmewebcam.

PSF1 avatar PSF1 commented on May 29, 2024

This is a default file that describe settings, with options and limits.
default camera.txt

from showmewebcam.

Fernyman79 avatar Fernyman79 commented on May 29, 2024

I've tried to test this, but I can't mount the /boot partition. I get the following:

mount: /boot: mount point does not exist.

Also, adding a camera.txt by mounting the SD card doesn't work for me. Upon booting the PI, the settings don't make any effect. Client OS is macOS.

Any thoughts?

from showmewebcam.

htruong avatar htruong commented on May 29, 2024

Hey @Fernyman79 that doesn't sound right. Are you sure you're running https://github.com/showmewebcam/showmewebcam/releases/tag/V1.30-preview ? Can you show me what it says in:

cat /etc/fstab

While you're logged to the ttyACM interface? If it has an entry for /boot then you're good, otherwise I think your image hasn't been written correctly to the sd card.

from showmewebcam.

htruong avatar htruong commented on May 29, 2024

Let's try the new preview version, it'll have more debugging info:

https://github.com/showmewebcam/showmewebcam/releases/tag/v1.30-preview2

If your settings are not applied correctly, try to issue this command on the ttyACM debug interface and paste here:

journalctl -t piwebcam

from showmewebcam.

Fernyman79 avatar Fernyman79 commented on May 29, 2024

I got it to work. I was using the raspberry pi imager to write the SD card. Tried with etcher and it worked. @htruong your comment about my card not being written correctly tipped me. Thanks for the help!

Now that this is working, I have noticed that the camera framing is pretty close in/zoomed in. I'll open another issue, sine it's unrelated.

from showmewebcam.

htruong avatar htruong commented on May 29, 2024

Thanks, everyone for testing and reporting bugs!

@PSF1 now we can handle the spaces in the settings file.

V1.30 is identical to V1.30-preview2.

from showmewebcam.

Related Issues (20)

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.