PureBasic Interface to OpenCV

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

Re: PureBasic Interface to OpenCV ---- 02/24/14 08:20 PM

Post by JHPJHP »

I had to change the white balance in the web-camera (make my face look green) to prevent tracking of my nose.
You Russians and your vodka... I had to do the same thing because of my cheeks - us Canadians and our beer. :lol:

Thanks for testing the example.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
AAT
Enthusiast
Enthusiast
Posts: 259
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV ---- 02/24/14 08:20 PM

Post by AAT »

Code: Select all

You Russians and your vodka...
No, no, don't like vodka: only sometimes brandy and sometimes tequila. :)
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to OpenCV ---- 02/26/14 07:00 PM

Post by JHPJHP »

Updated:
- added 1 example
-- cv_compare.pb: using a default image, the absolute difference is calculated against a directory of images, returning the closest match
- added 2 default images

This is a very basic "compare images" example, but could be expanded / optimized using various OpenCV filters and standard programming techniques (size, ratio, etc.).

NB*: Images were taken from the following thread created by Kwaï chang caïne: Search similitary of a picture in folder of thousand others

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to OpenCV ---- 03/02/14 03:20 PM

Post by JHPJHP »

Updated:
- updated Functions
- updated 1 example
-- le_SURF.pb: detects keypoints and computes SURF (Speeded-Up Robust Features) descriptors
- added 2 default object files

The change to the example: le_SURF.pb updates the save option and adds an auto-load function:
- when the image is saved (any location) the object files are also saved to the new folder: \binaries\objects
- when images are opened the name is compared against files in the [ objects ] folder
-- if a file is found its values are used to mark the SURF features, otherwise new features are generated which is markedly slower

I've added this update because it brings me one step closer to a full SURF (Nearest Neighbor) example... Robust image comparison.

NB*: Another instance of saving an object (includes the attribute parameter) can be tested from the cv_match_write.pb example.

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

Updated:
- added Constants, Macros, Functions, Inline Functions (converted to Procedures), Procedures
- updated Functions
- renamed 1 example
-- cv_cam_trackcolor.pb to cv_cam_track_color.pb
- added 1 example
-- cv_cam_warp.pb: from the webcam interface, calculates a perspective transform from four pairs of the corresponding points

This update is not to demo the new example, nor to showcase the new additions to the includes, but because the previous update "broke" some of the examples; now fixed.
- cv_cam_warp.pb was added because I was interested to see what a warped camera perspective would look like

NB*: I was in the middle of scripting the SURF (Nearest Neighbor) requirements when I noticed the errors in some of the examples, which is the reason for the unfinished Procedures located in cv_functions.pbi.

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

Updated:
- updated Procedures
- added 1 example
-- cv_cam_split_colors.pb: from the webcam interface, divides a multi-channel array into several single-channel arrays
Last edited by JHPJHP on Mon Mar 10, 2014 3:11 am, edited 3 times in total.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
AAT
Enthusiast
Enthusiast
Posts: 259
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV ---- 03/02/14 03:20 PM

Post by AAT »

Hi, JHPJHP

This is an example how to set webcam's parameters: brightness, contrast, hue, etc.

Code: Select all

IncludeFile "includes/cv_functions.pbi"

Global *capture

Global DefBrightness.d, MaxBrightness.d, MinBrightness.d, DefContrast.d, MaxContrast.d, MinContrast.d
Global DefGamma.d, MaxGamma.d, MinGamma.d, DefSaturation.d, MaxSaturation.d, MinSaturation.d
Global DefHue.d, MaxHue.d, MinHue.d, DefSharpness.d, MaxSharpness.d, MinSharpness.d
Global DefExposure.d, MaxExposure.d, MinExposure.d

#CV_WINDOW_NAME = "WebCam settings"
#CamDataName = "camdata.dat"

Procedure ReadCamData()
  If OpenPreferences(GetCurrentDirectory() + #CamDataName)
    DefBrightness = ReadPreferenceLong("DefBrightness", 1)
    DefContrast =  ReadPreferenceLong("DefContrast", 1)
    DefGamma = ReadPreferenceLong("DefGamma", 1)
    DefSaturation = ReadPreferenceLong("DefSaturation", 1)
    DefHue = ReadPreferenceLong("DefHue", 1)
    DefSharpness = ReadPreferenceLong("DefSharpness", 1)
    DefExposure = ReadPreferenceLong("DefExposure", 1)
    
    MaxBrightness = ReadPreferenceLong("MaxBrightness", 1)
    MaxContrast = ReadPreferenceLong("MaxContrast", 1)
    MaxGamma = ReadPreferenceLong("MaxGamma", 1)
    MaxSaturation = ReadPreferenceLong("MaxSaturation", 1)
    MaxHue = ReadPreferenceLong("MaxHue", 1)
    MaxSharpness = ReadPreferenceLong("MaxSharpness", 1)
    MaxExposure = ReadPreferenceLong("MaxExposure", 1)
    
    MinBrightness = ReadPreferenceLong("MinBrightness", 1)
    MinContrast =  ReadPreferenceLong("MinContrast", 1)
    MinGamma = ReadPreferenceLong("MinGamma", 1)
    MinSaturation = ReadPreferenceLong("MinSaturation", 1)
    MinHue = ReadPreferenceLong("MinHue", 1)
    MinSharpness = ReadPreferenceLong("MinSharpness", 1)
    MinExposure = ReadPreferenceLong("MinExposure", 1)    
    
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_BRIGHTNESS, DefBrightness)
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_CONTRAST, DefContrast)
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_GAMMA, DefGamma)
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_SATURATION, DefSaturation)
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_HUE, DefHue)
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_SHARPNESS, DefSharpness)
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_EXPOSURE, DefExposure
  Else    
    CreatePreferences(GetCurrentDirectory()+"camdata.dat")
    retvalue.d = 0
    value.d = 0
    DefValue.d
    
    OpenWindow(1, 0, 0, 200, 100, "WebCam's parameters", #PB_Window_ScreenCentered)
    TextGadget(30, 10,  40, 180, 20, "Testing webcam's parameters...",#PB_Text_Center)
    
;{ #CV_CAP_PROP_BRIGHTNESS    
    DefValue = cvGetCaptureProperty(*capture,#CV_CAP_PROP_BRIGHTNESS)
    WritePreferenceLong("DefBrightness", DefValue)
    DefBrightness = DefValue
    For k=DefValue To 1000 Step 1
      value = k
      cvSetCaptureProperty(*capture, #CV_CAP_PROP_BRIGHTNESS, value)   
      retvalue=cvGetCaptureProperty(*capture, #CV_CAP_PROP_BRIGHTNESS)     
      If value > retvalue
        Break
      EndIf
    Next      
    WritePreferenceLong("MaxBrightness", cvGetCaptureProperty(*capture,#CV_CAP_PROP_BRIGHTNESS))    
    MaxBrightness = retvalue
    For k=DefValue To 0 Step -1
      value = k
      cvSetCaptureProperty(*capture, #CV_CAP_PROP_BRIGHTNESS, value)   
      retvalue=cvGetCaptureProperty(*capture, #CV_CAP_PROP_BRIGHTNESS)     
      If value > retvalue
        Break
      EndIf
    Next 
    WritePreferenceLong("MinBrightness", cvGetCaptureProperty(*capture,#CV_CAP_PROP_BRIGHTNESS))
    MinBrightness = retvalue
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_BRIGHTNESS, DefValue)    
;}    
    
;{ #CV_CAP_PROP_CONTRAST
    DefValue = cvGetCaptureProperty(*capture,#CV_CAP_PROP_CONTRAST)  
    WritePreferenceLong("DefContrast", DefValue)
    DefContrast = DefValue
    For k=DefValue To 1000 Step 1
      value = k
      cvSetCaptureProperty(*capture, #CV_CAP_PROP_CONTRAST, value)   
      retvalue=cvGetCaptureProperty(*capture, #CV_CAP_PROP_CONTRAST)     
      If value > retvalue
        Break
      EndIf
    Next    
    WritePreferenceLong("MaxContrast", cvGetCaptureProperty(*capture,#CV_CAP_PROP_CONTRAST))
    MaxContrast = retvalue
    For k=DefValue To 0 Step -1
      value = k
      cvSetCaptureProperty(*capture, #CV_CAP_PROP_CONTRAST, value)   
      retvalue=cvGetCaptureProperty(*capture, #CV_CAP_PROP_CONTRAST)     
      If value < retvalue
        Break
      EndIf
    Next    
    WritePreferenceLong("MinContrast", cvGetCaptureProperty(*capture,#CV_CAP_PROP_CONTRAST))
    MinContrast = retvalue
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_CONTRAST, DefValue)
;}    
    
;{ #CV_CAP_PROP_GAMMA   
    DefValue = cvGetCaptureProperty(*capture,#CV_CAP_PROP_GAMMA)
    WritePreferenceLong("DefGamma", DefValue)
    DefGamma = DefValue
    For k = DefValue To 1000 Step 5
      value = k
      cvSetCaptureProperty(*capture,#CV_CAP_PROP_GAMMA, value)   
      retvalue=cvGetCaptureProperty(*capture, #CV_CAP_PROP_GAMMA)     
      If value > retvalue
        Break
      EndIf      
    Next
    WritePreferenceLong("MaxGamma", cvGetCaptureProperty(*capture,#CV_CAP_PROP_GAMMA))
    MaxGamma = retvalue    
    For k = DefValue To 0 Step -5
      value = k
      cvSetCaptureProperty(*capture,#CV_CAP_PROP_GAMMA, value)   
      retvalue=cvGetCaptureProperty(*capture, #CV_CAP_PROP_GAMMA)     
      If value < retvalue
        Break
      EndIf      
    Next
    WritePreferenceLong("MinGamma", cvGetCaptureProperty(*capture,#CV_CAP_PROP_GAMMA)) 
    MinGamma = retvalue 
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_GAMMA, DefValue)
;}    
    
;{  #CV_CAP_PROP_SATURATION  
    DefValue = cvGetCaptureProperty(*capture,#CV_CAP_PROP_SATURATION)
    WritePreferenceLong("DefSaturation", DefValue)
    DefSaturation = DefValue
    For k = DefValue To 1000 Step 1
      value = k
      cvSetCaptureProperty(*capture,#CV_CAP_PROP_SATURATION, value)   
      retvalue = cvGetCaptureProperty(*capture, #CV_CAP_PROP_SATURATION)
      If value > retvalue
        Break
      EndIf      
    Next
    WritePreferenceLong("MaxSaturation" , cvGetCaptureProperty(*capture,#CV_CAP_PROP_SATURATION))
    MaxSaturation = retvalue
    For k = DefValue To 0 Step -1
      value = k
      cvSetCaptureProperty(*capture,#CV_CAP_PROP_SATURATION, value)   
      retvalue = cvGetCaptureProperty(*capture, #CV_CAP_PROP_SATURATION)     
      If value < retvalue
        Break
      EndIf      
    Next
    WritePreferenceLong("MinSaturation", cvGetCaptureProperty(*capture,#CV_CAP_PROP_SATURATION)) 
    MinSaturation = retvalue
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_SATURATION, DefValue)
;}    
    
;{  #CV_CAP_PROP_HUE  
    DefValue = cvGetCaptureProperty(*capture,#CV_CAP_PROP_HUE)
    WritePreferenceLong("DefHue", DefValue)
    DefHue = DefValue
    For k = DefValue To 1000 Step 1
      value = k
      cvSetCaptureProperty(*capture,#CV_CAP_PROP_HUE, value)   
      retvalue = cvGetCaptureProperty(*capture, #CV_CAP_PROP_HUE)
      If value > retvalue
        Break
      EndIf      
    Next
    WritePreferenceLong("MaxHue", cvGetCaptureProperty(*capture,#CV_CAP_PROP_HUE))
    MaxHue = retvalue
    For k = DefValue To 0 Step -1
      value = k
      cvSetCaptureProperty(*capture,#CV_CAP_PROP_HUE, value)   
      retvalue = cvGetCaptureProperty(*capture, #CV_CAP_PROP_HUE)
      If value < retvalue
        Break
      EndIf     
    Next
    WritePreferenceLong("MinHue", cvGetCaptureProperty(*capture,#CV_CAP_PROP_HUE)) 
    MinHue = retvalue
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_HUE, DefValue)
;}    
          
;{  #CV_CAP_PROP_SHARPNESS 
    DefValue = cvGetCaptureProperty(*capture,#CV_CAP_PROP_SHARPNESS)
    WritePreferenceLong("DefSharpness", DefValue)
    DefSharpness = DefValue
    For k = DefValue To 1000 Step 1
      value = k
      cvSetCaptureProperty(*capture,#CV_CAP_PROP_SHARPNESS, value)   
      retvalue = cvGetCaptureProperty(*capture, #CV_CAP_PROP_SHARPNESS)
      If value > retvalue
        Break
      EndIf      
    Next
    WritePreferenceLong("MaxSharpness", cvGetCaptureProperty(*capture,#CV_CAP_PROP_SHARPNESS)) 
    MaxSharpness = retvalue
    For k = DefValue To 0 Step -1
      value = k
      cvSetCaptureProperty(*capture,#CV_CAP_PROP_SHARPNESS, value)   
      retvalue = cvGetCaptureProperty(*capture, #CV_CAP_PROP_SHARPNESS)
      If value < retvalue
        Break
      EndIf     
    Next
    WritePreferenceLong("MinSharpness", cvGetCaptureProperty(*capture,#CV_CAP_PROP_SHARPNESS))
    MinSharpness = retvalue
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_SHARPNESS, DefValue)
;}    

;{  #CV_CAP_PROP_EXPOSURE
    DefValue = cvGetCaptureProperty(*capture,#CV_CAP_PROP_EXPOSURE)
    WritePreferenceLong("DefExposure", DefValue)
    DefExposure = DefValue
    For k = DefValue To 1000 Step 1
      value = k
      cvSetCaptureProperty(*capture,#CV_CAP_PROP_EXPOSURE, value)   
      retvalue = cvGetCaptureProperty(*capture, #CV_CAP_PROP_EXPOSURE)
      If value > retvalue
        Break
      EndIf      
    Next
    WritePreferenceLong("MaxExposure", cvGetCaptureProperty(*capture,#CV_CAP_PROP_EXPOSURE))
    MaxExposure = retvalue
    For k = DefValue To 0 Step -1
      value = k
      cvSetCaptureProperty(*capture,#CV_CAP_PROP_EXPOSURE, value)   
      retvalue = cvGetCaptureProperty(*capture, #CV_CAP_PROP_EXPOSURE)
      If value < retvalue
        Break
      EndIf     
    Next
    WritePreferenceLong("MinExposure", cvGetCaptureProperty(*capture,#CV_CAP_PROP_EXPOSURE))
    MinExposure = retvalue
    cvSetCaptureProperty(*capture, #CV_CAP_PROP_EXPOSURE, DefValue)
    CloseWindow(1)
;}    
  EndIf  
EndProcedure

Procedure Spin20Handler()
  Shared window_handle  
  val.d = GetGadgetState(20)
  cvSetCaptureProperty(*capture,#CV_CAP_PROP_BRIGHTNESS, val) 
  WritePreferenceLong("DefBrightness", val)
EndProcedure

Procedure Spin21Handler()
  Shared window_handle  
  val.d = GetGadgetState(21)
  cvSetCaptureProperty(*capture,#CV_CAP_PROP_CONTRAST, val) 
  WritePreferenceLong("DefContrast", val)  
EndProcedure

Procedure Spin22Handler()
  Shared window_handle  
  val.d = GetGadgetState(22)
  cvSetCaptureProperty(*capture,#CV_CAP_PROP_GAMMA, val)
  WritePreferenceLong("DefGamma", val)
EndProcedure

Procedure Spin23Handler()
  Shared window_handle  
  val.d = GetGadgetState(23)
  cvSetCaptureProperty(*capture,#CV_CAP_PROP_SATURATION, val)
  WritePreferenceLong("DefSaturation", val)
EndProcedure

Procedure Spin24Handler() 
  Shared window_handle  
  val.d = GetGadgetState(24)
  cvSetCaptureProperty(*capture,#CV_CAP_PROP_HUE, val)
  WritePreferenceLong("DefHue", val)
EndProcedure

Procedure Spin25Handler() 
  Shared window_handle  
  val.d = GetGadgetState(25)
  cvSetCaptureProperty(*capture,#CV_CAP_PROP_SHARPNESS, val)
  WritePreferenceLong("DefSharpness", val)
EndProcedure

Procedure Spin26Handler()
  Shared window_handle  
  val.d = GetGadgetState(26)
  cvSetCaptureProperty(*capture,#CV_CAP_PROP_EXPOSURE, val)
  WritePreferenceLong("DefExposure", val)
EndProcedure

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_NORMAL)
  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)
  
  ReadCamData()    
  cvSetCaptureProperty(*capture, #CV_CAP_PROP_FRAME_WIDTH, 640)
  cvSetCaptureProperty(*capture, #CV_CAP_PROP_FRAME_HEIGHT, 480)
  
  If OpenWindow(0, 0, 0, 800, 480, #CV_WINDOW_NAME, #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    SetParent_(window_handle, WindowID(0))     
    TextGadget(10, 650, 25, 60, 20, "Brightness:", #PB_Text_Right)
    TextGadget(11, 650, 50, 60, 20, "Contrast:", #PB_Text_Right)
    TextGadget(12, 650, 75, 60, 20, "Gamma:", #PB_Text_Right)
    TextGadget(13, 650, 100, 60, 20, "Saturation:", #PB_Text_Right)
    TextGadget(14, 650, 125, 60, 20, "Hue:", #PB_Text_Right)
    TextGadget(15, 650, 150, 60, 20, "Sharpness:", #PB_Text_Right)
    TextGadget(16, 650, 175, 60, 20, "Exposure:", #PB_Text_Right)
          
    SpinGadget(20, 715, 20, 50, 20, MinBrightness, MaxBrightness, #PB_Spin_Numeric) : SetGadgetState(20, DefBrightness)
    SpinGadget(21, 715, 45, 50, 20, MinContrast, MaxContrast, #PB_Spin_Numeric) : SetGadgetState(21, DefContrast)
    SpinGadget(22, 715, 70, 50, 20, MinGamma, MaxGamma, #PB_Spin_Numeric) : SetGadgetState(22, DefGamma)
    SpinGadget(23, 715, 95, 50, 20, MinSaturation, MaxSaturation, #PB_Spin_Numeric) : SetGadgetState(23, DefSaturation)
    SpinGadget(24, 715, 120, 50, 20, MinHue, MaxHue, #PB_Spin_Numeric) : SetGadgetState(24, DefHue)
    SpinGadget(25, 715, 145, 50, 20, MinSharpness, MaxSharpness, #PB_Spin_Numeric) : SetGadgetState(25, DefSharpness)
    SpinGadget(26, 715, 170, 50, 20, MinExposure, MaxExposure, #PB_Spin_Numeric) : SetGadgetState(26, DefExposure)
       
    BindGadgetEvent(20, @Spin20Handler())
    BindGadgetEvent(21, @Spin21Handler())
    BindGadgetEvent(22, @Spin22Handler())
    BindGadgetEvent(23, @Spin23Handler())
    BindGadgetEvent(24, @Spin24Handler())
    BindGadgetEvent(25, @Spin25Handler())
    BindGadgetEvent(26, @Spin26Handler())
        
    Repeat
      *image = cvQueryFrame(*capture)

      If *image
        cvShowImage(#CV_WINDOW_NAME, *image)        
        cvWaitKey(1)
      EndIf
    Until WindowEvent() = #PB_Event_CloseWindow
  EndIf
  cvDestroyWindow(#CV_WINDOW_NAME)
  cvReleaseCapture(@*capture)
  cvReleaseImage(@*image)
  ClosePreferences()
EndIf
Good luck!
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to OpenCV ---- 03/02/14 03:20 PM

Post by JHPJHP »

Hi AAT,

I really like your new example, it works great. I want to thank you for all your contributions and support throughout the project.

I also think it may be time to put this project to bed.
Last edited by JHPJHP on Thu Mar 06, 2014 7:41 am, edited 1 time in total.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
AAT
Enthusiast
Enthusiast
Posts: 259
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV ---- 03/02/14 03:20 PM

Post by AAT »

Hi, JHPJHP
I also think it may be time to put this project to bed
:(
The main core of the openCV is adapted to purebasiс. Thank you!
I understand that you are tired, but is it possible that project will continue a little later?

Good luck!
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to OpenCV ---- 03/02/14 03:20 PM

Post by JHPJHP »

Hi AAT,

Sure the project may continue in the future, but for now I don't see the logic in beating a dead dog. :) Besides you and me I can count the number of replies on 1 hand; where is the interest?

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

Updated:
- added 2 examples
-- pb_cam_preferences.pb: creates an interface to the webcam's parameters (contributed by AAT)
-- le_SURF_NN.pb: Detects keypoints and computes SURF (Speeded-Up Robust Features) descriptors
- added 2 default images
- added 4 default objects

The example posted previously by AAT has now been included into the package.

The nearest neighbors SURF example has been optimized for the included images.
- modified version of: find_obj.cpp
-- found in the current version of OpenCV

Image

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
infratec
Always Here
Always Here
Posts: 7583
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: PureBasic Interface to OpenCV ---- 03/02/14 03:20 PM

Post by infratec »

Hi,

don't be afraid :!:

I always read this thread with big interrest.
Up to now I have no usage for this graphic stuff.

But it is good to know what's now possible with PB and your big contribution.

Bernd
Morty
User
User
Posts: 35
Joined: Mon Mar 19, 2007 8:30 am
Location: Germany
Contact:

Re: PureBasic Interface to OpenCV ---- 03/02/14 03:20 PM

Post by Morty »

For me it's nearly the same.

I'm reading this topic every morning and I'm realy impressed what you did here. It's amazing to see how OpenCV can work togther with PB.
And I also have ideas what to do with this cool and amazing stuff ... but at the moment there is no free time slot for me to start a project with OpenCV, or to get in closer touch with this lib.

So ... keep on this good work

- Morty
marc_256
Addict
Addict
Posts: 835
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: PureBasic Interface to OpenCV ---- 03/02/14 03:20 PM

Post by marc_256 »

hi JHPJHP,

For me it is the same, I read all the posts,
I'm so interested to use this for my upgrading software for my little robots (some day).

http://www.marc-systems.be/new_2010/hob ... _deel1.htm

Sorry it is written in dutch only (for now)

Thanks, for this huge contribution.

Marc,
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Re: PureBasic Interface to OpenCV ---- 03/02/14 03:20 PM

Post by Rings »

dito, really cool stuff.
SPAMINATOR NR.1
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to OpenCV ---- 03/02/14 03:20 PM

Post by JHPJHP »

Thanks guys, I really appreciate the acknowledgement.

- marc_256: I was blown-away with your "little robots" project, I used Google Translate to read the sites content... amazing!

infratec, Morty, marc_256, Rings, and AAT - the best way for me to show my appreciation is with another example. :)

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

Updated:
- added Functions
- added 1 example
-- cv_chessboard.pb: finds the positions of internal corners for an 8 x 8 chessboard

Original source can be found here.

The chessboard pattern I used to test with can be found here.
- the chessboard dimensions ( number of squares - i.e. 8 x 8 ) is hard-coded
-- because internal corners are used my dimensional values are 7 x 7
- documentation states that calibration works best when the chessboard pattern has a white border
- I used an iPad to display the chessboard pattern with no issues

Image
Last edited by JHPJHP on Fri Mar 07, 2014 8:18 pm, edited 2 times in total.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
AAT
Enthusiast
Enthusiast
Posts: 259
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV ---- 03/02/14 03:20 PM

Post by AAT »

Hi, JHPJHP!

You've read my mind: I was just going to ask about the camera calibration. :)
Thanks!

Good luck!
Last edited by AAT on Fri Mar 07, 2014 5:02 am, edited 1 time in total.
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to OpenCV ---- 03/06/14 08:15 PM

Post by JHPJHP »

Hi AAT,
I'm glad I could accommodate. :)

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

Update:
- I was switching between Import and ImportC for a group of functions while working on the last example, and forgot to set it back to ImportC
-- this caused some of the other examples to return an error; now fixed
Last edited by JHPJHP on Sun Mar 09, 2014 12:51 am, edited 12 times in total.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Locked