Page 18 of 60
Re: PureBasic Interface to OpenCV ---- 05/30/14 04:30 PM
Posted: Fri May 30, 2014 9:34 pm
by JHPJHP
Updated:
- updated cv_functions.pbi
-- added a CompilerIf statement to the IncludeFile locations to work with the new release of PureBasic
- added 3 examples
-- cv_enhance_detail.pb: enhance the details of an image
-- cv_smooth_edge.pb: smooth the edges of an image using a recursive filter
-- cv_stylization.pb: stylize an image by applying various filters
- added 6 images
Examples are based on the C++ blending scripts mentioned in a previous post.
Note: As with cv_pencil_sketch.pb, there are parameters for each of the new examples that will increase / decrease the intended effect.
NB*: Update also includes bug fixes and improvements to various examples including a fix to cv_transparent.pb for single channel images.
Cheers!
Re: PureBasic Interface to OpenCV ---- 05/30/14 04:30 PM
Posted: Sat May 31, 2014 10:59 am
by AAT
Hi, JHPJHP!
Thank you for your new examples!
updated the include files to work with the new release of PureBasic
There is nothing new in version 5.30 that would change prototypes of OpenCV functions.
Do you think it's necessary?
P.S. My congratulations to all, who read this topic: this is the 2^8 reply

Re: PureBasic Interface to OpenCV ---- 05/30/14 04:30 PM
Posted: Sat May 31, 2014 1:51 pm
by JHPJHP
Hi AAT,
You're welcome - I'm glad you like the new examples.
Prototypes were not changed, but the following bit of code was added:
Code: Select all
CompilerIf #PB_Compiler_Version < 530
IncludeFile "includes/cv_constants.pbi"
IncludeFile "includes/cv_structures.pbi"
IncludeFile "includes/cv_macros.pbi"
IncludePath "binaries"
CompilerElse
IncludeFile "cv_constants.pbi"
IncludeFile "cv_structures.pbi"
IncludeFile "cv_macros.pbi"
IncludePath "../binaries"
CompilerEndIf
Re: PureBasic Interface to OpenCV ---- 05/30/14 04:30 PM
Posted: Sat May 31, 2014 7:50 pm
by bbanelli
Greetings,
first of all, thank you so much for sharing this great code for PB!
All of your previous examples worked well for me, however, after downloading newest, I don't seem to be able to get it running.
I have followed instructions from readme.txt but it didn't help. PB 5.22 and W7 x64.
http://tinypic.com/r/2nu60b5/8
I have tried fiddling with paths but it didn't help. What am I doing wrong?
TIA!
Re: PureBasic Interface to OpenCV ---- 05/31/14 03:15 PM
Posted: Sat May 31, 2014 8:44 pm
by JHPJHP
Hi bbanelli,
You're welcome.
I fixed the issue reported in your previous post; I've also included some additional examples.
Enjoy.
------------------------------------------------
Updated:
- renamed 2 examples
-- cv_smooth_edge.pb to cv_smooth_edges_1.pb
-- cv_stylization.pb to cv_stylize_1.pb
- added 4 examples
-- cv_depth_of_field.pb: using a second image as a mask to compare against an object in the original image, depth of field is simulated
-- cv_enhance_edges.pb: enhance the edges of an image using various filters
-- cv_smooth_edges_2.pb: smooth the edges of an image using a normalized convolution filter
-- cv_stylize_2.pb: stylize an image by applying various filters
- updated 1 example
-- cv_norm.pb: using a default image, the absolute difference is calculated against a directory of images, returning the closest match
- added 4 images
Examples are based on the C++ blending scripts mentioned in a previous post, with the exception of cv_norm.pb.
Note:
- cv_enhance_edges.pb has an extra "SPACEBAR" option needed to view the full effect.
- cv_norm.pb
-- added an option to flip through all the images
-- added a smoothing filter (increased accuracy)
NB*: This completes the conversion of code created by
Siddharth Kherada to PureBasic.
Re: PureBasic Interface to OpenCV ---- 05/31/14 03:15 PM
Posted: Sat May 31, 2014 9:07 pm
by bbanelli
JHPJHP wrote:Hi bbanelli,
You're welcome.
I fixed the issue caused by the change I mage to IncludeFile - thank you for pointing it out; I've also included some additional examples.
Works like a charm now, thank you once again!!!
Re: PureBasic Interface to OpenCV ---- 05/31/14 03:15 PM
Posted: Mon Jun 09, 2014 9:43 pm
by JHPJHP
Various updates and bug fixes not worth documenting have been applied to the "PureBasic Interface to OpenCV" package, including an additional 4 images.
Some of the updated examples:
- cv_depth_of_field.pb
- cv_enhance_detail.pb
- cv_enhance_edges.pb
- cv_norm.pb
- cv_pencil_sketch.pb
- cv_smooth_edges_1.pb
- cv_smooth_edges_2.pb
- cv_stylize_1.pb
- cv_stylize_2.pb
- cv_template.pb
-- 4 images added
NB*: Thank you PureBasic team for an amazing product, that keeps getting better.
Re: PureBasic Interface to OpenCV ---- 05/31/14 03:15 PM
Posted: Mon Jun 16, 2014 2:34 am
by JHPJHP
Updated:
- added 1 example
-- cv_pseudo_colors.pb: augment an image with a set of predetermined colors
- added 4 images
Based on script found
here.
NB*: I'm pretty much finished with my OpenCV experiment, but from time to time I may add an example, taking a break from the workload.

