Can you tell why isn't cvCaptureFromCAM() available in libraries; should there be any difference anyway?JHPJHP wrote:I'm not currently releasing "PureBasic Interface to OpenCV 3.0" due to the following issues:
- function: cvCreateCameraCapture
-- either the option window opens with no options and cannot connect the webcam, or the webcam light indicates a connection, but a black screen is displayed
PureBasic Interface to OpenCV
Re: PureBasic Interface to OpenCV
Re: PureBasic Interface to OpenCV
Hi bbanelli,
cvCreateCameraCapture is the original C function from before OpenCV 2.1. With the transition to C++ cv.CaptureFromCAM was added. This was later replaced with cv2.VideoCapture.
- through the C interface we only have access to: cvCreateCameraCapture
The following declaration is included in the videoio_c.h (header) file.
Because my questions weren't well received by the OpenCV community, I tried emailing their admin department directly. After five unanswered emails the alternatives are:
- wait for a new release of OpenCV 3.0 +
- rebuild the binaries trying various options
- solve the problem (already spent a week of "trial and error")
- keep the interface at OpenCV 2.4.11
cvCreateCameraCapture is the original C function from before OpenCV 2.1. With the transition to C++ cv.CaptureFromCAM was added. This was later replaced with cv2.VideoCapture.
- through the C interface we only have access to: cvCreateCameraCapture
The following declaration is included in the videoio_c.h (header) file.
I believe the current issue with the function cvCreateCameraCapture is due to the way the "opencv_world300" binaries were built; missing vital options.#define cvCaptureFromCAM cvCreateCameraCapture
Because my questions weren't well received by the OpenCV community, I tried emailing their admin department directly. After five unanswered emails the alternatives are:
- wait for a new release of OpenCV 3.0 +
- rebuild the binaries trying various options
- solve the problem (already spent a week of "trial and error")
- keep the interface at OpenCV 2.4.11
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Re: PureBasic Interface to OpenCV
I've tried recompiling it several times and the best thing I've got were some artifacts on camera. Well, at least it was not completely dark.JHPJHP wrote:I believe the current issue with the function cvCreateCameraCapture is due to the way the "opencv_world300" binaries were built; missing vital options.
Because my questions weren't well received by the OpenCV community, I tried emailing their admin department directly. After five unanswered emails the alternatives are:
- wait for a new release of OpenCV 3.0 +
- rebuild the binaries trying various options
- solve the problem (already spent a week of "trial and error")
- keep the interface at OpenCV 2.4.11


I guess this is only C issue, since examples in C++ with camera work just fine...

