sajmons / CollimationCircles

Collimation Circles is application for precise telescope collimation
https://www.saimons-astronomy.com/software/collimation-circles
GNU Lesser General Public License v3.0
39 stars 2 forks source link

Adding some camera controls, focus, zoom, etc. #18

Open sajmons opened 7 months ago

sajmons commented 7 months ago

See here for some documentation https://www.kurokesu.com/main/2016/01/16/manual-usb-camera-settings-in-linux/ https://code.videolan.org/videolan/vlc/-/issues/11105

tlkw79 commented 6 months ago

Any progress on this? Thanks.

sajmons commented 6 months ago

Yes Tommy, actually I have beta version available to test. Camera controls are curently working for UVC cameras on Windows and on Linux. Raspberry PI camera controls are not supported yet. Would you be interested to test it?

tlkw79 commented 6 months ago

Oh yes. I can test the beta version for you since I have both Linux and Windows OS with UVC camera.

Thanks.

sajmons commented 6 months ago

Here is beta release that you can test. https://github.com/sajmons/CollimationCircles/releases/tag/version-3.2.0-beta

Please write all your findings here. Thank you!

tlkw79 commented 6 months ago

Hi Sajmons,

This is what I found out in the beta release.

Kubuntu:

  1. Brightness until Zoom functions are okay to use.
  2. Sadly Gain until Exposure functions are nothing happen when adjusting. Especially the FOCUS, nothing happens at all.
  3. The camera control windows are always kept below others. A bit inconvenient.
  4. when the UVC camera started, the framerates became very slow.
  5. I have to always adjust the Camera Video stream windows to the correct size every time CC starts.

Windows OS:

  1. The camera control windows are always kept below others.
  2. Camera control nothing working in Windows.

these are what I've found so far.

Thanks.

sajmons commented 6 months ago

What version of windows were you using when testing?

tlkw79 commented 6 months ago

Windows 10

sajmons commented 6 months ago

Interesting on windows 11 controls are working. I'll investigate.

tlkw79 commented 6 months ago

Ok. Thanks a lot.

Maybe you can consider creating a discord group for CC discussion?

tlkw79 commented 6 months ago

One more issue on my Kubuntu Laptop with webcam. Even though UVC has already been selected, when I start the live stream, it always connects to my laptop webcam.

tlkw79 commented 6 months ago

Okay, I tested my UVC camera in Windows 11. Nothing happens with camera control too. Anything that I need to add or install?

sajmons commented 6 months ago

Okay, I tested my UVC camera in Windows 11. Nothing happens with camera control too. Anything that I need to add or install?

Hmm, UVC cameras should work out of the box. Do you have multiple cameras on your Windows system?

sajmons commented 6 months ago

One more issue on my Kubuntu Laptop with webcam. Even though UVC has already been selected, when I start the live stream, it always connects to my laptop webcam.

Probably your camera is UVC camera is not /dev/video0 device. Use v4l2-ctl --list-devices command in terminal to see your UVC camera.

Then try to change v4l2:///dev/video0 address to v4l2:///dev/video1 or what is aplicable for your UVC camera. I should add here dropdown of available cameras.

tlkw79 commented 6 months ago

Okay, I tested my UVC camera in Windows 11. Nothing happens with camera control too. Anything that I need to add or install?

Hmm, UVC cameras should work out of the box. Do you have multiple cameras on your Windows system?

there is a webcam in my notebook.

tlkw79 commented 6 months ago

Now Kubuntu and Windows 10/11 manage to display via my UVC camera. But both still cannot control the camera parameters. Going through other webcam software no problem.

Under Kubuntu, my webcam display becomes very lag.

tlkw79 commented 6 months ago

tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl --list-devices Virtual Camera (platform:v4l2loopback-000): /dev/video0

HD User Facing: HD User Facing (usb-0000:00:14.0-5): /dev/video1 /dev/video2 /dev/media0

Depstech webcam MIC: Depstech w (usb-0000:00:14.0-8): /dev/video3 /dev/video4 /dev/media1

