CamView for Wheesy and Jessie

More
14 Mar 2016 19:25 - 30 Mar 2016 07:17 #71652 by newbynobi
newbynobi created the topic: CamView for Wheesy and Jessie
Hallo,

as camview-emc is not any longer supported for Wheesy and Jessie, I decided to make my own widget to show a live image within LinuxCNC. It is based on opencv and GTK2, so it can be embedded in GladeVCP.

You find the branch with an GladeVCP widget to be embedded very easy on
GladeVCP CamView

You will need to install some dependencies, see "Stand Alone Description"

So I need some testers to get results and to convince other developers to merge my stuff to master.

To test "Stand Alone" (Wheesy oder Jessie)
sudo apt-get install qv4l2
open a terminal and type
qv4l2
If your camera is recognized and you are able to start a live stream, you are ready to go!
sudo apt-get install python-opencv
sudo apt-get install v4l-utils
sudo apt-get install v4l2ucp
Download the attached file camview.txt and rename it to camview.py

Open a terminal and go to the directory you placed camview.py and then type
python camview.py

Please read also the comments in the file camview.py, as I commented some start options.

Please report:
- should it be included in LinuxCNC / GladeVCP
- What Camera (type and model) do you use? (Will include that info in later documentation)
- Other comments you like to mention

Norbert
Attachments:
Last Edit: 30 Mar 2016 07:17 by newbynobi. Reason: wrong name of depency (v4l-utils is the corrrect one)
The following user(s) said Thank You: Tchefter
More
30 Mar 2016 03:18 #72359 by bogie6040
bogie6040 replied the topic: CamView for Wheesy and Jessie
Hello Norbert,

I followed your "stand alone" instructions, it can't find the v4l2-utils returning with:

bogie6040@LinuxCNC:~/Downloads$ sudo apt-get install v4l2-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package v4l2-utils
bogie6040@LinuxCNC:~/Downloads$

So I went to synaptic package manager and found "v4l-utils" version 0.8.8-3 and loaded it....
Everything else was found and loaded correctly, is there a different utilities package I need?

I went ahead and tried to run the camview.py file and it runs for a short period but then returns the following:

