OpenCV problem z cvCreateCameraCapture()

0

Witam,
mam nastepujacy problem do komputera mam podlaczone dwie kamery , pisze program w ktorym bede sobie wyswietlal obraz z wybranej kamerki, jednak najpierw chce wybrac ta kamere recznie. Uzywam funkcji cvCreateCameraCapture(int index) ktora jako argument przyjmuje numer kamery, jezeli wpisze 0 lub -1 to wszystko dziala tylko obraz jest niekoniecznie z tej kamery z ktorej bym chcial, przy indexach powyzej 0 czyli jak wpisze np 1 albo 2 program wywala blad. Jak moge uzyskac ilosc dostepnych kamer oraz odpowiadajacy jej index?? Pomoze ktos?

0

Odnośnie numeru -1, cytat z "Learning OpenCV":
"The routine does not take a file name but rather a camera ID number as its argument.
Of course, this is important only when multiple cameras are available. The default value
is -1, which means just pick one; naturally, this works quite well when there is only
one camera to pick."

Oraz:
"The routine cvCreateCameraCapture() works very much like cvCreateFileCapture() ex-
cept without the headache from the codecs.* In this case we give an identifier that indi-
cates which camera we would like to access and how we expect the operating system to
talk to that camera. For the former, this is just an identification number that is zero (0)
when we only have one camera, and increments upward when there are multiple cam-
eras on the same system. The other part of the identifier is called the domain of the
camera and indicates (in essence) what type of camera we have. h e domain can be any
of the predefined constants shown in Table 4-3.

Camera capture constant - Numerical value
CV_CAP_ANY 0
CV_CAP_MIL 100
CV_CAP_VFW 200
CV_CAP_V4L 200
CV_CAP_V4L2 200
CV_CAP_FIREWIRE 300
CV_CAP_IEEE1394 300
CV_CAP_DC1394 300
CV_CAP_CMU1394 300

When we call cvCreateCameraCapture(), we pass in an identifier that is just the sum of
the domain index and the camera index. For example:
CvCapture* capture = cvCreateCameraCapture( CV_CAP_FIREWIRE );
In this example, cvCreateCameraCapture() will attempt to open the first (i.e., number-
zero) Firewire camera. In most cases, the domain is unnecessary when we have only one
camera; it is sufficient to use CV_CAP_ANY (which is conveniently equal to 0, so we don't
even have to type that in). One last useful hint before we move on: you can pass -1 to
cvCreateCameraCapture(), which will cause OpenCV to open a window that allows you
to select the desired camera."

0

no ok, -1 jest do tego zeby wlaczyc wszystko jedno jaka kamere no i tak sie rzeczywiscie dzieje, ale na pewno nie wyswietla mi sie zadne okno wyboru jak napisano tutaj

"One last useful hint before we move on: you can pass -1 to cvCreateCameraCapture(), which will cause OpenCV to open a window that allows you to select the desired camera."

Dalej

"For the former, this is just an identification number that is zero (0) when we only have one camera, and increments upward when there are multiple cameras on the same ystem."

ja mam wlasnie dwie kamery podlaczone do kompa i jak wstawie cos powyzej 0 w miejsce indexu kamery to sie nie wlacza program.

Wiec problem uwazam dalej za nie rozwiazany, aha moje wszystkie kamery sa podpiete pod USB

1 użytkowników online, w tym zalogowanych: 0, gości: 1