Is a virtual camera normal to be there?

sajmons commented 6 months ago

Can you please confirm if command line controls are working, while CC is running on linux?

Example: v4l2-ctl \ --set-ctrl=brightness=150 \ --set-ctrl=contrast=51 \ --set-ctrl=saturation=32 \ --set-ctrl=white_balance_temperature_auto=0 \ --set-ctrl=gain=90 \ --set-ctrl=power_line_frequency=1 \ --set-ctrl=white_balance_temperature=1140 \ --set-ctrl=sharpness=24 \ --set-ctrl=backlight_compensation=1 \ --set-ctrl=exposure_auto=1 \ --set-ctrl=exposure_absolute=870 \ --set-ctrl=exposure_auto_priority=1

tlkw79 commented 6 months ago

Can you please confirm if command line controls are working, while CC is running on linux?

Example: v4l2-ctl --set-ctrl=brightness=150 --set-ctrl=contrast=51 --set-ctrl=saturation=32 --set-ctrl=white_balance_temperature_auto=0 --set-ctrl=gain=90 --set-ctrl=power_line_frequency=1 --set-ctrl=white_balance_temperature=1140 --set-ctrl=sharpness=24 --set-ctrl=backlight_compensation=1 --set-ctrl=exposure_auto=1 --set-ctrl=exposure_absolute=870 --set-ctrl=exposure_auto_priority=1

Hi,

This is the result i got from console.

ommylkw@tommylkw-N3-Linux:~$ v4l2-ctl --set-ctrl=brightness=150 unknown control 'brightness' tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl --set-ctrl=contrast=52 unknown control 'contrast'

tlkw79 commented 6 months ago

exposure_auto_priority=1

From my console, this is what i get. Those commands without unknown control return are good.

tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl brightness=150 tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl contrast=51 tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl saturation=32 tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl white_balance_temperature_auto=0 unknown control 'white_balance_temperature_auto' tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl gain=90
unknown control 'gain' tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl power_line_frequency=1 tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl white_balance_temperature=1140 VIDIOC_S_CTRL: failed: Permission denied white_balance_temperature: Permission denied tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl sharpness=24
tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl backlight_compensation=1 tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl exposure_auto=1
unknown control 'exposure_auto' tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl exposure_absolute=870 unknown control 'exposure_absolute' tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl -d /dev/video3 --set-ctrl exposure_auto_priority=1 unknown control 'exposure_auto_priority' tommylkw@tommylkw-N3-Linux:~$

tlkw79 commented 6 months ago

This is what i found out.

tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl --list-ctrls --device /dev/video3

User Controls

                 brightness 0x00980900 (int)    : min=-64 max=64 step=1 default=0 value=0
                   contrast 0x00980901 (int)    : min=0 max=95 step=1 default=3 value=0
                 saturation 0x00980902 (int)    : min=0 max=100 step=1 default=64 value=50
                        hue 0x00980903 (int)    : min=-2000 max=2000 step=1 default=0 value=0
    white_balance_automatic 0x0098090c (bool)   : default=1 value=1
                      gamma 0x00980910 (int)    : min=100 max=300 step=1 default=115 value=100
       power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=1 (50 Hz)
  white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=1 default=4600 value=4600 flags=inactive
                  sharpness 0x0098091b (int)    : min=1 max=7 step=1 default=2 value=7
     backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=1

Camera Controls

              auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=3 value=3 (Aperture Priority Mode)
     exposure_time_absolute 0x009a0902 (int)    : min=3 max=2047 step=1 default=166 value=166 flags=inactive
             focus_absolute 0x009a090a (int)    : min=0 max=1023 step=1 default=0 value=190 flags=inactive
 focus_automatic_continuous 0x009a090c (bool)   : default=0 value=1
tlkw79 commented 6 months ago

One more thing, Can I know my UVC camera is running YUYY or MJPEG when connected in CC?

I believe MJPEG far more better than YUYY. Maybe you can provide an option to change this.

