Page 44 of 60
Re: PureBasic Interface to OpenCV
Posted: Mon Jul 18, 2016 8:22 am
by wilbert
You're getting close to 200 JHPJHP
JHPJHP wrote:For the OSX build the SSE, SSE2, and SSE3 options were checked, I believe the same was true for the Windows binaries.
For OSX this would be correct. Every Intel based Mac supports SSE, SSE2 and SSE3.
JHPJHP wrote:pb_gl_cam_cube.pb & pb_gl_cam_invert.pb: needs some work due to the poor video quality.
There's something strange with the cube example on my computer.
With debug enabled it displays an error message; with debug disabled it runs but the sides that make up the cube are not connected to each other (gaps between them).
Re: PureBasic Interface to OpenCV
Posted: Tue Jul 19, 2016 12:08 am
by JHPJHP
Hi wilbert,
Getting close, I think they're only 30 - 40 examples left to convert.
The following examples in the OSX interface have been fixed:
- pb_gl_cam_cube.pb, pb_gl_cam_invert.pb
NB*: In the past few months the examples in the Windows interface have been updated with many bug-fixes and improvements.
Re: PureBasic Interface to OpenCV
Posted: Tue Jul 19, 2016 5:43 pm
by wilbert
JHPJHP wrote:The following examples in the OSX interface have been fixed:
- pb_gl_cam_cube.pb, pb_gl_cam_invert.pb
Working fine now

Re: PureBasic Interface to OpenCV
Posted: Wed Jul 20, 2016 1:08 am
by Lunasole
JHPJHP wrote:
Hi Lunasole,
For the OSX build the SSE, SSE2, and SSE3 options were checked, I believe the same was true for the Windows binaries.
Tnx for reply, should be problem with it. I wanted to try OpenCV in text recognizing from some images, but then anyway came up to making own build of Tesseract [used by OpenCV] to not bear whole OpenCV.
Re: PureBasic Interface to OpenCV
Posted: Fri Jul 22, 2016 7:03 pm
by JHPJHP
Updated the OSX interface:
- added 1 folder: default (templates to create examples)
-- aaa_cv_cam_default.pb
-- aaa_cv_default_1.pb
-- aaa_cv_default_2.pb
-- aaa_pb_cam_default.pb
NOTE: Copy the default template to the main example area before working on it.
NB*: Update also includes some bug-fixes and improvements to various examples.
Re: PureBasic Interface to OpenCV
Posted: Wed Jul 27, 2016 6:02 am
by JHPJHP
Hi wilbert,
wilbert wrote:You're getting close to 200 JHPJHP
Just about there, but I'm having trouble with the OpenCV function:
cvGetRectSubPix
- example:
cv_find_license_plate.pb (line: 298)
When you have some time can you please take a look at the example. Thank you.
Updated the OSX interface:
- converted 10 examples
--
cv_cam_undistort.pb: calibrate webcam with a 10 x 7 chessboard pattern, displaying the raw and undistorted images
--
cv_distortion_1.pb: distort a color image by manipulating pixel locations
--
cv_distortion_2.pb: distort a grayscale image by manipulating pixel locations
--
cv_disttransform_1.pb: calculates the distance to the closest zero pixel for each pixel of the source image
--
cv_disttransform_2.pb: calculates the distance to the closest zero pixel for each pixel in the image
--
cv_encode_decode.pb: encode / decode a 4 channel image where the black areas have been converted to transparency
--
cv_find_license_plate.pb: license plate recognition (experimental)
--
cv_find_speed_sign.pb: speed sign recognition (experimental)
--
cv_gaussian_laplacian.pb: a visual representation of a Gaussian and Laplacian Pyramid
--
cv_haar_transform.pb: implements a Haar wavelet transform, decomposing then reconstructing the image
Re: PureBasic Interface to OpenCV
Posted: Wed Jul 27, 2016 4:22 pm
by AAT
Hi, JHPJHP!
Here are two examples of how to access tesseract from openCV
http://rgho.st/7jdgjVmfd (90 days!)
-
cv_tesseract.pb -- using opencv image in tesseract
-
cv_cam_tesseract.pb -- webcam frame OCR
Dictionaries for various languages can be downloaded https://github.com/tesseract-ocr/tessdata
Enjoy!
P.S. Thanks, Lunasole!
http://www.purebasic.fr/english/viewtop ... 12&t=66231
Re: PureBasic Interface to OpenCV
Posted: Wed Jul 27, 2016 5:11 pm
by wilbert
Thanks for the examples JHPJHP
JHPJHP wrote:I'm having trouble with the OpenCV function: cvGetRectSubPix
- example: cv_find_license_plate.pb (line: 298)
The center coordinate (2x float) needs to be passed by register xmm0.
Two ways to accomplish this.
Code: Select all
cvGetRectSubPix(*src, *dst, center.d)
center.d
PokeF(@center, minRect\center\x) : PokeF(@center + 4, minRect\center\y)
cvGetRectSubPix(*rotated, *crop, center)
Code: Select all
cvGetRectSubPix(*src, *dst)
PokeF(@*center, minRect\center\x) : PokeF(@*center + 4, minRect\center\y)
!movq xmm0, [p.p_center]
cvGetRectSubPix(*rotated, *crop)
Re: PureBasic Interface to OpenCV
Posted: Wed Jul 27, 2016 9:35 pm
by JHPJHP
Hi AAT,
It is very good to hear from you
Thank you for posting a couple great examples using OpenCV and the Tesseract framework interfaced by
Lunasole.
- I'll add them to the Windows and OSX packages as soon as time permits
-----------------------------------------------------------------
Hi wilbert,
wilbert wrote:The center coordinate (2x float) needs to be passed by register xmm0.
I appreciate your patience repeating instructions you've previously covered. My only excuse for not catching it is that I'm fully engaged in another project.
The OSX interface has been updated with the fix provided by
wilbert.
- update also includes some minor improvements to various examples
NB*: The two examples
cv_find_license_plate.pb and
cv_find_speed_sign.pb (including others) were created by
AAT, which bears repeating considering the Tesseract examples he just posted.
Re: PureBasic Interface to OpenCV
Posted: Thu Jul 28, 2016 5:44 am
by wilbert
JHPJHP wrote:NB*: The two examples cv_find_license_plate.pb and cv_find_speed_sign.pb (including others) were created by AAT, which bears repeating considering the Tesseract examples he just posted.
They are interesting examples; recognizing things inside an image

Re: PureBasic Interface to OpenCV
Posted: Thu Jul 28, 2016 4:26 pm
by AAT
Hi, JHPJHP.
JHPJHP wrote:NB*: The two examples cv_find_license_plate.pb and cv_find_speed_sign.pb (including others) were created by AAT, which bears repeating considering the Tesseract examples he just posted.
Yes, it was my second thought - to add OCR to these examples (The first one was about my work

)
I do not have much free time, so made a quick example that needs to be improved in the future.
cv_find_speed_sign2.pb http://rgho.st/7TXt8g7Pn (90 days!)
= Update ===============
Improoved version of
cv_find_speed_sign2.pb and
cv_find_license_plate2.pb with OCR
http://rgho.st/8kfst4bry (90 days!)
Re: PureBasic Interface to OpenCV
Posted: Thu Aug 04, 2016 10:05 pm
by JHPJHP
Hi wilbert,
wilbert wrote:They are interesting examples; recognizing things inside an image
I agree, and when time permits I hope to build the Tesseract libraries for OSX.
---------------------------------------------------------------------------------------
Hi AAT,
Thank you again for the webcam and image OCR examples, and for updating
cv_find_license_plate.pb and
cv_find_speed_sign.pb with the Tesseract OCR engine.
-
NOTE: Tesseract OCR framework interfaced by
Lunasole
Updated the Windows 32bit OpenCV Interface(s):
- added include:
includes\pb_tesseract.pbi
- added folder:
binaries\tesseract\tessdata
--
eng.traineddata, whitelist.cfg
- added binaries:
binaries\liblept168.dll, libtesseract304.dll, libtesseract304.lib
The folder
binaries\tesseract includes the following files:
-
license.txt:
Apache 2.0 license
-
readme.txt:
written by Lunasole
---------------------------------------------------------------------------------------
Updated the Windows 32bit OpenCV Interface(s):
-
renamed 2 examples
--
cv_find_license_plate.pb to
cv_OCR_license_plate.pb
--
cv_find_speed_sign.pb to
cv_OCR_speed_sign.pb
-
added 2 examples
--
cv_cam_OCR_tesseract.pb: using Tesseract OCR (Optical Character Recognition) a section of a webcam frame is translated to text
--
cv_OCR_tesseract.pb: Using Tesseract OCR (Optical Character Recognition) an image of numbers is translated to text
NB*: Currently I don't have the time to find / build the 64bit binaries, so only the 32bit packages have been updated.
Re: PureBasic Interface to OpenCV
Posted: Fri Aug 05, 2016 6:32 am
by JHPJHP
Updated the OSX interface:
- converted 10 examples
--
cv_houghcircles.pb: finds circles in a grayscale image using the Hough transform
--
cv_houghlines_1.pb: finds lines in a binary image using the probabilistic Hough transform
--
cv_houghlines_2.pb: finds lines in a binary image using the standard Hough transform
--
cv_laplace.pb: calculates the Laplacian of an image
--
cv_logpolar.pb: remaps an image to log-polar space
--
cv_match_train.pb: creates a text file to later match contours against two image files containing numbers
--
cv_match_write.pb: tries to match contours learned from one image file containing numbers against another
--
cv_matchtemplate.pb: compares a template against overlapped image regions; matching one face against many faces
--
cv_maxrect.pb: finds a bounding rectangle for two given rectangles
--
cv_minarea_2.pb: finds the minimal area of a point set wrapping it in a triangle and a circle
cv_match_train.pb and
cv_match_write.pb was a basic attempt to create an "OCR" type effect.
-
binaries/trained/numbers.txt: learned file created using
cv_match_train.pb
- double-click
cv_match_write.pb to view the image converted to text
cv_minarea_2.pb is only partially working until I rebuild the OSX libraries to include additional script.
- see:
http://www.purebasic.fr/english/viewtop ... 26#p466626
Re: PureBasic Interface to OpenCV
Posted: Fri Aug 05, 2016 2:47 pm
by wilbert
JHPJHP wrote:cv_matchtemplate.pb: compares a template against overlapped image regions; matching one face against many faces
That works pretty well !

Nice work.
Re: PureBasic Interface to OpenCV
Posted: Sun Aug 07, 2016 3:50 am
by JHPJHP
Hi wilbert,
Thank you for your post, and for taking the time to test the examples.
- only 10 examples left to convert and the OSX interface is complete
Updated the OSX interface:
- converted 12 examples
-- cv_morphology.pb: performs advanced morphological transformations using a specific structuring element
-- cv_mov_houghcircles.pb: finds circles in grayscale image frames using the Hough transform on a movie file
-- cv_mov_writeframe.pb: draws text to a movie file and saves it as an AVI
-- cv_pb_cam_database.pb: captures and saves webcam frames to a database
-- cv_pb_font.pb: draw text using PureBasic commands with any font onto an OpenCV generated image
-- cv_pb_image_1.pb: formats a PureBasic image to work with OpenCV
-- cv_pb_image_2.pb: formats a PureBasic image to work with OpenCV
-- cv_precornerdetect_1.pb: calculates a feature map for corner detection
-- cv_precornerdetect_2.pb: calculates a feature map for corner detection
-- cv_steganography_image_1.pb: steganography is the practice of concealing a file
-- cv_steganography_image_2.pb: steganography is the practice of concealing a file
-- cv_steganography_text.pb: steganography is the practice of concealing a file
NB*: Added additional functionality to the example cv_pb_cam_database.pb; updated all packages.