Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cvCreateCameraCapture doesn't support legacy API anymore. #22

Open
l29ah opened this issue Dec 3, 2019 · 28 comments
Open

cvCreateCameraCapture doesn't support legacy API anymore. #22

l29ah opened this issue Dec 3, 2019 · 28 comments
Assignees

Comments

@l29ah
Copy link

l29ah commented Dec 3, 2019

When i run eviacam against opencv-4.1.2 the following occurs

[ WARN:0] global /var/tmp/portage/media-libs/opencv-4.1.2-r1/work/opencv-4.1.2/modules/videoio/src/videoio_c.cpp (15) cvCreateCameraCapture cvCreateCameraCapture doesn't support legacy API anymore.

and eviacam exits.

@adrianmay
Copy link

I get that too

@cmauri
Copy link
Owner

cmauri commented Feb 13, 2020

It seems that newer opencv does not support cvCreateCameraCapture function anymore.

In this post you'll find an example of how to capture video using the new API

You can also try changing viacamcontroller.cpp:252 from this:

CCamera* cam = CCameraEnum::getCamera(1, camId);

to this:

CCamera* cam = CCameraEnum::getCamera(0, camId);

@skozlovski
Copy link

That stopped the error, but the application still does not run.

@skozlovski
Copy link

skozlovski commented May 25, 2020

Let me add some more details. I have used this app under Ubuntu 19.10 just from apt-get and it worked great. After 20.04 update the application had to be reinstalled and it is now generates the error about the Legacy API no supported (as per title of the thread). I have downloaded the code and compiled it with the suggested changes. While the application does not throw this error, it doesn't run and just exits. I have tried to compile from code under 19.10 and the build works there.
So, I am asking if the support for Ubuntu 20.04 can be integrated as 19.10 has only few weeks of life cycle left, and any new installes will no longer be able use this app. Thank you.

@cmauri cmauri self-assigned this Jun 1, 2020
@SergeyRom-23
Copy link

I faced a similar problem too.
linux-mint 20 xfce. I install from the repository, but on startup it writes an error:
(eviacam:26084): Gtk-CRITICAL **: 19:09:00.290: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar [ WARN:0] global ../modules/videoio/src/videoio_c.cpp (15) cvCreateCameraCapture cvCreateCameraCapture doesn't support legacy API anymore.
I did a debug, and I attach it in a file.
debag.txt
This is the program I want, but I cannot run it.
As you said to do this I did not find where it is. And I am not a strong expert on this code.
_
If you can tell me how to fix it, thanks in advance. This program can help people with disabilities, and more than one.
thank.

@Marty
Copy link

Marty commented Jul 23, 2021