bogie6040@LinuxCNC:~/Downloads$ python camview.py
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
camview.py:702: Warning: g_object_ref: assertion `object->ref_count > 0' failed
gtk.main()
Segmentation fault
bogie6040@LinuxCNC:~/Downloads$

I'm looking forward to using your revised camview, looks very useful for the 6 seconds I can check it out.... :) Oh BTW I'm running Wheezy 2.7.4 and the camera is a logitech C270
Thanks, Bogie
More
30 Mar 2016 07:31 #72366 by newbynobi
newbynobi replied the topic: CamView for Wheesy and Jessie
Hallo Bogie,

thanks for testing.
My fault, the v4l-utils is the correct one, I corrected that error.

could you please try the following:

in a terminal type:
qv4l2
and let that one run with the preview.

Does that one work OK ?

Norbert
More
30 Mar 2016 09:29 - 30 Mar 2016 09:30 #72372 by newbynobi
newbynobi replied the topic: CamView for Wheesy and Jessie
@Bogie

I changed the code a little bit, after googling your problem.
It might be a driver problem, not beeing completly conform with v4l2, but also a timing problem ( your computer is faster than your camera).

Please test with the attached file after renaming it from .txt to .py. You will find in line 310 a timer.sleep(0.1)

With this settings you will get a poor FPS, if it does work, try to reduce the value as much as possible.

You could also check the FPS that your camera does support with qv4l2

Norbert
Attachments:
Last Edit: 30 Mar 2016 09:30 by newbynobi.
More
30 Mar 2016 17:16 - 30 Mar 2016 22:22 #72402 by bogie6040
bogie6040 replied the topic: CamView for Wheesy and Jessie
Norbert,

I can't test till I get home tonight (mountain time USA) but somethings I didn't mention, sorry, qv4l2 does bring up a preview of the camera output and I could even change the resolution and whatnot.... when running the camview.py script last night I noticed that the window didn't close if I didn't use the mouse, it did close by it's self after selecting the debug button with the keyboard though....

I will try what you have suggested tonight though...
~edit~ I did try this with an old trust spacecam 300 (only does 640x480) and it does work :) Is there a way to embed this in a tab in Axis?

Bogie
Last Edit: 30 Mar 2016 22:22 by bogie6040.
More
31 Mar 2016 00:19 #72427 by bogie6040
bogie6040 replied the topic: CamView for Wheesy and Jessie
Norbert,

The new python script works with my logitech cam now, Is there a way to put it into a tab in axis like the old camview did? Also is there a way to add a focus control?
Excellent work!! :)

Thanks
Bogie
More
01 Apr 2016 09:31 #72514 by newbynobi
newbynobi replied the topic: CamView for Wheesy and Jessie
@Bogie,

yes, I made a branch called gladevCP_camview on git, showing how that works.
But before trying, lets solve some issues.

You mentioned 2 cams, a logitech and a trust spacecam.

Do both work?
What is the lowest timer you can set, without getting the mentioned errors.

I need this infos, to decide if the timer is needed or not. If it is needed, we will need a control on the screen, to allow the user to change that values, etc.

Including a focus control is posssible, if your camera do support such one.
Please open the camera settings and look for the focus control checkbox. If it is there, uncheck it, press refresh and use the slider to control the focus.

Norbert
More
03 Apr 2016 01:50 #72602 by bogie6040
bogie6040 replied the topic: CamView for Wheesy and Jessie
Norbert,

Sorry for the long delay.... The spacecam worked with the original script (on a different computer) and the logitech works on my milling machine cpu with the following results:
It fails when line 310 is set to time.sleep(0.01)
It works when line 310 is set to time.sleep(0.011) FPS is ~ 14
I don't know how far down in time granularity you're looking to go, I can test further if you like.
In any case I always get the "VIDIOC_QUERYMENU: Invalid argument" multiple times before the video starts when running it.

My current screen cuts off the bottom of the camera settings window, so if the focus control box is near the bottom I can't see it....
The camera opens by default to 640 x 480 is there a way to change this?

Thanks,
Bogie
More
03 Apr 2016 11:50 #72617 by newbynobi
newbynobi replied the topic: CamView for Wheesy and Jessie
Hallo Bogie,

thanks for your ongoing testing.

So the actaual camera results
Tested cams
HD WebCam from Acer Aspire E5-771G-7169 (without timer OK)
Logitech HD Pro Webcam C920 (without timer OK)
Trust spacecam 300 (without timer OK)
Logitech C270 (only with timer set to )

The Error "VIDIOC_QUERYMENU: Invalid argument" is still a mystery for me, as both cams I tested do work fine.

On stand alone setting the cam resolution is easy.
Go to the end of the file and check for the line:
camv = CamView(videodevice=0, frame_width=640, frame_height=480)

just change width and high values to fit your needs.

If you do use it embedded, just change the values on the property part of the corresponding glade file.

Could you please let me know something about the hardware of both tested computers?

I tested my cams on
ACER Laptop I7 8GB Ram running Jessie /Linuxcnc 2.7 and master
AMD X2-6400 on ABUS Mainboard with 4GB Ram running Wheesy /Linuxcnc 2.7
AMD X2-4800 with MSI Mainboard 16 GB Ram running Jessie without Linuxcnc bit proprietary NVidia driver

I may test also on my lathe machine controler Cerleron 2 GB Ram running Linuxcnc 2.3 B)
Because of continuous work on gmoccapy and GladeVCP Widgets I am not able to update that machine :whistle:

Norbert
More
06 Apr 2016 19:41 #72869 by bogie6040
bogie6040 replied the topic: CamView for Wheesy and Jessie
Norbert,

The machine at work I'm using with the trust spacecam 300 is an
HP Compaq dx2400 Microtower Intel Celeron 440 @ 2Ghz with 1GB of ram
Debian Wheezy 2.7.4 and 2.8.0-pre1-1558-gedlbbf8 - I have not tried to integrate into a tab.....

Jake
Moderators: mhaberler
Time to create page: 0.155 seconds
Powered by Kunena Forum