PureBasic Interface to OpenCV

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
bbanelli
Enthusiast
Enthusiast
Posts: 543
Joined: Tue May 28, 2013 10:51 pm
Location: Europe
Contact:

Re: PureBasic Interface to OpenCV

Post by bbanelli »

JHPJHP is live and kicking!!! :) :) :)

Thank you so much for maintenance!

Bruno
"If you lie to the compiler, it will get its revenge."
Henry Spencer
https://www.pci-z.com/
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi bbanelli,

Thank you for your kind words.
bbanelli wrote:Thank you so much for maintenance!
I am again feeling the coding bug, and maintenance was just the thing to clear out the cobwebs.

I've just posted a new OpenCV plus application, that will capture and record a users window actions to an AVI video file: Record Window
- can also be configured as a PureBasic Tool

Cheers!
AAT
Enthusiast
Enthusiast
Posts: 256
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV

Post by AAT »

JHPJHP, Merry Christmas!
I wish you health, good luck and new interesting projects!
:D
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi AAT,
AAT wrote:JHPJHP, Merry Christmas!
I wish you health, good luck and new interesting projects!
Thank you my friend.

Have a very Merry Christmas and a Happy New Year.

NB*: I will probably just continue creating small applications around the OpenCV interface; there are so many possibilities.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Updated:
- added back the Microsoft Visual C++ Runtime Libraries to the various Windows packages
-- originally suggested by acreis in this post

cvCreateVideoWriter Windows examples now set to use the XVID codec.
- install: only the DIVX option is required
- START > XVID > Encoder Config > Other Options... > Display encoding status (remove checkbox)

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

Removed DPI Awareness functions from the Windows packages.
- switched to Windows API instead of using PureBasic's built-in ExamineDesktops

NB*: Multiple global find/replace calls were performed with limited testing; please report any problems.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Michael Vogel,

Question taken from this post: viewtopic.php?p=534605#p534605
Michael Vogel wrote:Seems that the OpenCV libraries are doing a lot of stuff...

Some days ago I started to write a simple stretch function to be used as an external program for the Faststone Viewer to correct the perspective of photos. It uses the magick library (parameter -distort Perspective) for now but the lib is very large for this tiny stuff...

...can you tell me how to do a simple stretch for calculating a trapezium to a rectangle (or vice versa)?
Download the following OpenCV package from my website: OpenCV_2.4.13.6_WIN_32_SRC_(main)
- obviously the entire interface isn't necessary, but that can be worked out later if you decide to go the OpenCV route

See the following examples:
- cv_warpperspective_1.pb, cv_warpperspective_2.pb

This should get you started, but if you need additional help please don't hesitate to post back.
User avatar
Michael Vogel
Addict
Addict
Posts: 2663
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: PureBasic Interface to OpenCV

Post by Michael Vogel »

Cool JHPJHP, will take a look at this very soon :wink:
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

PureBasic Interface to OpenCV

Post by JHPJHP »

Updated (Linux Packages):
- fixed a path problem
- fixed the webcam examples
- fixed window close event

Path Problem
After updating to Ubuntu 18.04.2 LTS (Bionic Beaver) none of the examples worked.

Webcam Examples
Before today I did not have a fully functional (VMWare) webcam; testing the webcam examples was non-existent.

Window Close Event
Programmatically closing one window to open another would exit the main loop.

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

Updated:
- patched the webcam examples (all packages)

Webcam Examples
I was trying to force a size restriction, not taking into account the scale factor.
Changed the way the webcam is attached; while working with two webcams I noticed a problem.
Mesa
Enthusiast
Enthusiast
Posts: 342
Joined: Fri Feb 24, 2012 10:19 am

Re: PureBasic Interface to OpenCV

Post by Mesa »

Hi,

It's about your Tesseract example.

When i compile the cv_OCR_confidence.pb file, everything works fine.
But when i want to use the french language, i've got an error.

I downloaded the "fra.traineddata" from github (https://github.com/tesseract-ocr/tesser ... Data-Files) in the "ocr\binaries\tesseract\tessdata\" path

I changed the line

Code: Select all

"hAPI = TesseractInit(#PSM_AUTO, #OEM_TESSERACT_ONLY, #PB_Compiler_FilePath + "binaries/tesseract/tessdata/", "eng", #Null$)"
into

Code: Select all

"hAPI = TesseractInit(#PSM_AUTO, #OEM_TESSERACT_ONLY, #PB_Compiler_FilePath + "binaries/tesseract/tessdata/", "fra", #Null$)"
and the compiler displays an invalid memory access in the line

Code: Select all

" If TessBaseAPIInit1(hAPI, dictionarypath, language, OEM, @CFG, 1) : TessBaseAPIEnd(hAPI) : Else : ProcedureReturn hAPI : EndIf"
in the pb_tesseract.pb file

An idea, to change the language ?

Thanks.

Mesa.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Mesa,

I believe this is the same issue Morty posted awhile back...

… The memory access error is due to an incompatible traineddata version; download the required language file from the following link: Data Files for Version 3.02

NB*: Another option is to replace the binaries with the current version, but then you might have to update parts of the code.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: PureBasic Interface to OpenCV

Post by collectordave »

May Have been answered.

Can the opencv interface be used with the MAC?

For example the canny edge detection?

CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
AAT
Enthusiast
Enthusiast
Posts: 256
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV

Post by AAT »

Hi, collectordave.
You should read the first post in this thread, download OpenCV_2.4.13.6_OSX_64_SRC_(main).zip from JHPJHP's My PureBasic Stuff and voila - you have get cv_canny.pb example.
It is very simple, right? :wink:
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: PureBasic Interface to OpenCV

Post by collectordave »

Hi AAT

I have read the first post and have downloaded the CV_Canny.pb which does not run on my MAC.

Sorry the question still stands.

Can OpenCV be used on the MAC?
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
AAT
Enthusiast
Enthusiast
Posts: 256
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV

Post by AAT »

Hi, collectordave
I have read the first post and have downloaded the CV_Canny.pb which does not run on my MAC.
Are you downloaded only CV_Canny.pb ?
You need to download and install the entire package. For everything to work properly, libraries and function prototypes are needed.
collectordave wrote:Can OpenCV be used on the MAC?
I think you can use opencv on the MAC.
Read these articles https://www.learnopencv.com/?s=mac+os

I use Windows, so I can't give advice on installing opencv on Mac OS.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi AAT (my friend),

Sorry, I should have responded to your last/deleted post before now, but I was formulating an idea for a simple OpenCV program based on this post by netmaestro, and wanted to get your thoughts.

See the following two examples as the base for my idea (should make the return of Vector Curves that much easier):
- cv_approxpoly_1.pb (one of our first joint examples)
- cv_bezier_curve.pb

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

Updated:
- modified the webcam examples in all packages (Windows, Linux, OSX)
Locked