I just found this wonderful tool and get the same error :(

@adrianmay
Copy link

adrianmay commented Jul 23, 2021 via email

@rlopes528
Copy link

I'm desperately needing to use this I hope this can be fixed because many people like me are in need of a way to use their computers hands-free

@adrianmay
Copy link

adrianmay commented Jul 29, 2021 via email

@l29ah
Copy link
Author

l29ah commented Jul 29, 2021

I'm desperately needing

You may like https://www.bountysource.com/ then.

@rlopes528
Copy link

anybody with that kind of money screw up

I'm desperately needing

You may like https://www.bountysource.com/ then.

Right, if I had that kind of money

@rlopes528
Copy link

rlopes528 commented Jul 29, 2021

My thing only works on Linux with Nvidia, and even then you'd have to tweak it and make a headband. I'll try to find some time to polish it up.

This is great, you should publish it

@adrianmay
Copy link

adrianmay commented Jul 30, 2021 via email

@rlopes528
Copy link

that's right, I have very limited movement in my arms and I can't use my fingers to click.
using head movements will be perfect.

@adrianmay
Copy link

adrianmay commented Jul 31, 2021 via email

@adrianmay
Copy link

adrianmay commented Jul 31, 2021 via email

@rlopes528
Copy link

Would it be practical for you to print out an image I define and stick it on a headband or hat?

On Fri, 30 Jul 2021, 13:20 rlopes528, @.***> wrote: that's right, I have very limited movement in my arms and I can't use my fingers to click. using head movements will be perfect. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#22 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAARMRZEDHGPY2FUWGB5U4DT2KKIZANCNFSM4JU4AUXA .

For sure! Anything that works is very welcome

@rlopes528
Copy link

For clicking, I use keyboard mappings, which obviously wouldn't work for you. I'm thinking about lip gestures, e.g., you'd mouth "ee" for a left click and "oo" for a right click, but I suspect you're using speech recognition on this computer already so that wouldn't be an option. Right? On Sat, 31 Jul 2021, 09:43 Adrian May, @.> wrote:

Would it be practical for you to print out an image I define and stick it on a headband or hat? On Fri, 30 Jul 2021, 13:20 rlopes528, @.
> wrote: > that's right, I have very limited movement in my arms and I can't use my > fingers to click. > using head movements will be perfect. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <#22 (comment)>, or > unsubscribe > https://github.com/notifications/unsubscribe-auth/AAARMRZEDHGPY2FUWGB5U4DT2KKIZANCNFSM4JU4AUXA > . >

Yes, I'm using Voice Rec now. It's a Chrome extension, but it obviously only works with Chrome.

@adrianmay
Copy link

adrianmay commented Jul 31, 2021 via email

@adrianmay
Copy link

adrianmay commented Jul 31, 2021 via email

@rlopes528
Copy link

Can you wink with both eyes independently?

On Sat, 31 Jul 2021, 13:46 rlopes528, @.***> wrote: For clicking, I use keyboard mappings, which obviously wouldn't work for you. I'm thinking about lip gestures, e.g., you'd mouth "ee" for a left click and "oo" for a right click, but I suspect you're using speech recognition on this computer already so that wouldn't be an option. Right? On Sat, 31 Jul 2021, 09:43 Adrian May, @. > wrote: … <#m_-8183585021475224919_> Would it be practical for you to print out an image I define and stick it on a headband or hat? On Fri, 30 Jul 2021, 13:20 rlopes528, @.> wrote: > that's right, I have very limited movement in my arms and I can't use my > fingers to click. > using head movements will be perfect. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <#22 (comment) <#22 (comment)>>, or > unsubscribe > https://github.com/notifications/unsubscribe-auth/AAARMRZEDHGPY2FUWGB5U4DT2KKIZANCNFSM4JU4AUXA > . > Yes, I'm using Voice Rec now. It's a Chrome extension, but it obviously only works with Chrome. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#22 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAARMRZ647HSXGODURZA4J3T2PWD5ANCNFSM4JU4AUXA .

yes I can do that

@rlopes528
Copy link

It just occurred to me that there's a completely different approach to this: attach a smartphone to your head using some kind of hat and use its accelerometer and gyroscope. They seem to be very accurate. Does that sound practical? On Sat, 31 Jul 2021, 14:04 Adrian May, @.> wrote:

Can you wink with both eyes independently? On Sat, 31 Jul 2021, 13:46 rlopes528, @.
> wrote: > For clicking, I use keyboard mappings, which obviously wouldn't work for > you. I'm thinking about lip gestures, e.g., you'd mouth "ee" for a left > click and "oo" for a right click, but I suspect you're using speech > recognition on this computer already so that wouldn't be an option. Right? > On Sat, 31 Jul 2021, 09:43 Adrian May, @. > > > wrote: … <#m_3248679360202238638_m_-8183585021475224919_> Would it be > practical for you to print out an image I define and stick it on a headband > or hat? On Fri, 30 Jul 2021, 13:20 rlopes528, @.> wrote: > that's > right, I have very limited movement in my arms and I can't use my > fingers > to click. > using head movements will be perfect. > > — > You are receiving > this because you commented. > Reply to this email directly, view it on > GitHub > <#22 (comment) > <#22 (comment)>>, > or > unsubscribe > > https://github.com/notifications/unsubscribe-auth/AAARMRZEDHGPY2FUWGB5U4DT2KKIZANCNFSM4JU4AUXA > > . > > > Yes, I'm using Voice Rec now. It's a Chrome extension, but it obviously > only works with Chrome. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <#22 (comment)>, or > unsubscribe > https://github.com/notifications/unsubscribe-auth/AAARMRZ647HSXGODURZA4J3T2PWD5ANCNFSM4JU4AUXA > . >

I'm really impressed with the ideas that you come with ! I would never have thought about this.
unfortunately that's not possible for me because there is an issue with EMF. I have studied the subject and I think it will be very harmful to have your phone on your head

@Samoticha
Copy link

I have the same error @ Ubuntu 20.04 and need it to control my computer! Can anyone help?

@sanity
Copy link

sanity commented Feb 19, 2022

Same error on Ubuntu 21.10 :(

@steven2308
Copy link

Also on Ubuntu 22.04. What a pity 😢

[libwebcam] Invalid or unsupported V4L2 control encountered: ctrl_id = 0x00980001, name = 'User Controls'
[libwebcam] Invalid V4L2 control type encountered: ctrl_id = 0x009A0001, name = 'Camera Controls', type = 6
[libwebcam] Invalid or unsupported V4L2 control encountered: ctrl_id = 0x009A0001, name = 'Camera Controls'
[ WARN:0] global ./modules/videoio/src/videoio_c.cpp (15) cvCreateCameraCapture cvCreateCameraCapture doesn't support legacy API anymore.

@anthmapper
Copy link

This commit: a4032ed actually solves the problem of the opencv legacy API not being supported anymore.
Sadly, it wasn't in my Debian (Bullseye - stable) repository (which is totally normal - setting it up in backports would be a cool thing to do, but I'm not competent enough yet).

So I compiled and installed from source.
Under is what I did, if it can help someone (on Debian and maybe Ubuntu).
I'm not saying it's the best way of doing it, but it works for me ;) (especially as there are specific instructions to create a .deb install package in the INSTALL file in source. But I kept having errors: "gpg2 command not found" - then after I created a symlink "rm: cannot remove 'po/stamp-po'" and "dpkg-buildpackage: error: failed to sign .dsc file").