Re: PureBasic Interface to OpenCV
Hi, JHPJHP
There is a black screen in the Windows7 64 bit, regardless of the 32- or 64-bit version of PureBasic that I used to build exe.
So, i think the "black screen" problem is in the Windows 64.
Hmm..., it is strange. I built the example "cv_cam_saveimage.pb" from folder "Pending" with openCV3.0 and there are no problems in WindowsXP 32 bit.JHPJHP wrote: During my tests Windows 8 has never produced a black-screen using the binaries up to and including OpenCV 2.4.11, while OpenCV 3.0 binaries produce a black-screen in all operating systems.
There is a black screen in the Windows7 64 bit, regardless of the 32- or 64-bit version of PureBasic that I used to build exe.
So, i think the "black screen" problem is in the Windows 64.
Re: PureBasic Interface to OpenCV
Hi bbanelli,
Thank you for testing the interface with rebuilt binaries, I thought for sure that an option was left unchecked when the default binaries were originally built.
Did you try with the following options: HAVE_VIDEOINPUT HAVE_DSHOW?
-------------------------------------------------------------
Hi AAT,
Thank you for the clarification that the webcam examples using the OpenCV 3.0 binaries are working in Windows XP 32 bit. I should have stated that my tests only included Windows 7, 8 64 bit.
(my Windows XP computer is not equipped with a webcam)
I took your lead and tested the example: cv_houghlines_2.pb in Windows XP, but it returned the same negative results.
Thank you for testing the interface with rebuilt binaries, I thought for sure that an option was left unchecked when the default binaries were originally built.
Did you try with the following options: HAVE_VIDEOINPUT HAVE_DSHOW?
Your support is very much appreciated.QUESTION: Why am I able to display pictures and play AVI files, but I'm not able to capture webcam images?
ANSWER: Recompile changing the "Preprocesser Definitions" in the C/C++ panel of the properties page to include: HAVE_VIDEOINPUT HAVE_DSHOW.
-------------------------------------------------------------
Hi AAT,
Thank you for the clarification that the webcam examples using the OpenCV 3.0 binaries are working in Windows XP 32 bit. I should have stated that my tests only included Windows 7, 8 64 bit.
(my Windows XP computer is not equipped with a webcam)
I took your lead and tested the example: cv_houghlines_2.pb in Windows XP, but it returned the same negative results.
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Re: PureBasic Interface to OpenCV
It didn't help, except I kept getting this kind of warnings.JHPJHP wrote:Hi bbanelli,
Thank you for testing the interface with rebuilt binaries, I thought for sure that an option was left unchecked when the default binaries were originally built.
Did you try with the following options: HAVE_VIDEOINPUT HAVE_DSHOW?Your support is very much appreciated.QUESTION: Why am I able to display pictures and play AVI files, but I'm not able to capture webcam images?
ANSWER: Recompile changing the "Preprocesser Definitions" in the C/C++ panel of the properties page to include: HAVE_VIDEOINPUT HAVE_DSHOW.
Code: Select all
11>D:\opencv-master\build\cvconfig.h(65): warning C4005: 'HAVE_DSHOW': macro redefinition (compiling source file ..\..\..\modules\core\src\alloc.cpp)
11> D:\opencv-master\build\cvconfig.h(65): note: command-line arguments: see previous definition of 'HAVE_DSHOW' (compiling source file ..\..\..\modules\core\src\alloc.cpp)
Re: PureBasic Interface to OpenCV
Hi bbanelli,
No need to modify the include-file: cv_functions.pbi.
- I've taken care of that
Included in the download is a simple script I wrote to parse out the "Import Functions": FormatFunctions.pb
- 1. choose the format file: cv_functions.pbi (OpenCV 2.4.11)
- 2. choose the parse file: cv_functions.pbi (OpenCV 3.0)
- 3. choose the location/filename to save the new include-file: cv_functions.pbi
NB*: FormatFunctions.pb only parses the "Import Functions" to the correct libraries, everything else is done manually.
If you have the time that would be great.bbanelli wrote:Perhaps I'll try rebuilding them without world module (so they would be separated DLL's ...
No need to modify the include-file: cv_functions.pbi.
- I've taken care of that
Included in the download is a simple script I wrote to parse out the "Import Functions": FormatFunctions.pb
- 1. choose the format file: cv_functions.pbi (OpenCV 2.4.11)
- 2. choose the parse file: cv_functions.pbi (OpenCV 3.0)
- 3. choose the location/filename to save the new include-file: cv_functions.pbi
NB*: FormatFunctions.pb only parses the "Import Functions" to the correct libraries, everything else is done manually.
Last edited by JHPJHP on Wed Jun 10, 2015 10:02 am, edited 1 time in total.
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Re: PureBasic Interface to OpenCV
Greetings JHPJHP,JHPJHP wrote:Hi bbanelli,
If you have the time that would be great.bbanelli wrote:Perhaps I'll try rebuilding them without world module (so they would be separated DLL's ...
No need to modify the include-file: cv_functions.pbi.
- I've taken care of that: OpenCV 3.0 Functions
Included in the download is a simple script I wrote to parse out the "Import Functions": FormatFunctions.pb
- 1. choose the format file: cv_functions.pbi (OpenCV 2.4.11)
- 2. choose the parse file: cv_functions.pbi (OpenCV 3.0)
- 3. choose the location/filename to save the new include-file: cv_functions.pbi
NB*: FormatFunctions.pb only parses the "Import Functions" to the correct libraries, everything else is done manually.
I had to move some functions to opencv_videoio300.lib and opencv_imgcodecs300.lib since they are no longer in opencv_highgui300.lib, but regardless, effect is the same - no video.

Re: PureBasic Interface to OpenCV
Hi!

I was wrong, the program doesn't work in windows7 32bit tooAAT wrote:So, i think the "black screen" problem is in the Windows 64.

