PureBasic Interface to OpenCV
Re: PureBasic Interface to OpenCV ---- 05/30/14 04:30 PM
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!
- 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!
Last edited by JHPJHP on Sat May 31, 2014 1:45 pm, edited 2 times 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 ---- 05/30/14 04:30 PM
Hi, JHPJHP!
Thank you for your new examples!
Do you think it's necessary?
P.S. My congratulations to all, who read this topic: this is the 2^8 reply
Thank you for your new examples!
There is nothing new in version 5.30 that would change prototypes of OpenCV functions.updated the include files to work with the new release of PureBasic
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
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:
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
Last edited by JHPJHP on Mon Jun 09, 2014 1:11 am, edited 2 times 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 ---- 05/30/14 04:30 PM
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!
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
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.
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.
Last edited by JHPJHP on Mon Jun 09, 2014 1:14 am, edited 2 times 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 ---- 05/31/14 03:15 PM
Works like a charm now, thank you once again!!!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.
Re: PureBasic Interface to OpenCV ---- 05/31/14 03:15 PM
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.
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.
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 ---- 05/31/14 03:15 PM
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.

- 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.


Last edited by JHPJHP on Mon Jun 16, 2014 7:23 pm, 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 ---- 06/15/14 09:15 PM
thx JHPJHP and all other contributors for this really cool stuff.
Very very usefull!!!
Very very usefull!!!
SPAMINATOR NR.1
Re: PureBasic Interface to OpenCV ---- 06/15/14 09:15 PM
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
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)
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 ---- 07/06/14 08:00 AM
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.

- 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.

Last edited by JHPJHP on Sun Jul 06, 2014 4:09 pm, 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 ---- 07/06/14 08:00 AM
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!
Thanks alot, JHP!

Re: PureBasic Interface to OpenCV ---- 07/06/14 08:00 AM
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!
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!
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 ---- 07/06/14 08:00 AM
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
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
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.
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.
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.