So I decided to do it the classical way.
First, I needed a few things:
sudo apt install git gcc checkinstall #checkinstall is not mandatory, but allows a cleaner install.
You may need more packages, what I needed was mostly already installed for me.

Then the dependencies specific to compiling eviacam:
sudo apt install libopencv-dev libpng-dev libv4l-dev libwxgtk3.0-gtk3-dev libgtk-3-dev libxtst-dev
Just in case, if dependencies are still missing, you could do:
sudo apt build-dep eviacam
It normally installs all packages needed to build the package.

Then in my working folder, I did:

git clone https://github.com/cmauri/eviacam
cd eviacam

I then followed the basic instructions in the "INSTALL" file in the directory, except for the last step, which allows me to create a deb package to install and easy to remove if needed, instead of installing directly. It's thus much cleaner: https://wiki.debian.org/CheckInstall

./autogen.sh
./configure
make
sudo checkinstall --install=no #this is the special step

--install=no is to instruct it not to install the deb package automatically, but you can skip that.

Then I followed the on-screen instructions: I asked if I wanted to create package docs, it asked for a few description lines, I added those even if I guess I could have skipped.
I then had the "Warning: The package version is not a debian policy compliant one. Please specify an alternate one" showing me a weird identical 11 lines version number. So I entered as a version number 2.1.4-1.1
Then enter, and it created the .deb package.
I then installed it:
sudo apt install ./eviacam_2.1.4-1.1-1_amd64.deb
Eviacam now worked !

As I had this error: "bash: /usr/bin/eviacam: No such file or directory" I created a symlink to the binary where it had installed (found it with whereis eviacam)
sudo ln -s /usr/local/bin/eviacam /usr/bin/eviacam
You may need to manually add the program in your start menu to see it there too, but it should now start from any terminal.

If you messed up the version number you may need to set eviacam from the distribution repo on hold, to avoid having your custom install overwritten the next time the computer updates. Use with care as when there is the proper update, you won't get it.
sudo apt-mark hold eviacam
But in my case it wasn't needed.

If you need to learn a bit more on how to compile from source on debian, there is a great wiki page: https://wiki.debian.org/BuildingTutorial
And more in detail I guess: https://www.debian.org/doc/manuals/maint-guide/index.en.html
Or rather: https://www.debian.org/doc/manuals/debian-handbook/index.en.html

@threepistons
Copy link

threepistons commented Jan 21, 2025

@anthmapper's suggestion to self-build a .deb package mostly worked great on Ubuntu 22.04 but my Debian Bookworm system didn't like it.

