Page 29 of 60
Re: PureBasic Interface to OpenCV
Posted: Wed Jun 03, 2015 1:25 pm
by AAT
Hi, JHPJHP!
Thank you for a great job!
I tried to build my program with openCV3: it is not working...
The problem with using h264 encoding in ffmpeg module is not resolved.

I think that I'm not going to use version 3 yet.
Good luck!
Re: PureBasic Interface to OpenCV
Posted: Wed Jun 03, 2015 10:21 pm
by JHPJHP
Hi AAT,
Thank you.
It's not easy to move forward when the OpenCV community has pretty much dropped their C support.
- I posted a question on their forum, and because it referenced the C interface it wasn't well received
- I also sent three emails with support questions, all unanswered
I've updated the original 32bit and 64bit downloads with various bug fixes.
- included: global find / replace modifying the Procedure CvMouseCallback (x / y parameters)
Re: PureBasic Interface to OpenCV
Posted: Thu Jun 04, 2015 1:16 pm
by AAT
Hi JHPJHP!
I downloaded your new pack, thanks.
I will try to build my program with opencv3 one more time.
Re: PureBasic Interface to OpenCV
Posted: Thu Jun 04, 2015 11:58 pm
by JHPJHP
Hi AAT,
OpenCV 3.0 Gold came out yesterday, so you may want to test your program using the new binaries.
I replaced the binaries from the OpenCV 3.0 test interface with the new ones, but the previous problems are still present.
I sent another couple emails to OpenCV admin (no response):
... I’ve tested OpenCV 3.0 Gold, and the following issues are still present:
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
function: cvHoughLines2 (option: CV_HOUGH_STANDARD)
- x86: CvSeq Structure: field [ total ] returns 0 (crashes the interface)
- x64: CvSeq Structure: field [ total ] returns 0
(option: CV_HOUGH_PROBABILISTIC returns the correct result for x86 / x64)
Can you please let me know if the legacy binaries will be included in a future release.
NB*: I've also applied a few small bug fixes to the existing downloads.
Re: PureBasic Interface to OpenCV
Posted: Fri Jun 05, 2015 10:15 pm
by chris319
I haven't had time to fool around with OpenCV lately. I've been trying to track down the source of color errors in compressed video, particularly the ffmpeg implementation of webm/VP8/VP9. That will likely be an uphill battle, so I may come back to OpenCV if the color work goes nowhere.
The link in the previous post returns a 401 error.
Re: PureBasic Interface to OpenCV
Posted: Fri Jun 05, 2015 10:51 pm
by JHPJHP
Hi chris319,
Sorry about the 401 error, I thought I could get away with a few quick updates...
With all the things I've tried to get "OpenCV 3.0 Gold" working with PureBasic, I've found and applied some basic bug fixes to the test package and the original downloads.
Cheers.
Re: PureBasic Interface to OpenCV
Posted: Sat Jun 06, 2015 5:15 am
by chris319
JHPJHP: I looked at the OpenCV library routine that you suggested to clip webcam video -- I believe it is called threshold. I saw nothing in it that would accomplish what I need, which is simply -- if sample > 254: sample = 254: elseif sample < 1: sample = 1.
Thank you for suggesting it, though.
Re: PureBasic Interface to OpenCV
Posted: Sat Jun 06, 2015 5:34 am
by JHPJHP
Hi chris319,
Sorry - I may have misunderstood your requirements:
JHPJHP wrote:The following may be what you're looking for:
cvCvtColor
-
additional information
See the example: cv_cvtcolor.pb
- hit the spacebar until the heading reads "XYZ"
My response was in reference to Color Space Rec.709:
chris319 wrote:In high-end video, Rec.709 specifies that digital code 16 shall be reference black, with codes 1 to 15 acting as "footroom". Digital code 235 shall be reference white, with codes 236 to 254 acting as "headroom". Codes 0 and 255 are used as sync and are not allowed.
- cvtColor:
Converts an image from one color space to another.
- cvMixChannels:
Copies specified channels from input arrays to the specified channels of output arrays.
From the above links:
-
RGB <--> CIE XYZ.Rec 709 with D65 white point ( CV_BGR2XYZ, CV_RGB2XYZ, CV_XYZ2BGR, CV_XYZ2RGB )
Re: PureBasic Interface to OpenCV
Posted: Sat Jun 06, 2015 8:26 am
by chris319
Thanks, but I can convert the color space with PB code. I create a BT.709 "Y" signal from RGB in PB for my "scope" display.
Re: PureBasic Interface to OpenCV
Posted: Mon Jun 08, 2015 12:21 pm
by JHPJHP
Updated (x86 / x64):
- added Structures and Prototypes
-- updated all the camera examples with the CvCapture Structure
- updated the example: cv_overlay_1.pb
- updated all the pb_* examples, most notably: pb_cam_resolution.pb
-- fixed an issue with AAT's example: pb_cam_preferences.pb
(the example originally worked, but stopped working after I made some format changes)
NB*: Various other bug fixes have been applied to both interfaces.
Re: PureBasic Interface to OpenCV
Posted: Mon Jun 08, 2015 2:01 pm
by AAT
Hi, JHPJHP!
Thanks again!
Your last addition in structures... Where you found this one?
Is this addition actual for older versions opencv?
And does this addition correct "black screen" error in Windows 8?
Re: PureBasic Interface to OpenCV
Posted: Mon Jun 08, 2015 7:54 pm
by JHPJHP
Hi AAT,
The new Structures / Prototypes were declared using older documentation referencing the C interface, but the following quote is from the latest "OpenCV Reference Manual".
Note: In C API the black-box structure CvCapture is used instead of VideoCapture.
NB*: The CvCapture Structure does not have a public interface and is used only as a parameter for video capturing functions.
Webcam Examples
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.
*** I mistakenly left out the [ count.l ] field in the Structure declaration, it has now been corrected in both interfaces ***
Code: Select all
/***************************** CvCapture structure ******************************/
#define CV_CAPTURE_BASE_API_COUNT 6
typedef void (CV_CDECL* CvCaptureCloseFunc) ( CvCapture* capture );
typedef int (CV_CDECL* CvCaptureGrabFrameFunc) ( CvCapture* capture );
typedef IplImage * (CV_CDECL* CvCaptureRetrieveFrameFunc) ( CvCapture* capture );
typedef double (CV_CDECL* CvCaptureGetPropertyFunc) ( CvCapture* capture, int id );
typedef int (CV_CDECL* CvCaptureSetPropertyFunc) ( CvCapture* capture,
int id, double value );
typedef const char * (CV_CDECL* CvCaptureGetDescriptionFunc)( CvCapture* capture );
typedef struct CvCaptureVTable
{
int count;
CvCaptureCloseFunc close;
CvCaptureGrabFrameFunc grab_frame;
CvCaptureRetrieveFrameFunc retrieve_frame;
CvCaptureGetPropertyFunc get_property;
CvCaptureSetPropertyFunc set_property;
CvCaptureGetDescriptionFunc get_description;
}
CvCaptureVTable;
typedef struct CvCapture
{
CvCaptureVTable* vtable;
}
CvCapture;
Re: PureBasic Interface to OpenCV
Posted: Mon Jun 08, 2015 7:54 pm
by JHPJHP
[ REMOVED ] : duplicate post.
Re: PureBasic Interface to OpenCV
Posted: Mon Jun 08, 2015 10:41 pm
by bbanelli
Hi JHPJHP,
I've just downloaded latest files from your first post, tried resolution example and it lacks definition in line 3
But am I missing something, since I don't see v3.0 link any longer?
Re: PureBasic Interface to OpenCV
Posted: Mon Jun 08, 2015 11:03 pm
by JHPJHP
Hi bbanelli,
Thank you for the information, I've updated the x86 / x64 interfaces.
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
- function: cvHoughLines2 (option: CV_HOUGH_STANDARD)
-- x86: CvSeq Structure: field [ total ] returns 0 (crashes the interface)
-- x64: CvSeq Structure: field [ total ] returns 0
- legacy binaries not included