get live film from a camera by ported usb or other
Re: get live film from a camera by ported usb or other
Yeaaaa, no thank you. I do NOT like C. I will stick with the languages I know & love, best! ^_^
Thanks anyway!
Anyways, be back in a few minutes. Gonna ATTEMPT to try the LIB.
Thanks anyway!
Anyways, be back in a few minutes. Gonna ATTEMPT to try the LIB.
Re: get live film from a camera by ported usb or other
Updated
- added popup menu to each example
- added custom icon to each example
- removed "styles" from each examples window
-- #WS_MAXIMIZEBOX | #WS_MINIMIZEBOX | #WS_SIZEBOX
- various bug fixes and updates
Cheers!
- added popup menu to each example
- added custom icon to each example
- removed "styles" from each examples window
-- #WS_MAXIMIZEBOX | #WS_MINIMIZEBOX | #WS_SIZEBOX
- various bug fixes and updates
Cheers!
Last edited by JHPJHP on Sat Nov 02, 2013 3:54 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: get live film from a camera by ported usb or other
@JHP, Can you add the 3D plot system that Python allows for?
I've been testing ALOT, and so far, all of your lib upgrades for OpenCV have worked! =D
I've been testing ALOT, and so far, all of your lib upgrades for OpenCV have worked! =D
Re: get live film from a camera by ported usb or other
Hi Mythros,
I won't be able to proceed any further with the OpenCV development - sorry. I only took a crack at it to break up the monotony of the current projects I'm working on. I may from time to time add some functionality, but it will be sporadic at best. If you decide to take up the challenge and have any questions, post your code and I or the numerous PureBasic contributors will try to help as best we can.
Had the following changes already in the works
- updated the canny.pb example to include auto-threshold
- updated the examples to include an additional popup menu item
-- capture.pb, captureall.pb, video.pb: Capture / Pause - Exit
--- capture.pb, captureall.pb: opens paused
--- video.pb: opens capturing
-- canny.pb, flip.pb, gray.pb, swap1.pb, swap2.pb: Open - Exit
-- show.pb: Exit
JHPJHP
I won't be able to proceed any further with the OpenCV development - sorry. I only took a crack at it to break up the monotony of the current projects I'm working on. I may from time to time add some functionality, but it will be sporadic at best. If you decide to take up the challenge and have any questions, post your code and I or the numerous PureBasic contributors will try to help as best we can.
Had the following changes already in the works
- updated the canny.pb example to include auto-threshold
- updated the examples to include an additional popup menu item
-- capture.pb, captureall.pb, video.pb: Capture / Pause - Exit
--- capture.pb, captureall.pb: opens paused
--- video.pb: opens capturing
-- canny.pb, flip.pb, gray.pb, swap1.pb, swap2.pb: Open - Exit
-- show.pb: Exit
JHPJHP
Last edited by JHPJHP on Sat Nov 02, 2013 10:50 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: get live film from a camera by ported usb or other
JHP, thank you very much for your hard work!
Your set of OpenCV libraries will work in Windows Vista or in Windows 7.
For Windows XP 32 bit (like me)a set of libraries for MS Visual C 10 is required:
http://rghost.ru/49883548 - 14 days
or
http://www.fileswap.com/dl/USpJnxIp4/
Your set of OpenCV libraries will work in Windows Vista or in Windows 7.
For Windows XP 32 bit (like me)a set of libraries for MS Visual C 10 is required:
http://rghost.ru/49883548 - 14 days
or
http://www.fileswap.com/dl/USpJnxIp4/
Re: get live film from a camera by ported usb or other
Thanks AAT - I appreciate the Kudos... and the additional DLL's for XP support.
You started the ball rolling: http://www.purebasic.fr/english/viewtop ... 12&t=48212
------------------------------------
The following example (embedded.pb), the new DLL's, and some minor changes have been included in the download.
Embedded the OpenCV video into a PureBasic window in the following stripped down example (this seemed a must before signing off):
- updated to include the Canny effect via toggle button
Cheers!