root@bookworm:~# apt build-dep eviacam
Reading package lists... Done
E: Unable to find a source package for eviacam
# me @ bookworm in ~/git/eviacam on git:master o [16:36:23] 
$ ./autogen.sh                               
configure.ac:33: warning: macro 'AM_GNU_GETTEXT' not found in library
configure.ac:4: warning: 'AM_CONFIG_HEADER': this macro is obsolete.
configure.ac:4: You should use the 'AC_CONFIG_HEADERS' macro instead.
./lib/autoconf/general.m4:2434: AC_DIAGNOSE is expanded from...
aclocal.m4:9833: AM_CONFIG_HEADER is expanded from...
configure.ac:4: the top level
configure.ac:18: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:18: You should run autoupdate.
aclocal.m4:122: AC_PROG_LIBTOOL is expanded from...
configure.ac:18: the top level
configure.ac:19: warning: The macro `AM_PROG_LIBTOOL' is obsolete.
configure.ac:19: You should run autoupdate.
aclocal.m4:123: AM_PROG_LIBTOOL is expanded from...
configure.ac:19: the top level
configure.ac:245: warning: AC_OUTPUT should be used without arguments.
configure.ac:245: You should run autoupdate.
configure.ac:33: error: possibly undefined macro: AM_GNU_GETTEXT
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:18: installing './compile'
configure.ac:18: installing './config.guess'
configure.ac:18: installing './config.sub'
configure.ac:5: installing './install-sh'
configure.ac:5: installing './missing'
creavision/Makefile.am: installing './depcomp'

# me @ bookworm in ~/git/eviacam on git:master o [16:36:38] 
$ autoupdate

# me @ bookworm in ~/git/eviacam on git:master x [16:36:58] 
$ ./autogen.sh
configure.ac:33: warning: macro 'AM_GNU_GETTEXT' not found in library
configure.ac:4: warning: 'AM_CONFIG_HEADER': this macro is obsolete.
configure.ac:4: You should use the 'AC_CONFIG_HEADERS' macro instead.
./lib/autoconf/general.m4:2434: AC_DIAGNOSE is expanded from...
aclocal.m4:9833: AM_CONFIG_HEADER is expanded from...
configure.ac:4: the top level
configure.ac:33: error: possibly undefined macro: AM_GNU_GETTEXT
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:18: installing './compile'
configure.ac:5: installing './missing'
creavision/Makefile.am: installing './depcomp'

# me @ bookworm in ~/git/eviacam on git:master x [16:37:09] 
$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
## [output omitted for brevity] ##
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking how to run the C preprocessor... gcc -E
checking for gawk... (cached) mawk
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
./configure: line 18059: syntax error near unexpected token `external'
./configure: line 18059: `AM_GNU_GETTEXT(external)'

What fixed this was sudo apt install gettext because only gettext-base is installed as standard.

There remains complaints about "warning: 'AM_CONFIG_HEADER': this macro is obsolete. You should use the 'AC_CONFIG_HEADERS' macro instead." so expect the ./autogen.sh to stop worrking at some point.

@threepistons
Copy link

threepistons commented Jan 21, 2025

I spoke too soon. make did this:

e.o `test -f 'visionpipeline.cpp' || echo './'`visionpipeline.cpp
mv -f .deps/eviacam-visionpipeline.Tpo .deps/eviacam-visionpipeline.Po
g++ -DHAVE_CONFIG_H -I. -I..  -I../creavision -I../simplelog -I../wxcamwindow -I../wxutil  -DLOCALEDIR=\"/usr/local/share/locale\" -DOPENCVVERSION=4006000 -g -O2 -fexceptions -I/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.2 -I/usr/include/wx-3.2 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -I/usr/include/opencv4  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -pthread  -DNDEBUG -O2 -std=c++11 -MT eviacam-viacamcontroller.o -MD -MP -MF .deps/eviacam-viacamcontroller.Tpo -c -o eviacam-viacamcontroller.o `test -f 'viacamcontroller.cpp' || echo './'`viacamcontroller.cpp
viacamcontroller.cpp: In member function ‘CCamera* CViacamController::SetUpCamera()’:
viacamcontroller.cpp:232:98: error: invalid conversion from ‘char**’ to ‘void**’ [-fpermissive]
  232 |                                 (char**)NULL, wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE);
      |                                                                                                  ^
      |                                                                                                  |
      |                                                                                                  char**
In file included from /usr/include/wx-3.2/wx/choicdlg.h:18,
                 from viacamcontroller.cpp:40:
/usr/include/wx-3.2/wx/generic/choicdgg.h:114:33: note:   initializing argument 5 of ‘wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow*, const wxString&, const wxString&, const wxArrayString&, void**, long int, const wxPoint&)’
  114 |                          void **clientData = NULL,
      |                                 ^
make[2]: *** [Makefile:902: eviacam-viacamcontroller.o] Error 1
make[2]: Leaving directory '/home/me/git/eviacam/src'
make[1]: *** [Makefile:514: all-recursive] Error 1
make[1]: Leaving directory '/home/me/git/eviacam'
make: *** [Makefile:423: all] Error 2

I'm guessing that this is #35. https://docs.wxwidgets.org/latest/classwx_single_choice_dialog.html says that the constructor (is that the term?) expects a NULL**. (What do the two stars mean?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests