PureBasic Interface to OpenCV

Developed or developing a new product in PureBasic? Tell the world about it.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi wilbert,
I like the varying dot sizes better
I agree, it brings a lot more detail to the effect.

------------------------------------------------------------

Updated:
- deleted 2 examples
-- le_delaunay_1.pb, le_delaunay_2.pb
- renamed 1 example
-- cv_morph_faces.pb to cv_morph_faces_show.pb
- added 1 example
-- cv_morph_faces_build.pb: manual construction of Delaunay triangulation

When the morph example was first added to the interface, I stated that with very little effort the Delaunay examples could be modified to generate data for additional image morphing; the example cv_morph_faces_build.pb does just that.

The current morph effect (viewed from the example cv_morph_faces_show.pb) was created in about 10 minutes, but a caveat to generating a successful transition is the strict rules that need to be followed; if requested I will post instructions.

NB*: The following website is a good source for images: http://www.vipcutouts.com/.
Last edited by JHPJHP on Wed Oct 05, 2016 6:23 am, edited 11 times in total.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: PureBasic Interface to OpenCV

Post by Keya »

i have to keep peeking into this thread to see the extraordinary screenshots, there's some amaaaazing algorithms you've made accessible to PB'ers via OpenCV, JHP²! keep up the brilliant work :)
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Keya,

Thank you for your kind words.

----------------------------------------------------

NOTE: In the previous update I did a global find and replace that caused some examples to crash when moving the Trackbar; this has been fixed. Update has been reposted.

----------------------------------------------------

Updated:
- updated 1 example: cv_morph_faces_build.pb
- added 6 Haarcascade classifiers
-- left eye, right eye, left ear, right ear, nose, and mouth

Press the [ X KEY ] once to remove all points, press it a second time to execute the beginnings of a Facial Feature Points Detection algorithm.
- this is a work in progress: left eye, right eye, nose, and mouth are marked by colored rectangles

NB*: At some point this should assist with building a facial feature point map, but currently it's only a proof of concept.

Image
Last edited by JHPJHP on Wed Oct 05, 2016 4:32 am, edited 1 time in total.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: PureBasic Interface to OpenCV

Post by Keya »

how long does it take to generate that?
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Keya,
Keya wrote:how long does it take to generate that?
Are you referring to building a facial feature point map manually?

The morph effect was created in about 10 minutes, but a caveat to generating a successful transition using the example cv_morph_faces_build.pb are the strict rules that need to be followed.
Last edited by JHPJHP on Mon Nov 07, 2016 10:21 pm, edited 1 time in total.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: PureBasic Interface to OpenCV

Post by wilbert »

JHPJHP wrote:The morph effect was created in about 10 minutes
That's fast :)
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: PureBasic Interface to OpenCV

Post by Keya »

I was wondering because i recall seeing examples of "face detection" (i guess not facial features but not sure), but it's working on video and appears to be detecting in realtime which i was stunned at! (or perhaps it's post-processing!?) ... so I searched for a random example at google images -- but interestingly this example i found is using OpenCV!
Image
src https://pythonspot.com/en/face-detection-in-video/
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi wilbert,

It'll be faster once I finish the facial feature detection algorithm; plotting points manually is a pain (who has 10 minutes) :)

---------------------------------------------------------------------------

Hi Keya,

I've duplicated that exact example (cv_cam_haardetect_face.pb), with a few added features, including various mask overlays. :mrgreen:

Webcam face-detection examples...
- cv_cam_camshift.pb: using the Camshift algorithm, color information is used to track an object along an image sequence
- cv_cam_haardetect_face.pb: tries to detect a frontal-face using HaarCascades
- cv_cam_matchtemplate.pb: object recognition using the template matching algorithm

Face learning examples... (first read: references\haarcascade.txt)
- cv_cam_haardetect_train_1.pb: Haar-Training in stages for single face recognition (new version)
- cv_cam_haardetect_train_2.pb: Haar-Training in stages for single face recognition (old version)

And these...
- cv_haardetect_face.pb: tries to detect frontal-faces of different sizes using HaarCascades
- cv_matchtemplate.pb: compares a template against overlapped image regions; matching one face against many faces
- cv_norm.pb: using a default image, the absolute difference is calculated against a directory of images, returning the closest match

NB*: There are quite a few other examples that would enhance face detection and/or recognition through various filters and algorithms.
Last edited by JHPJHP on Fri Oct 07, 2016 8:53 am, edited 1 time in total.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: PureBasic Interface to OpenCV

Post by Keya »

haha wow you added that so fast!!! brilliant :)
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Keya,
haha wow you added that so fast!!! brilliant
I should have mention that the face detection examples were created over a year ago.

I thought when you asked how long it took to generate, you were referring to the mapping of facial features, which previously was a manual process. All the face detection examples are in real time, a credit to the speed of OpenCV.

------------------------------------------------------------------

Hi wilbert,

I've finished the changes to the morphing examples. The time it takes to create the facial feature maps has been reduced from 10 minutes to ten seconds :)

An added bonus to automatically detecting facial features is the accuracy and improved transitions; you really have to see it for yourself.

------------------------------------------------------------------

Updated:
- updated 1 example: cv_morph_faces_build.pb
-- switched from a strictly manual facial feature detection method to an automatic one, with the option to manually add additional points

Run the example cv_morph_faces_show.pb to view a pre-mapped morphing effect.

Image
Last edited by JHPJHP on Fri Oct 07, 2016 7:01 am, edited 3 times in total.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: PureBasic Interface to OpenCV

Post by wilbert »

Looks good :)
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
idle
Always Here
Always Here
Posts: 5097
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: PureBasic Interface to OpenCV

Post by idle »

scary
Windows 11, Manjaro, Raspberry Pi OS
Image
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Thanks wilbert, idle,
idle wrote:scary
True, but less scary then the previous transition between Trump, Clinton and Cruz :)

---------------------------------------------------

Updated (Windows and OSX interfaces):
- renamed 1 example
-- cv_mov_writeframe_FFMPEG.pb to cv_RTSP_writeframe_FFMPEG.pb
- added 1 example
-- cv_RTSP_writeframe.pb: using RTSP (Real Time Streaming Protocol) an online video is saved to a local folder

12 video stream URL's have been included in the example, randomly loaded:
- RTSP Source URL Syntax

Code: Select all

Dim arrRTSP.s(11)
arrRTSP(0) = "http://wse.planeta-online.tv:1935/live/channel_3/master.m3u8"
arrRTSP(1) = "http://95.140.197.69:8000/channel-18?m3u8"
arrRTSP(2) = "rtsp://mm2.pcslab.com/mm/PrinceofPersia.mp4"
arrRTSP(3) = "http://iphone-streaming.ustream.tv/uhls/18525677/streams/live/iphone/playlist.m3u8?NOVOROSSIYA.720p.HD"
arrRTSP(4) = "http://95.140.197.69:8000/channel-54?m3u8"
arrRTSP(5) = "rtsp://mm2.pcslab.com:554/mm/wh2000.3gp"
arrRTSP(6) = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
arrRTSP(7) = "http://31.204.128.104:8081/live/sptv/playlist.m3u8"
arrRTSP(8) = "rtsp://mm2.pcslab.com/mm/7m2000.mp4"
arrRTSP(9) = "http://lcdn.une.net.co:80/v1/AUTH_HLSLIVE/TCAF/tu1_1.m3u8"
arrRTSP(10) = "http://hls.tombalalive.com/ios/smil:live.smil/playlist.m3u8"
arrRTSP(11) = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"

Repeat
  nCreate + 1
  *capture.CvCapture = cvCreateFileCapture(arrRTSP(Random(11)) + "?Transport=multicast")
Until nCreate = 5 Or *capture
Last edited by JHPJHP on Thu Dec 08, 2016 9:24 pm, edited 1 time in total.
Mesa
Enthusiast
Enthusiast
Posts: 349
Joined: Fri Feb 24, 2012 10:19 am

Re: PureBasic Interface to OpenCV

Post by Mesa »

There are a lot of tutos to make panorama picture (360°) but i can't find any one to make a panorama viewer with picture from google streeview. Do you think is possible to make a panorama viewer with opencv and how ?

Thanks.

M.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi Mesa,

There is nothing in the package that does this, but combining OpenCV and OpenGL with PureBasic should make the process easier.

---------------------------------------------------

Updated (Windows and OSX interfaces):
- deleted 1 example
-- cv_dithering_2.pb
- renamed 1 example
-- cv_dithering_1.pb to cv_dithering.pb
- updated 1 example
-- cv_dithering.pb

NB*: Update includes various bug fixes to numerous examples.
Locked