------------------------------------
The following example (embedded.pb), the new DLL's, and some minor changes have been included in the download.
Embedded the OpenCV video into a PureBasic window in the following stripped down example (this seemed a must before signing off):
- updated to include the Canny effect via toggle button
Code: Select all
IncludeFile "opencv.pbi"
Repeat
nCreate + 1
*capture = cvCreateCameraCapture(0)
Delay(500)
Until nCreate = 5 Or *capture
If *capture
*image.IplImage
*edges.IplImage
cvNamedWindow(#CV_WINDOW_NAME, #CV_WINDOW_DEFAULT)
cvMoveWindow(#CV_WINDOW_NAME, -1000, -1000)
cvResizeWindow(#CV_WINDOW_NAME, 640, 480)
window_handle = cvGetWindowHandle(#CV_WINDOW_NAME)
hWnd = GetParent_(window_handle)
ShowWindow_(hWnd, #SW_HIDE)
If OpenWindow(0, 0, 0, 640, 540, "Embedded Webcam", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SetParent_(window_handle, WindowID(0))
ButtonGadget(0, 10, 490, 620, 40, "Toggle to change the webcam view between Normal and Canny effect", #PB_Button_Toggle)
Repeat
*image = cvQueryFrame(*capture)
If *image
If GetGadgetState(0)
*edges = cvCreateImage(*image\width, *image\height, #IPL_DEPTH_8U, 1)
cvCvtColor(*image, *edges, #CV_BGR2GRAY, 1)
threshold.d = cvThreshold(*edges, *edges, 0, 255, #CV_THRESH_BINARY + #CV_THRESH_OTSU)
cvCanny(*image, *edges, threshold * 0.5, threshold, 3, #False)
Else
*edges = *image
EndIf
If *edges
cvShowImage(#CV_WINDOW_NAME, *edges)
cvWaitKey(1)
EndIf
EndIf
Until WindowEvent() = #PB_Event_CloseWindow
EndIf
cvDestroyWindow(#CV_WINDOW_NAME)
cvReleaseCapture(@*capture)
cvReleaseImage(@*edges)
cvReleaseImage(@*image)
EndIf
CloseLibrary(highgui246)
Last edited by JHPJHP on Sun Nov 03, 2013 8:13 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: get live film from a camera by ported usb or other
Exellent!
Now it's possible to use standard menus in OpenCV apps or to insert live video with effects in other pb programs.
Thanks!
P.S. What about changing (switching) real video resolutions?
I can't set resolution to 1280*1024 for my webcam with VfW but it's possible in amcap.exe (DirectShow)
Good luck!
Now it's possible to use standard menus in OpenCV apps or to insert live video with effects in other pb programs.
Thanks!
P.S. What about changing (switching) real video resolutions?
I can't set resolution to 1280*1024 for my webcam with VfW but it's possible in amcap.exe (DirectShow)

Good luck!
Re: get live film from a camera by ported usb or other
Hi AAT,
Setting the resolution can be done via cvSetCaptureProperty
- added cvSetCaptureProperty & cvGetCaptureProperty to opencv.pbi
Updated: opencv.pbi
- added cvSmooth effect
-- changed embedded.pb
--- cvSmooth currently set for #CV_BLUR
Things to consider when setting the resolution
- your webcam's supported resolutions
- window size (OpenCV & PureBasic)
-- cvResizeWindow(#CV_WINDOW_NAME, 640, 480)
- instead of testing the max. size - try a lower resolution to prove that it's working
- cvNamedWindow supports two settings
-- #CV_WINDOW_DEFAULT
-- #CV_WINDOW_AUTOSIZE
NB*: Even if your webcam only supports 640x480 you can still stretch the window to what ever size you like.
Setting the resolution can be done via cvSetCaptureProperty
- added cvSetCaptureProperty & cvGetCaptureProperty to opencv.pbi
Updated: opencv.pbi
- added cvSmooth effect
-- changed embedded.pb
--- cvSmooth currently set for #CV_BLUR
Things to consider when setting the resolution
- your webcam's supported resolutions
- window size (OpenCV & PureBasic)
-- cvResizeWindow(#CV_WINDOW_NAME, 640, 480)
- instead of testing the max. size - try a lower resolution to prove that it's working
- cvNamedWindow supports two settings
-- #CV_WINDOW_DEFAULT
-- #CV_WINDOW_AUTOSIZE
NB*: Even if your webcam only supports 640x480 you can still stretch the window to what ever size you like.
JHPJHPI won't be able to proceed any further with the OpenCV development - sorry. I only took a crack at it to break up the monotony of the current projects I'm working on. I may from time to time add some functionality, but it will be sporadic at best. If you decide to take up the challenge and have any questions, post your code and I or the numerous PureBasic contributors will try to help as best we can.
Last edited by JHPJHP on Sun Nov 03, 2013 9:37 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: get live film from a camera by ported usb or other
JHPJHP, thank you very much!
So long!
I understand youI won't be able to proceed any further with the OpenCV development

So long!
Re: get live film from a camera by ported usb or other
AAT - you beat me to the post
I decided to add one more example...
- added resolution.pb
NOTE:
- I set the resolutions to my personal webcam
- because I only have 640 x 480 max - when I choose 800 x 600 - the resolution remains at 640 x 480
Cheers!

- added resolution.pb
NOTE:
- I set the resolutions to my personal webcam
- because I only have 640 x 480 max - when I choose 800 x 600 - the resolution remains at 640 x 480
Cheers!
Last edited by JHPJHP on Sun Nov 03, 2013 8:05 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: get live film from a camera by ported usb or other
Yesss! It works!
My heartfelt thanks to you from the cold Siberia, JHPJHP!
Cheers!
My heartfelt thanks to you from the cold Siberia, JHPJHP!

Cheers!
Re: get live film from a camera by ported usb or other
KUDOS JHP, THIS IS AMAZING! O_O I didn't think you could CHANGE the resolution! 
I have a small question. Is there a way you can possibly add that Kinect thing from the german forums into the OpenCV code? I can't quite wrap my head around it.
Thanks once again!

I have a small question. Is there a way you can possibly add that Kinect thing from the german forums into the OpenCV code? I can't quite wrap my head around it.
Thanks once again!

Re: get live film from a camera by ported usb or other
Hi Mythros,
Concerning your question about merging the OpenCV library with the script found in the post IdeasVacuum submitted from Code Laboratories, and its webcam library - is not possible, they are two separate entities.
--------------------
Updated resolution.pb
- added a BindEvent to the Checkbox Gadget
- cleaner transition between frame resizing
Concerning your question about merging the OpenCV library with the script found in the post IdeasVacuum submitted from Code Laboratories, and its webcam library - is not possible, they are two separate entities.
--------------------
Updated resolution.pb
- added a BindEvent to the Checkbox Gadget
- cleaner transition between frame resizing
Last edited by JHPJHP on Sun Nov 03, 2013 10:18 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: get live film from a camera by ported usb or other
<3 KUDOS to YOU, JHP! I think I'm going to add a PERMANENT link for the latest OpenCV so that beginners have access to it as well! 

Re: get live film from a camera by ported usb or other
In that case...
I made some naming convention changes, and a small update to the example resolution.pb (now pb_resolution.pb).
- cv_... (utilizes OpenCV window)
- pb_... (embedded into purebasic window)
From this point forward I will submit any changes / updates to your new post... I'm guessing it will be located in Tricks 'n' Tips?
Cheers!
I made some naming convention changes, and a small update to the example resolution.pb (now pb_resolution.pb).
- cv_... (utilizes OpenCV window)
- pb_... (embedded into purebasic window)
From this point forward I will submit any changes / updates to your new post... I'm guessing it will be located in Tricks 'n' Tips?
Cheers!
Last edited by JHPJHP on Sun Nov 03, 2013 10:42 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.