Re: PureBasic Interface to OpenCV
Hi bbanelli,
Thank you for putting in the extra effort, I'm not sure what else can be done except wait for a new release and hope for the best.
------------------------------------------------------------
Hi AAT,
Thank you for the additional information.
------------------------------------------------------------
Since I wasn't getting anywhere asking for help from the OpenCV forum or by emailing their admin department, I decided to create a couple issue reports; feel free to add information.
- I purposely left the details vague to illicit a response, but maybe more information is better
-- cvCreateCameraCapture (Bug #4395) -- DONE
-- cvHoughLines2 (Bug #4396) -- CANCELLED
Thank you for putting in the extra effort, I'm not sure what else can be done except wait for a new release and hope for the best.
------------------------------------------------------------
Hi AAT,
Thank you for the additional information.
------------------------------------------------------------
Since I wasn't getting anywhere asking for help from the OpenCV forum or by emailing their admin department, I decided to create a couple issue reports; feel free to add information.
- I purposely left the details vague to illicit a response, but maybe more information is better
-- cvCreateCameraCapture (Bug #4395) -- DONE
-- cvHoughLines2 (Bug #4396) -- CANCELLED
Last edited by JHPJHP on Tue Jun 23, 2015 10:11 pm, edited 1 time in total.
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Re: PureBasic Interface to OpenCV
Hi AAT, bbanelli,
I've figured out the issue with OpenCV 3.0 and cvHoughLines2...
The Functions declaration has changed (imgproc_c.h).
I think I've also figured out the problem with the webcam examples...
While reviewing various header files and in the process of adding additional Constants, I came across the following information (highgui_c.h):
#CV_CAP_DSHOW = 700: I believe my previous assumption was correct, that the "world" binaries were built without the following options: HAVE_VIDEOINPUT HAVE_DSHOW.
- if either of you could test this would be very much appreciated, as I'm not currently equipped with the required software
I've figured out the issue with OpenCV 3.0 and cvHoughLines2...
The Functions declaration has changed (imgproc_c.h).
Code: Select all
OpenCV 2.4.11
- CVAPI(CvSeq*) cvHoughLines2( CvArr* image, void* line_storage, int method,
double rho, double theta, int threshold,
double param1 CV_DEFAULT(0), double param2 CV_DEFAULT(0));
OpenCV 3.0:
- CVAPI(CvSeq*) cvHoughLines2( CvArr* image, void* line_storage, int method,
double rho, double theta, int threshold,
double param1 CV_DEFAULT(0), double param2 CV_DEFAULT(0),
double min_theta CV_DEFAULT(0), double max_theta CV_DEFAULT(CV_PI));
While reviewing various header files and in the process of adding additional Constants, I came across the following information (highgui_c.h):
cvGetCaptureDomain(*capture): Running this Function against the working webcam examples (OpenCV 2.4.11) the return value was 700. When I ran the same function against the non-working webcam examples (OpenCV 3.0) the return value was 200./* start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*) */
#CV_CAP_DSHOW = 700: I believe my previous assumption was correct, that the "world" binaries were built without the following options: HAVE_VIDEOINPUT HAVE_DSHOW.
- if either of you could test this would be very much appreciated, as I'm not currently equipped with the required software
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Re: PureBasic Interface to OpenCV
Hi, JHPJHP
I tested the function cvGetCaptureDomain(*capture), it return:
700, openCV2.4.11, Windows XP 32-bit
200, openCV3, Windows XP -32 bit, Windows 7 64-bit.
It is strange, but it's a fact: the example cv_cam_saveimage.pb, compiled with openCV3, is working now in the Windows XP and in the Windows 7 64-bit (see my previous post http://www.purebasic.fr/english/viewtop ... 20#p466220) too.
I tested the function cvGetCaptureDomain(*capture), it return:
700, openCV2.4.11, Windows XP 32-bit
200, openCV3, Windows XP -32 bit, Windows 7 64-bit.
It is strange, but it's a fact: the example cv_cam_saveimage.pb, compiled with openCV3, is working now in the Windows XP and in the Windows 7 64-bit (see my previous post http://www.purebasic.fr/english/viewtop ... 20#p466220) too.
Re: PureBasic Interface to OpenCV
Hi AAT,
This can be explained:
- some computers will work some of the time if VFW is supported and can access the webcam
I know from previous work that VfW (Video for Windows) is not reliable in newer OS' especially 64bit versions. I believe by rebuilding the binaries with "DirectShow" (HAVE_VIDEOINPUT HAVE_DSHOW) the problem will be fixed.
Test this by forcing your webcam to use DirectShow (700):
- OpenCV 2.4.11: connects, OpenCV 3.0: fails
NB*: This was also the case in previous versions of OpenCV: https://rafaelbarreto.wordpress.com/201 ... t-working/.
This can be explained:
Take a look at the new Constants I've added, a return value of 200 means that the webcam is using "Video for Windows (#CV_CAP_VFW).ATT wrote:I tested the function cvGetCaptureDomain(*capture), it return:
700, openCV2.4.11, Windows XP 32-bit
200, openCV3, Windows XP -32 bit, Windows 7 64-bit.
...
- some computers will work some of the time if VFW is supported and can access the webcam
I know from previous work that VfW (Video for Windows) is not reliable in newer OS' especially 64bit versions. I believe by rebuilding the binaries with "DirectShow" (HAVE_VIDEOINPUT HAVE_DSHOW) the problem will be fixed.
Test this by forcing your webcam to use DirectShow (700):
- OpenCV 2.4.11: connects, OpenCV 3.0: fails
Code: Select all
*capture.CvCapture = cvCreateCameraCapture(#CV_CAP_DSHOW)
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Re: PureBasic Interface to OpenCV
Hi JHPJHP,
OpenCV3 connects only with #CV_CAP_VFW.
Can anybody to rebuild binaries with DirectShow enabled?
I tested and got the same results.JHPJHP wrote:Test this by forcing your webcam to use DirectShow (700):Code: Select all
*capture.CvCapture = cvCreateCameraCapture(#CV_CAP_DSHOW)
OpenCV3 connects only with #CV_CAP_VFW.
Can anybody to rebuild binaries with DirectShow enabled?
Re: PureBasic Interface to OpenCV
Hi
I got today new UVC web-camera module 1280*720 pix. It not connects with #CV_CAP_VFW, it connects only with #CV_CAP_DSHOW (Windows XP 32 bit, OpenCV2.4.11).
I got today new UVC web-camera module 1280*720 pix. It not connects with #CV_CAP_VFW, it connects only with #CV_CAP_DSHOW (Windows XP 32 bit, OpenCV2.4.11).