PureBasic Interface to OpenCV
Re: PureBasic Interface to OpenCV
Hi wilbert,
I agree, for now there are enough OSX examples to get started, but at some point I'll convert more to showcase the other aspects of OpenCV; the Windows interface includes 235 examples.
-----------------------------------------------------------
Updated the Windows interface:
- renamed 1 example
-- cv_emboss_2.pb to cv_emboss_3.pb
- added 2 examples based on script found here
-- cv_emboss_2.pb: apply a raised or pressed embossed style effects to an image.
-- cv_folding.pb: transform an image to show a folding effect at a defined cycle
NB*: Updated other aspects of the interface, but nothing worth documenting.
I agree, for now there are enough OSX examples to get started, but at some point I'll convert more to showcase the other aspects of OpenCV; the Windows interface includes 235 examples.
-----------------------------------------------------------
Updated the Windows interface:
- renamed 1 example
-- cv_emboss_2.pb to cv_emboss_3.pb
- added 2 examples based on script found here
-- cv_emboss_2.pb: apply a raised or pressed embossed style effects to an image.
-- cv_folding.pb: transform an image to show a folding effect at a defined cycle
NB*: Updated other aspects of the interface, but nothing worth documenting.
Last edited by JHPJHP on Sat Jun 04, 2016 2:04 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
Sounds good to meJHPJHP wrote:for now there are enough OSX examples to get started, but at some point I'll convert more to showcase the other aspects of OpenCV

Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: PureBasic Interface to OpenCV
Updated both the OSX main interface and the OSX demo interface:
- CMake and patched a new set of libraries from the latest sources
-- replaced v2.4.12 with v2.4.13
--------------------------------------------------------
Updated both the Windows main interface and the Windows demo interface
- update includes the latest references and license file
- replaced v2.4.12 with v2.4.13
NB*: Repacked both OSX interfaces with the latest references and license file.
- CMake and patched a new set of libraries from the latest sources
-- replaced v2.4.12 with v2.4.13
--------------------------------------------------------
Updated both the Windows main interface and the Windows demo interface
- update includes the latest references and license file
- replaced v2.4.12 with v2.4.13
NB*: Repacked both OSX interfaces with the latest references and license file.
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
Was there any significant change from 2.4.12 to 2.4.13 ?JHPJHP wrote:replaced v2.4.12 with v2.4.13
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: PureBasic Interface to OpenCV
Hi wilbert,
That's a good question. I tried to find the change log for the new version, but it's not available yet. I can only assume improvements to speed and stability was the focus of this release. Bug-fixes are the primary concern for the 2.4.xx family releases, while the 3.x versions are dedicated to new functionality among other things.
To further test the OSX version I converted two more examples that use another aspect of OpenCV.
- cv_cam_chessboard_1.pb: after finding the positions of internal corners for a 10 x 7 chessboard pattern, a video is embedded using a warping algorithm
- cv_cam_chessboard_1.pb: finds the positions of internal corners for a 10 x 7 chessboard pattern. First calibrating the webcam, then drawing a transparent cube in 3D space
*** A tablet loaded with a URL of a chessboard pattern can be used to test the examples, or double-click the window to open a link to a printable image. ***
NB*: A fix has also been applied to the example le_delaunay_voronoi.pb, including various other changes.
That's a good question. I tried to find the change log for the new version, but it's not available yet. I can only assume improvements to speed and stability was the focus of this release. Bug-fixes are the primary concern for the 2.4.xx family releases, while the 3.x versions are dedicated to new functionality among other things.
To further test the OSX version I converted two more examples that use another aspect of OpenCV.
- cv_cam_chessboard_1.pb: after finding the positions of internal corners for a 10 x 7 chessboard pattern, a video is embedded using a warping algorithm
- cv_cam_chessboard_1.pb: finds the positions of internal corners for a 10 x 7 chessboard pattern. First calibrating the webcam, then drawing a transparent cube in 3D space
*** A tablet loaded with a URL of a chessboard pattern can be used to test the examples, or double-click the window to open a link to a printable image. ***
NB*: A fix has also been applied to the example le_delaunay_voronoi.pb, including various other changes.
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
Thanks anyway for the update and examplesJHPJHP wrote:I tried to find the change log for the new version, but it's not available yet.

Always good to have the latest stable version.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: PureBasic Interface to OpenCV
I had some time before the start of a new week...
Updated the main OSX interface:
- converted 2 examples
-- cv_cam_falling_balls.pb: falling balls game: try to stop the balls from reaching the bottom of the screen
-- cv_cam_zone_tracking.pb: calculates the weighted sum of the input image and the accumulator creating a silhouette effect, detecting objects found within one or more zones
Updated the main OSX interface:
- converted 2 examples
-- cv_cam_falling_balls.pb: falling balls game: try to stop the balls from reaching the bottom of the screen
-- cv_cam_zone_tracking.pb: calculates the weighted sum of the input image and the accumulator creating a silhouette effect, detecting objects found within one or more zones
Last edited by JHPJHP on Wed Jun 08, 2016 7:32 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
It's quite amazing how fast real time image analysis is.JHPJHP wrote:converted 2 examples
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: PureBasic Interface to OpenCV
Hi wilbert,
It's worth noting that the examples were written to showcase an effect not speed. There should be a lot of room to improve real time image analysis, pixel manipulation, etc.
Updated the OSX interface with another four examples converted from the Windows interface:
- cv_convexitydefects.pb: calculates the contour areas, finding the convex hull of point sets to convexity defects
- cv_detect_hand.pb: contour extraction and calculation is used to determine finger locations
- pb_gl_parametric_curve.pb: using OpenGL to display various parametric curves
- pb_gl_photo_cube.pb: using OpenGL and textures, multiple images are displayed onto the surfaces of a rotating cube
Due to a problem with Array sizes in OSX, the example pb_gl_parametric_curve.pb has been modified to stop building a geometric object when 6499 points has been reached.
- this could probably be addressed using a Map or List, but I'm more interested in a fix to the Array problem
I could not have said it better myself.wilbert wrote:It's quite amazing how fast real time image analysis is.
It's worth noting that the examples were written to showcase an effect not speed. There should be a lot of room to improve real time image analysis, pixel manipulation, etc.
Updated the OSX interface with another four examples converted from the Windows interface:
- cv_convexitydefects.pb: calculates the contour areas, finding the convex hull of point sets to convexity defects
- cv_detect_hand.pb: contour extraction and calculation is used to determine finger locations
- pb_gl_parametric_curve.pb: using OpenGL to display various parametric curves
- pb_gl_photo_cube.pb: using OpenGL and textures, multiple images are displayed onto the surfaces of a rotating cube
Due to a problem with Array sizes in OSX, the example pb_gl_parametric_curve.pb has been modified to stop building a geometric object when 6499 points has been reached.
- this could probably be addressed using a Map or List, but I'm more interested in a fix to the Array problem
Code: Select all
If n < 6499 : ReDim Point3D(n) : Else : Break : EndIf
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
Nice example.JHPJHP wrote:Due to a problem with Array sizes in OSX, the example pb_gl_parametric_curve.pb has been modified to stop building a geometric object when 6499 points has been reached.
- this could probably be addressed using a Map or List, but I'm more interested in a fix to the Array problemCode: Select all
If n < 6499 : ReDim Point3D(n) : Else : Break : EndIf