Re: PureBasic Interface to OpenCV ---- 06/15/14 09:15 PM
Posted: Mon Jun 16, 2014 8:30 am
by Rings
thx JHPJHP and all other contributors for this really cool stuff.
Very very usefull!!!
Re: PureBasic Interface to OpenCV ---- 06/15/14 09:15 PM
Posted: Mon Jun 16, 2014 7:33 pm
by JHPJHP
Hi Rings,
You're welcome, and thank you for the kudos.
----------------------------------------
Added a small update to the example: cv_pseudo_colors.pb.
- added additional color map images
Note: Instead of using multiple color map images, a single image with multiple gradients could be used instead, by modifying the following lines of code:
- change the 1's to the X-coordinates of the new gradient colors, possibly applied every time the Spacebar is pressed
Code: Select all
cvGet2D(@scalar1, *B, color, 1)
cvGet2D(@scalar2, *G, color, 1)
cvGet2D(@scalar3, *R, color, 1)
Re: PureBasic Interface to OpenCV ---- 07/06/14 08:00 AM
Posted: Sun Jul 06, 2014 1:30 pm
by JHPJHP
Updated:
- added 1 example (jointly contributed by Shardik)
-- pb_cam_gl_cube.pb: using OpenGL and textures, the webcam interface is displayed onto the surfaces of a rotating cube
Because of the great new addition of OpenGL by the PureBasic team, and all the related code examples contributed by so many others, I was able to add this new example.
The majority of the OpenGL script came from this post:
http://www.purebasic.fr/english/viewtop ... 00#p446600.
~by Shardik.
NB*: Compatible with PureBasic 5.30 and above.

Re: PureBasic Interface to OpenCV ---- 07/06/14 08:00 AM
Posted: Sun Jul 06, 2014 3:44 pm
by Mythros
OMG! Is there a way you can add audio to it? Like even if the audio didn't come from OpenCV but like another library or something?
Thanks alot, JHP!

Re: PureBasic Interface to OpenCV ---- 07/06/14 08:00 AM
Posted: Sun Jul 06, 2014 11:44 pm
by JHPJHP
Hi Mythros,
I'm sorry, but like I've mentioned previously, audio is not something I plan on adding to the package.
As it stands this is a completed project, not to say that I won't add a new example from time to time, but I'm content that the "PureBasic Interface to OpenCV" is respectively covered.
-----------------------------------------
I've optimized the example: pb_cam_gl_cube.pb... nothing to do with improving Shardik code, I just rearranged how some of the functions were laid-out, resulting in a smoother effect.
Cheers!
Re: PureBasic Interface to OpenCV ---- 07/06/14 08:00 AM
Posted: Mon Jul 07, 2014 8:11 am
by applePi
thanks JHPJHP for merging OpenCV with OpenGL ,it seems very good, this is really unexpected achievement. i have thought of this a few weeks ago but hesitated to ask.
i have downloaded the latest OpenCV.zip. running pb_cam_gl_cube.pb but there is no output screen.
my system purebasic 5.30 beta 6 windows xp/32bit. i can run all opengl examples. and opencv examples except the "pb_cam_gl_cube.pb"
thanks for all your efforts
Re: PureBasic Interface to OpenCV ---- 07/06/14 08:00 AM
Posted: Mon Jul 07, 2014 8:25 am
by JHPJHP
Hi applePi,
Are you using PureBasic 5.30, the example pb_cam_gl_cube.pb utilizes it's latest features, also a webcam is required.
- no output (error information) usually indicates a problem connecting to the webcam; I didn't trap for that
NB*: I've only had the opportunity to test the example on Windows 7.