PureBasic Interface to OpenCV

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: PureBasic Interface to OpenCV

Post by Caronte3D »

Hi JHPJHP!
Do you think is posible to reproduce the face recognition like on the following video with PB and your port of OpenCV?
I ask because... maybe we need some libraries more?
https://youtu.be/5yPeKQzCPdI
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Caronte3D,

See the following post: https://www.purebasic.fr/english/viewto ... 34#p515834

If you have any follow up questions, pleased don't hesitate to ask.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: PureBasic Interface to OpenCV

Post by Caronte3D »

Ok, I will try...
Already send you a donation and waiting info for download :wink:
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Caronte3D,

Thank you for your donation; please check your email for your access key.

You made a great suggestion awhile back concerning Death Star vs Asteroids, which was implemented shortly thereafter; OpenCV helped with the task.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: PureBasic Interface to OpenCV

Post by Caronte3D »

Well... sadly I don't think any of the current examples are remotely close to the example video I posted above and I doubt OpenCV can do it without other libraries :? Anyway, it's a good library and I'll use it for sure at some point.

I assumed that since the video example was so short, it would be easy to implement in PB.

Now I guess I'll have to use Python to recognize faces and then pass it to my PB program :(

Thanks by this library port anyway :wink:
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Caronte3D,

When you looked at the examples did you test cv_matchtemplate.pb :?:

After executing the example...
1. Press the Spacebar to find additional matches.
2. Press the enter key to change the default image.

Just this example alone, without any modifications, should meet most needs.

The example cv_webcam_haardetect_face.pb, calibrated for distance and lighting, could be used to capture the default (database) image and subsequent real-time images for comparison.

In addition, the example cv_norm.pb could be used to measure accuracy against a database of allowed faces, only allowing access if a minimum threshold was met.

And this was just off the top of my head using three of the existing examples :wink:
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: PureBasic Interface to OpenCV

Post by Caronte3D »

Maybe with much effort and many tests could be posible to detect some faces on a perfect scenario, but again, this is far from the realtime precission of the above example and with so few lines of code. Is sad none of the other two libraríes (Dlib & face_recognition) coulbe ported to PB, but one is C++ and the other is Python.

Don't worry JHPJHP, I will search another solution.

Tanks! :wink:
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Caronte3D,

Not to beat a dead dog, but...

I believe you're overestimating the video you posted and underestimating the examples I provided.
When you watch the video to the end you notice that lighting, distance, angle, etc. effects the accuracy.

The first part of the video where a couple still images are compared to a couple saved still images, is too basic an example to make an accurate determination about precision.

With very little effort and using the examples I previously listed, the exact speed and precision could be duplicated.

Anyways, I hope you find a solution better suited to your needs.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: PureBasic Interface to OpenCV

Post by Caronte3D »

I not only saw the video, I downloaded and compile the source code on my computer, then modified to compare my face (real-time) against 3000 more faces on a directory and the result was pretty awesome.

The OpenCV examples seems not using any neural network, or at least not one that should be trained, so I think the method show on the video is far more advanced.

Anyway, I will test again the examples you provided to figure out how to improbe.

Thanks by your time :wink:
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Caronte3D,

Thank you for looking at the examples, it was a pleasure communicating with you.

---------------------------------

Updated:
- added FREE binaries
- improved cv_video_scene_detection.pb

FREE Binaries
Includes 32 and 64 bit standalone demo examples.
- OpenCV Sepia.exe
- OpenCV Webcam.exe

cv_video_scene_detection.pb (original source)
A while ago I was contacted (and paid) by a forum member to include an SSIM Procedure, complimenting the already existing PSNR Procedure.
- SSIM: Structural Similarity Index Measure
- PSNR: Peak Signal-to-Noise Ratio

Enable Debug mode to display additional information.

NB*: Only the Windows packages have been updated; currently, I have no access to OSX and Linux.
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 627
Joined: Fri Dec 04, 2015 9:26 pm

Re: PureBasic Interface to OpenCV

Post by skinkairewalker »

Is it possible to detect events from the person's face? looking up, down, left side and etc, approaching the screen moving away and etc?
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi skinkairewalker,
skinkairewalker wrote:Is it possible to detect events from the person's face? looking up, down, left side and etc, approaching the screen moving away and etc?
While the newer (C++) versions of OpenCV support most if not all of the features you asked about, PureBasic Interface to OpenCV does not natively support them and would require a strong understanding of OpenCV, and advanced programming skills to include them, a lot of effort for a little return.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Updated:
- fixed some examples
- swapped runtime binaries
- improved a few examples

Seeing the repulsion example in the Tricks 'n' Tips forum reminded me of a very similar example I did in OpenCV: cv_repulsion_field.pb.

NOTE: Much of the same scripts were used for the stippling examples: cv_stippling.pb, cv_webcam_stippling.pb.

While reviewing other examples I was led down a path of testing where I found numerous issues, but only in the OpenCV_2.4.13.6_WIN_64_SRC_(main) package; probably a Windows 11 thing. With 250+ examples more testing still needs to be done, but that's for another day.

Runtime Binaries
During my testing craze I found that the Windows OCR examples require the Microsoft C Runtime Library version 110, whereas version 120 was included.

NOTE: The Windows Demo downloads still include version 120.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: PureBasic Interface to OpenCV

Post by Caronte3D »

Thank you for your efforts to keep everything up to date :wink:
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Caronte3D,

Sorry, I missed your post the first time around.
Caronte3D wrote:Thank you for your efforts to keep everything up to date
You're most welcome. It was a labor of love, and in doing so helped get the creative juices flowing.
Locked