I'm pretty sure the Array problem is a PureBasic bug so maybe Fred can take a look at it.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: PureBasic Interface to OpenCV
Hi wilbert,
While putting together an example for the Bugs - Mac OSX forum, I believe I figured out how to avoid the error without limiting the array size, at least until the issue is fixed.
- I'll post my finding in the Bugs - Mac OSX forum to help Fred and team narrow down the problem
The main OSX interface has been updated.
- pb_gl_parametric_curve.pb is now working as designed
Thank you for the feedback...wilbert wrote:I'm pretty sure the Array problem is a PureBasic bug so maybe Fred can take a look at it.
While putting together an example for the Bugs - Mac OSX forum, I believe I figured out how to avoid the error without limiting the array size, at least until the issue is fixed.
- I'll post my finding in the Bugs - Mac OSX forum to help Fred and team narrow down the problem
The main OSX interface has been updated.
- pb_gl_parametric_curve.pb is now working as designed
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
Updated the OSX interface:
- converted 12 examples
-- cv_cam_effects.pb: pixel manipulation through direct memory access, demonstrating two webcam effects
-- cv_cam_pixelate.pb: pixelizes a webcam stream by averaging NxN block regions, and applying the color values to grid squares
-- cv_find_shapes.pb: approximates a polygonal curve(s) with the specified precision
-- cv_find_squares.pb: find squares in an image
-- cv_folding.pb: transform an image to show a folding effect at a defined cycle
-- cv_gamma.pb: Gamma Correction: The relationship between a pixels numerical value and its actual luminance
-- cv_motion_blur.pb: add a motion-blur filter to an image blurring in only one direction
-- cv_oil_painting.pb: create an oil painting effect applied to the loaded image
-- cv_pyrmeanshift.pb: performing the meanshift segmentation of an image, a cartoon effect is achieved
-- cv_retro.pb: retro-style photo effect done by adding noise to the luminance channel and reducing intensity of the chroma channels
-- cv_sepia.pb: convert a color image to sepia
-- cv_sharpen.pb: add an edge filter to an image giving it a sharpened effect
- converted 12 examples
-- cv_cam_effects.pb: pixel manipulation through direct memory access, demonstrating two webcam effects
-- cv_cam_pixelate.pb: pixelizes a webcam stream by averaging NxN block regions, and applying the color values to grid squares
-- cv_find_shapes.pb: approximates a polygonal curve(s) with the specified precision
-- cv_find_squares.pb: find squares in an image
-- cv_folding.pb: transform an image to show a folding effect at a defined cycle
-- cv_gamma.pb: Gamma Correction: The relationship between a pixels numerical value and its actual luminance
-- cv_motion_blur.pb: add a motion-blur filter to an image blurring in only one direction
-- cv_oil_painting.pb: create an oil painting effect applied to the loaded image
-- cv_pyrmeanshift.pb: performing the meanshift segmentation of an image, a cartoon effect is achieved
-- cv_retro.pb: retro-style photo effect done by adding noise to the luminance channel and reducing intensity of the chroma channels
-- cv_sepia.pb: convert a color image to sepia
-- cv_sharpen.pb: add an edge filter to an image giving it a sharpened effect
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
You've been busy !JHPJHP wrote:converted 12 examples
I think my favorite this time is the retro effect.
Looks very nice

Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: PureBasic Interface to OpenCV
Hi wilbert,
I keep meaning to take a break, but currently there is enjoyment revisiting the OpenCV examples, some created years ago.
Updated the OSX interface:
- converted 10 examples
-- cv_color_balance_1.pb: balance color by scaling the histogram of the RGB channels
-- cv_color_balance_2.pb: balance color by contrast stretching the RGB channels, or applying a normalize algorithm
-- cv_calcbackproject.pb: calculating the back projection of a histogram, frequent density values are displayed as bright pixels
-- cv_pseudo_colors.pb: augment an image with a set of predetermined colors
-- cv_cvtcolor.pb: converts an image from one color space to another
-- cv_watercolors.pb: apply a watercolor effect to an image using a recursive bilateral filter
-- cv_gabor_filter_1.pb: Gabor Filter: A linear filter used for edge detection
-- cv_gabor_filter_2.pb: Gabor Filter: A linear filter used for edge detection
-- cv_contours_1.pb: calculates the contour areas
-- cv_contours_2.pb: calculates the contour areas
NB*: The example cv_cvtcolor.pb converts an image to multiple color spaces using an OpenCV Function. I've recreated some of the color space algorithms using only PureBasic, which can be found in the following program: Spider Web Drawing.
I keep meaning to take a break, but currently there is enjoyment revisiting the OpenCV examples, some created years ago.
Updated the OSX interface:
- converted 10 examples
-- cv_color_balance_1.pb: balance color by scaling the histogram of the RGB channels
-- cv_color_balance_2.pb: balance color by contrast stretching the RGB channels, or applying a normalize algorithm
-- cv_calcbackproject.pb: calculating the back projection of a histogram, frequent density values are displayed as bright pixels
-- cv_pseudo_colors.pb: augment an image with a set of predetermined colors
-- cv_cvtcolor.pb: converts an image from one color space to another
-- cv_watercolors.pb: apply a watercolor effect to an image using a recursive bilateral filter
-- cv_gabor_filter_1.pb: Gabor Filter: A linear filter used for edge detection
-- cv_gabor_filter_2.pb: Gabor Filter: A linear filter used for edge detection
-- cv_contours_1.pb: calculates the contour areas
-- cv_contours_2.pb: calculates the contour areas
NB*: The example cv_cvtcolor.pb converts an image to multiple color spaces using an OpenCV Function. I've recreated some of the color space algorithms using only PureBasic, which can be found in the following program: Spider Web Drawing.
Last edited by JHPJHP on Thu Jun 09, 2016 7:49 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
If you enjoy it, that's goodJHPJHP wrote:I keep meaning to take a break, but currently there is enjoyment revisiting the OpenCV examples, some created years ago.

This time I'm mostly intrigued by the Gabor examples.
Never heard of it before.


Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)