PureBasic Interface to OpenCV
Re: PureBasic Interface to OpenCV
HI AAT,
Thank you for your new example, I've updated all the main packages to include it.
I am not sure if you noticed, but OpenCV has come out with a new update. I think I will procrastinate a little longer before updating to the latest version; rebuilding the binaries/libraries in all three OS is such a tedious process.
I hope this post finds you well
Thank you for your new example, I've updated all the main packages to include it.
I am not sure if you noticed, but OpenCV has come out with a new update. I think I will procrastinate a little longer before updating to the latest version; rebuilding the binaries/libraries in all three OS is such a tedious process.
I hope this post finds you well
Re: PureBasic Interface to OpenCV
Compiled and tested the new OpenCV 3.3 binaries without error, confirming compatibility with the existing interface; opted to keep a World build over separate files.
- OpenCV 2.4.13.3 will be compiled as separate binaries
NB*: This was not a straight build, various source files were modified to work with the C interface.
-----------------------------------------------------------
Updated the World packages:
- 32 & 64 bit Windows
-- binaries from v3.2 to v3.3
NB*: Reference files have also been updated.
- OpenCV 2.4.13.3 will be compiled as separate binaries
NB*: This was not a straight build, various source files were modified to work with the C interface.
-----------------------------------------------------------
Updated the World packages:
- 32 & 64 bit Windows
-- binaries from v3.2 to v3.3
NB*: Reference files have also been updated.
Re: PureBasic Interface to OpenCV
Thank you JHP!
I don't even pretend to know, how you get the energy to come up with all these updates.
also, great work on your website http://jhpjhp.x10host.com
Norm.
I don't even pretend to know, how you get the energy to come up with all these updates.
also, great work on your website http://jhpjhp.x10host.com
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Re: PureBasic Interface to OpenCV
Hi normeus,
Thank you sincerely for your post.
Lately I have found my motivation waning, but it's comments like yours that make continuing a little easier; I definitely need to put some additional time into finishing my website.
----------------------------------------------
Updated the Main & Demo Windows packages:
- 32 & 64 binaries from v2.4.13 to v2.4.13.3
NB*: Reference files have also been updated.
Thank you sincerely for your post.
Lately I have found my motivation waning, but it's comments like yours that make continuing a little easier; I definitely need to put some additional time into finishing my website.
----------------------------------------------
Updated the Main & Demo Windows packages:
- 32 & 64 binaries from v2.4.13 to v2.4.13.3
NB*: Reference files have also been updated.
Re: PureBasic Interface to OpenCV
Hello JHPJHP !JHPJHP wrote:Lately I have found my motivation waning, but it's comments like yours that make continuing a little easier; I definitely need to put some additional time into finishing my website.
Don't be fooled, I'm one among several people keeping an eye on your work. Maybe you've seen that I've tried to help chris319 on his webcam problem, bugging around with several C sources, and you know how it can be a nightmare. Your implementation is great, code is easy to use and read, and a must have for future applications. PureBasic with such capabilities is far easier than ANY language, including Python. Thank you again for all what you do !
Re: PureBasic Interface to OpenCV
Hi djes,
Thank you for your post.
I did noticed the good work you and AAT have been doing. It was nice to read that you figured out the Visual Studio problem, definitely a skillset worth having.
------------------------------------------------------------------
Updated the Main & Demo OSX packages:
- 64 bit libraries from v2.4.13 to v2.4.13.3
NB*: Reference files have also been updated.
Thank you for your post.
I did noticed the good work you and AAT have been doing. It was nice to read that you figured out the Visual Studio problem, definitely a skillset worth having.
------------------------------------------------------------------
Updated the Main & Demo OSX packages:
- 64 bit libraries from v2.4.13 to v2.4.13.3
NB*: Reference files have also been updated.
Re: PureBasic Interface to OpenCV
Yes, sure. In fact, I dislike C and Unix style, way too anarchic for me. It's working, ok, and it could be fun. But it's often ugly, and over complicated.
I was wondering if you're using sort of make tool to compile your projects, and if pb could not benefit from such a tool for larger projects.
I was wondering if you're using sort of make tool to compile your projects, and if pb could not benefit from such a tool for larger projects.
Re: PureBasic Interface to OpenCV
Hi djes,
Like you, for Windows I used CMake and Visual Studio, for Linux and OSX I used CMake and the built-in Make utility.
The only exception was for OSX; while working with wilbert I wrote a dylib patch tool, needed after the build process.
Other then that, and as you know, any text editor can be used to modify the C++ source files.
-------------------------------------------------
Updated the Main & Demo Linux packages:
- 64 bit libraries from v2.4.13 to v2.4.13.3
NB*: Reference files have also been updated.
Like you, for Windows I used CMake and Visual Studio, for Linux and OSX I used CMake and the built-in Make utility.
The only exception was for OSX; while working with wilbert I wrote a dylib patch tool, needed after the build process.
Other then that, and as you know, any text editor can be used to modify the C++ source files.
-------------------------------------------------
Updated the Main & Demo Linux packages:
- 64 bit libraries from v2.4.13 to v2.4.13.3
NB*: Reference files have also been updated.
Last edited by JHPJHP on Sat Sep 09, 2017 11:44 pm, edited 1 time in total.
Re: PureBasic Interface to OpenCV
Oh, I was not talking about C compilation (thank you anyway), but purebasic projects. For opencv, you have a lot of examples and I was wondering if you're just using standard tools...
Re: PureBasic Interface to OpenCV
Hi djes,
Whatever language I am coding in, I usually prefer the built-in editor; for PureBasic, nothing outside of the IDE, and I don't use the form designer.
All my include files are manually created, unless I am dealing with images, etc.
For most batch updates, I use TextCrawler Pro, otherwise I will write my own.
For anything web related my editor of choice is UltraEdit.
Whatever language I am coding in, I usually prefer the built-in editor; for PureBasic, nothing outside of the IDE, and I don't use the form designer.
All my include files are manually created, unless I am dealing with images, etc.
For most batch updates, I use TextCrawler Pro, otherwise I will write my own.
For anything web related my editor of choice is UltraEdit.
Re: PureBasic Interface to OpenCV
Ok, thank you ! I'm working the same way, with total commander for file and directory comparison.
Re: PureBasic Interface to OpenCV
Had some extra time so I created this example: ( of course there might already be an example of this )
It loads a JPG image, selects a section then it zooms back out to display the whole JPG on an AVI.
On video editing it is usually called the "Ken Burnes effect" and it is used to add "motion" to still photos.
save it as CV_Zoom_JHP.pb along with all the open cv examples and in compiler options set directories
to "binaries\" , the program will use \binaries\images\weight3.jpg as JPG and output /Videos/zoom.avi
it needs DIVX codec so if it does not run get the DIVX codec or change the codec to MSVC
[edit]
I downloaded the latest "OpenCV_Win32" JHP has at his site (Sept,29,2017). (OpenCV v2.4.13.3)
It loads a JPG image, selects a section then it zooms back out to display the whole JPG on an AVI.
On video editing it is usually called the "Ken Burnes effect" and it is used to add "motion" to still photos.
save it as CV_Zoom_JHP.pb along with all the open cv examples and in compiler options set directories
to "binaries\" , the program will use \binaries\images\weight3.jpg as JPG and output /Videos/zoom.avi
it needs DIVX codec so if it does not run get the DIVX codec or change the codec to MSVC
[edit]
I downloaded the latest "OpenCV_Win32" JHP has at his site (Sept,29,2017). (OpenCV v2.4.13.3)
Code: Select all
IncludeFile "includes/cv_functions.pbi"
;CV_Zoom_JHP.pb
Global *original.IplImage,*show.IplImage,*save.IplImage
Global zo_x=170,zo_y=80,zo_w=360,zo_h=300 ; section of picture to zoom from currently an e=mc2 eye
Global outputw=960,outputh=780,fps=30 ; final output dimentions of AVI file
#CV_WINDOW_NAME = "PureBasic Interface to OpenCV"
#CV_DESCRIPTION = "zooms on a jpg picture, Ken burns effect; saving it as an AVI movie"
#img = "images/weight3.jpg"
;LOAD IMAGE
If FileSize(#img)
Debug #img
Else
MessageRequester("Image not found","please verify image location")
End
EndIf
*writer = cvCreateVideoWriter("../Videos/zoom.avi", CV_FOURCC("D", "I", "V", "X"), fps,outputw,outputh, #True); create our 30 frames/s AVI container
*original = cvLoadImage(#img, #CV_LOAD_IMAGE_ANYDEPTH | #CV_LOAD_IMAGE_ANYCOLOR) ; Load image any size
*save = cvCreateImage(outputw, outputh, #IPL_DEPTH_8U, *original\nChannels) ; create image to our AVI dimentions
cvResize(*original, *save, #CV_INTER_AREA) ;resize original image to our AVI dimentions
cvSetImageROI(*save, zo_x, zo_y, zo_w, zo_h) ; select e=mc2 eye from now resized *save picture
*show = cvCreateImage(zo_w, zo_h, #IPL_DEPTH_8U, *original\nChannels) ;create a temp buffer to show a section of image
;CREATE first FRAME
cvcopy(*save, *show,#Null)
*nsave = cvCreateImage(outputw, outputh, #IPL_DEPTH_8U, *original\nChannels)
cvresize(*show,*nsave,#cv_INTER_AREA)
cvResetImageROI(*save)
cvReleaseImage(@*show)
;SAVE IMAGES TO AVI MOVIE
For i = 1 To 6*fps ; six seconds at 30 frames per second
; For j = 1 To 2 ; add this For Next loop to write 2 frames of the same picture to slow it down
cvWriteFrame(*writer, *nsave)
; Next
If roix >0 :roix=zo_x-i :EndIf ; decrease x until 0
If roiy >0 :roiy=zo_y-i :EndIf ; decrease y until 0
roiw=zo_w+(i*4) ; increase width
roih=zo_h+(i*4) ; increase height
If roiw > outputw: roiw = outputw:EndIf ;dont get bigger than our output width
If roih > outputh: roih = outputh:EndIf ; dont get bigger than our output height
cvSetImageROI(*save, roiy, roix, roiw, roih) ; set our ROI with new dimentions
*show = cvCreateImage(roiw, roih, #IPL_DEPTH_8U, *original\nChannels) ; create an image to copy to
cvcopy(*save, *show,#Null) ; copy ROI to new image
cvResetImageROI(*save) ;reset ROI
cvresize(*show,*nsave,#cv_INTER_AREA) ; copy this new section to full output
cvReleaseImage(@*show)
Next
cvReleaseVideoWriter(@*writer)
Last edited by normeus on Tue Oct 03, 2017 6:50 pm, edited 1 time in total.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Re: PureBasic Interface to OpenCV
normeus> Which version did you use ? I wonder because frame_size and size are now pointers.
JHPJHP> I wonder in the examples, like cv_video_writeframe.pb, line 63, where *frame_size memory is allocated ?
JHPJHP> I wonder in the examples, like cv_video_writeframe.pb, line 63, where *frame_size memory is allocated ?
Re: PureBasic Interface to OpenCV
I downloaded the latest "OpenCV_Win32" JHP has at his site (Sept,29,2017). (OpenCV v2.4.13.3)
I am using PB5.60x86
I saw examples using a pointer on the web. from docs on web:
Norm.
I am using PB5.60x86
I saw examples using a pointer on the web. from docs on web:
but, I looked at example "cv_video_writeframe.pb"C: CvVideoWriter* cvCreateVideoWriter(const char* filename, int fourcc, double fps, CvSize frame_size, int is_color=1 )
I based my example on JHP's example. I haven't looked at 64 bit OpenCV*writer.CvVideoWriter = cvCreateVideoWriter(sVideo, CV_FOURCC("D", "I", "V", "X"), fps, FrameWidth, FrameHeight, #True)
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Re: PureBasic Interface to OpenCV
Hi normeus, djes,
normeus is correct that the 32 bit version does not use a *pointer while the 64 bit version does.
- I have not yet tried your example, but I am looking forward to viewing the results
djes, in the 64-bit version I found that it was not necessary to allocate memory for the cvCreateVideoWriter, cvCreateImage, etc. Functions.
normeus is correct that the 32 bit version does not use a *pointer while the 64 bit version does.
- I have not yet tried your example, but I am looking forward to viewing the results
djes, in the 64-bit version I found that it was not necessary to allocate memory for the cvCreateVideoWriter, cvCreateImage, etc. Functions.