Thanks.

tlkw79 commented 5 months ago

Any progress on this? Thanks a lot.

sajmons commented 5 months ago

@tlkw79 No, no progres on this jet, sorry. I guess I'll have to get list of controly dynamically, so that user will only see those, that are supported by his camera. I just need to find time to implement this.

tlkw79 commented 5 months ago

this "Cameras are now detected dynamically and available in dropdown control" is good for windows user. But not for linux user on notebook with built in webcam. It will always start the built in webcam but not my UVC.

tlkw79 commented 5 months ago

Btw, in windows my UVC still failed to perform focus and other functions. I still depends on Sharpcap to act as video streamer.

sajmons commented 5 months ago

this "Cameras are now detected dynamically and available in dropdown control" is good for windows user. But not for linux user on notebook with built in webcam. It will always start the built in webcam but not my UVC.

You should change your camera in dropdown to see vich one will work. I dont know how to get default camera on Linux yet.

sajmons commented 5 months ago

Btw, in windows my UVC still failed to perform focus and other functions. I still depends on Sharpcap to act as video streamer.

Yeah, camera controls are work in progress. I don't have focusable camera at my hands, so I guess I will need your help here. Will contact you when I'm back to implementing controls.

tlkw79 commented 5 months ago

this "Cameras are now detected dynamically and available in dropdown control" is good for windows user. But not for linux user on notebook with built in webcam. It will always start the built in webcam but not my UVC.

You should change your camera in dropdown to see vich one will work. I dont know how to get default camera on Linux yet.

It doesn't show my UVC camera port. Unless I uninstall the V4l2loopback, then I can access the UVC camera.

sajmons commented 5 months ago

This is your Linux laptop? Can you run v4l2-ctl --list-devices or send me log file from logs folder.

tlkw79 commented 5 months ago

tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl --list-devices Virtual Camera (platform:v4l2loopback-000): /dev/video0

HD User Facing: HD User Facing (usb-0000:00:14.0-5): /dev/video1 /dev/video2 /dev/media0

Depstech webcam MIC: Depstech w (usb-0000:00:14.0-8): /dev/video3 /dev/video4 /dev/media1

HD User Facing is my notebook built in webcam. Depstech webcam is my UVC camera

sajmons commented 5 months ago

@tlkw79 Can you attach log too please?

tlkw79 commented 5 months ago

@tlkw79 Can you attach log too please?

Log for the UVC? I can't even connect to the UVC camera. I can only access to my HD User Facing webcam.

sajmons commented 5 months ago

@tlkw79 Can you attach log too please?

Log for the UVC? I can't even connect to the UVC camera. I can only access to my HD User Facing webcam.

No, what I ment is log of CollimationCircles application. It's located in same folder as CC application in logs subfolder.

tlkw79 commented 5 months ago

This is the log file that you need.

CC_Log.2024-03-28.12.txt

sajmons commented 5 months ago

@tlkw79 Can you attach log too please?

Log for the UVC? I can't even connect to the UVC camera. I can only access to my HD User Facing webcam.

@tlkw79 Thank you for log file. You have UVC camera conected to that Linux laptop? V4L2 seams to detect only HD User Facing camera. How you conected UVC camera? With USB camle I supose? Can you use your UVC camera with your Linux machine?

tlkw79 commented 5 months ago

@tlkw79 Can you attach log too please?

Log for the UVC? I can't even connect to the UVC camera. I can only access to my HD User Facing webcam.

@tlkw79 Thank you for log file. You have UVC camera conected to that Linux laptop? V4L2 seams to detect only HD User Facing camera. How you conected UVC camera? With USB camle I supose? Can you use your UVC camera with your Linux machine?

UVC camera is connected to my laptop using USB cable. Before the latest version of CC, I can change the /dev/videoX. But in the latest version, I can't see the UVC camera option.

sajmons commented 5 months ago

@tlkw79 I found possible bug in my code recognizing output from v4l2-ctl --list-devices command. But, when reviewing log that you send there is no

Depstech webcam MIC: Depstech w (usb-0000:00:14.0-8):
/dev/video3
/dev/video4
/dev/media1

in the log. Are you sure, that your UVC camera is properly connected and recognized by v4l2-ctl? It should be in the log regerdles of that bug I mentioned.

tlkw79 commented 5 months ago

tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl --list-devices Virtual Camera (platform:v4l2loopback-000): /dev/video0

HD User Facing: HD User Facing (usb-0000:00:14.0-5): /dev/video1 /dev/video2 /dev/media0

Depstech webcam MIC: Depstech w (usb-0000:00:14.0-8): /dev/video3 /dev/video4 /dev/media1

tommylkw@tommylkw-N3-Linux:~$ v4l2-ctl --list-devices Virtual Camera (platform:v4l2loopback-000): /dev/video0

HD User Facing: HD User Facing (usb-0000:00:14.0-5): /dev/video1 /dev/video2 /dev/media0

Depstech webcam MIC: Depstech w (usb-0000:00:14.0-8): /dev/video3 /dev/video4 /dev/media1

This is what I got when I plug in UVC camera into my laptop. The log is not capturing the UVC camera at all.

sajmons commented 5 months ago

Ok, I'll release new version with fix to see if it helps.

sajmons commented 4 months ago

@tlkw79 there is new version available. Now your should be able to pick your UVC camera from list and control it's parameters. Please let me know if it is working for you now? https://github.com/sajmons/CollimationCircles/releases/tag/version-3.2.0-beta3

sajmons commented 4 months ago

There is new version 3.2.0 beta5 available!

Changes are: Finally camera controls should work for UVC cameras on Windows (through DShow) and Linux (through V4L2). Performance improvements

Full change log: https://github.com/sajmons/CollimationCircles/compare/version-3.2.0-beta4...version-3.2.0-beta5

https://github.com/sajmons/CollimationCircles/releases

tlkw79 commented 3 months ago

Wow! latest version looks good in Linux but not good in windows 11. Log files attached. CC_Log.2024-05-16.txt CC_Log.2024-05-16.1.txt CC_Log.2024-05-16.0.txt

By the way, where is the Focus option?

Thanks a lot.

sajmons commented 3 months ago

@tlkw79 Can you be more specific about what is not working on Windows 11? I see there are errors in the logs, I'll correct that, but did camera stream showed or not?

Wow! latest version looks good in Linux but not good in windows 11. Log files attached. CC_Log.2024-05-16.txt CC_Log.2024-05-16.1.txt CC_Log.2024-05-16.0.txt

By the way, where is the Focus option?

Thanks a lot.

tlkw79 commented 3 months ago

@sajmons The camera doesn't stream at all. Just a small black screen pop up then the whole program hung there. Need to force it to close.

Thanks.

sajmons commented 3 months ago

Wow! latest version looks good in Linux but not good in windows 11. Log files attached. CC_Log.2024-05-16.txt CC_Log.2024-05-16.1.txt CC_Log.2024-05-16.0.txt

By the way, where is the Focus option?

Thanks a lot.

Do you see focus slider in camera controls? Can you send me screenshot of camera controls dialog, from windows and linux machine? Thank you

tlkw79 commented 3 months ago

Hi,

I can see Focus option in Windows, but not in Linux. But still, CC camera control not functioning in Windows.

Thanks. Tommy 2024-05-22_190037 Kazam_screenshot_00000

sajmons commented 3 months ago

Thank you Tommy. I found problem why Focus control is not visible on Linux. But I still don't know why it is not working? I'l have to investigate that further.

tlkw79 commented 3 months ago

Hi,

Any good news on software development?

Thanks Tommy

tlkw79 commented 1 month ago

Hi,

No new updates yet?

Best regards, Tommy

sajmons commented 1 month ago

Hi,

No new updates yet?

Best regards, Tommy

Today I have released new version beta7. More here: https://www.saimons-astronomy.com/1956214_new-release-of-collimation-circles-3-2-0-beta7