Look at the first post: it's 1 year anniversary for now!
My congratulations to you!

It was very interesting year.
Many thanks to JHPJHP for his persistence and very hard work!
Good luck!

My first saved package consists of 9 examples and 1 pbi.JHPJHP wrote:...this would have been a package of 20 examples...
Am I missing something or is there no change log for 2.4.10 version?JHPJHP wrote:I've updated the binaries from: OpenCV v2.4.9 to v2.4.10.
Always happy to "cause" updates and new stuff on T&T section from you!JHPJHP wrote:Hi bbanelli,
I found the change log for OpenCV v2.4.10, but now look what you've caused...![]()
Does this mean that v10 and v11 are bugfixes only, while 2.9 had some new features and improvements as well?After reading bbanelli's post, I did a search for the OpenCV v2.4.10 Change Logs and found then, but they also pointed to another stable release of OpenCV.
- http://code.opencv.org/projects/OpenCV/versions/22
- http://code.opencv.org/projects/OpenCV/versions/23
I think that's exactly what these "hidden" versions are. Good to know - thank you.bbanelli wrote:Does this mean that v10 and v11 are bugfixes only, while 2.9 had some new features and improvements as well?
These operators are used in my project.JHPJHP wrote:...
-- cvMinEnclosingCircle computes radius by 3% to large
-- Segmentation fault in Canny detector...
Code: Select all
IncludeFile "includes/cv_functions.pbi"
*Image.IplImage = cvLoadImage("a.png", #CV_LOAD_IMAGE_COLOR)
*ImageClone.IplImage = cvCloneImage(*Image)
*Gray.IplImage = cvCreateImage(*image\width, *image\height, #IPL_DEPTH_8U, 1)
*GrayClone.IplImage = cvCreateImage(*image\width, *image\height, #IPL_DEPTH_8U, 1)
*GrayTemp.IplImage = cvCreateImage(*image\width, *image\height, #IPL_DEPTH_8U, 1)
*GColor.IplImage = cvCreateImage(*image\width, *image\height, #IPL_DEPTH_8U, 1)
rows.l = 3 : columns.l = 3
*ConvKernel.IplConvKernel = cvCreateStructuringElementEx(rows, columns, cvFloor(rows/2), cvFloor(columns/2), #CV_SHAPE_RECT, 0) 
cvCvtColor(*Image, *Gray, #CV_BGR2GRAY, 1)
cvShowImage("Color", *Image) : cvMoveWindow("Color", 10, 10)
cvShowImage("Gray", *Gray) : cvMoveWindow("Gray", 10, 360)
        
cvMorphologyEx(*Gray, *GrayClone, *GrayTemp, *ConvKernel, #CV_MOP_GRADIENT, 1)
cvMorphologyEx(*Image, *ImageClone, *GrayTemp, *ConvKernel, #CV_MOP_GRADIENT, 1)
cvCvtColor(*ImageClone, *GColor, #CV_BGR2GRAY, 1)
cvShowImage("Color Gradient", *ImageClone) : cvMoveWindow("Color Gradient", 510, 10)
cvShowImage("Color->Gray Gradient", *GColor) : cvMoveWindow("Color->Gray Gradient", 1020, 10)
cvShowImage("Gray Gradient", *GrayClone) : cvMoveWindow("Gray Gradient", 510, 360)
Repeat
  keyPressed = cvWaitKey(1)
Until keyPressed = 27
cvDestroyWindow("Color Image")
cvDestroyWindow("Color->Gray Image")
cvDestroyWindow("Gray Gradient")
cvDestroyWindow("Color Gradient")
cvDestroyWindow("Color->Gray Gradient")
cvReleaseImage(@*GColor)
cvReleaseImage(@*GrayTemp)
cvReleaseImage(@*GrayClone)
cvReleaseImage(@*Gray) 
cvReleaseImage(@*ImageClone)
cvReleaseImage(@*Image)

Code: Select all
IncludeFile "includes/cv_functions.pbi"
EnableExplicit
Enumeration #PB_Event_FirstCustomValue
  #Event_ThreadMessage
  #EventType_UpdateFrame
EndEnumeration
Global *capture, *param.USER_INFO
Global.i ThreadFlag = 1
Global.cvFont font1, font2, font3
Global Dim Thr.i(4)
Threaded.i i, j, Parameter
Threaded.b adjust1, adjust2, adjust3
Threaded *image.IplImage
Define.i nCreate, CaptureThr, Event, FrameSyncMutex
Procedure ErrorHandler()
  Protected ErrorMessage$
  ErrorMessage$ = "A program error was detected:" + Chr(13) 
  ErrorMessage$ + Chr(13)
  ErrorMessage$ + "Error Message:   " + ErrorMessage()      + Chr(13)
  ErrorMessage$ + "Error Code:      " + Str(ErrorCode())    + Chr(13)  
  ErrorMessage$ + "Code Address:    " + Str(ErrorAddress()) + Chr(13)
 
  If ErrorCode() = #PB_OnError_InvalidMemory   
    ErrorMessage$ + "Target Address:  " + Str(ErrorTargetAddress()) + Chr(13)
  EndIf
 
  If ErrorLine() = -1
    ErrorMessage$ + "Sourcecode line: Enable OnError lines support to get code line information." + Chr(13)
  Else
    ErrorMessage$ + "Sourcecode line: " + Str(ErrorLine()) + Chr(13)
    ErrorMessage$ + "Sourcecode file: " + ErrorFile() + Chr(13)
  EndIf
 
  ErrorMessage$ + Chr(13)
  ErrorMessage$ + "Register content:" + Chr(13)
 
  CompilerSelect #PB_Compiler_Processor 
    CompilerCase #PB_Processor_x86
      ErrorMessage$ + "EAX = " + Str(ErrorRegister(#PB_OnError_EAX)) + Chr(13)
      ErrorMessage$ + "EBX = " + Str(ErrorRegister(#PB_OnError_EBX)) + Chr(13)
      ErrorMessage$ + "ECX = " + Str(ErrorRegister(#PB_OnError_ECX)) + Chr(13)
      ErrorMessage$ + "EDX = " + Str(ErrorRegister(#PB_OnError_EDX)) + Chr(13)
      ErrorMessage$ + "EBP = " + Str(ErrorRegister(#PB_OnError_EBP)) + Chr(13)
      ErrorMessage$ + "ESI = " + Str(ErrorRegister(#PB_OnError_ESI)) + Chr(13)
      ErrorMessage$ + "EDI = " + Str(ErrorRegister(#PB_OnError_EDI)) + Chr(13)
      ErrorMessage$ + "ESP = " + Str(ErrorRegister(#PB_OnError_ESP)) + Chr(13)
 
    CompilerCase #PB_Processor_x64
      ErrorMessage$ + "RAX = " + Str(ErrorRegister(#PB_OnError_RAX)) + Chr(13)
      ErrorMessage$ + "RBX = " + Str(ErrorRegister(#PB_OnError_RBX)) + Chr(13)
      ErrorMessage$ + "RCX = " + Str(ErrorRegister(#PB_OnError_RCX)) + Chr(13)
      ErrorMessage$ + "RDX = " + Str(ErrorRegister(#PB_OnError_RDX)) + Chr(13)
      ErrorMessage$ + "RBP = " + Str(ErrorRegister(#PB_OnError_RBP)) + Chr(13)
      ErrorMessage$ + "RSI = " + Str(ErrorRegister(#PB_OnError_RSI)) + Chr(13)
      ErrorMessage$ + "RDI = " + Str(ErrorRegister(#PB_OnError_RDI)) + Chr(13)
      ErrorMessage$ + "RSP = " + Str(ErrorRegister(#PB_OnError_RSP)) + Chr(13)
      ErrorMessage$ + "Display of registers R8-R15 skipped."         + Chr(13)
 
    CompilerCase #PB_Processor_PowerPC
      ErrorMessage$ + "r0 = " + Str(ErrorRegister(#PB_OnError_r0)) + Chr(13)
      ErrorMessage$ + "r1 = " + Str(ErrorRegister(#PB_OnError_r1)) + Chr(13)
      ErrorMessage$ + "r2 = " + Str(ErrorRegister(#PB_OnError_r2)) + Chr(13)
      ErrorMessage$ + "r3 = " + Str(ErrorRegister(#PB_OnError_r3)) + Chr(13)
      ErrorMessage$ + "r4 = " + Str(ErrorRegister(#PB_OnError_r4)) + Chr(13)
      ErrorMessage$ + "r5 = " + Str(ErrorRegister(#PB_OnError_r5)) + Chr(13)
      ErrorMessage$ + "r6 = " + Str(ErrorRegister(#PB_OnError_r6)) + Chr(13)
      ErrorMessage$ + "r7 = " + Str(ErrorRegister(#PB_OnError_r7)) + Chr(13)
      ErrorMessage$ + "Display of registers r8-R31 skipped."       + Chr(13)
 
  CompilerEndSelect
  
  ThreadFlag = 0
  Delay(250)
  For i = 0 To 3
    If IsThread(Thr(i))
      KillThread(Thr(i))
    EndIf
  Next    
  
  MessageRequester("OnError example", ErrorMessage$)
  
  End
 
EndProcedure
OnErrorCall(@ErrorHandler())
Repeat
  nCreate + 1
  *capture = cvCreateCameraCapture(0)
Until nCreate = 5 Or *capture
Procedure RefreshFrame(*p)
  Shared FrameSyncMutex
  Parameter  = *p
  While ThreadFlag
    LockMutex(FrameSyncMutex)
    *image = cvQueryFrame(*capture)
    UnlockMutex(FrameSyncMutex)
    If *image
      cvPutText(*image, "Part " + Str(Parameter), 0, 50, @font1, 0, 0, 255, 0)
      cvPutText(*image, FormatDate("%yyyy-%mm-%dd",Date()), 0, 440, @font2, 0, 255, 0, 0)
      cvPutText(*image, FormatDate("%hh-%ii-%ss", Date()), 370, 440, @font3, 255, 0, 0, 0)
      cvFlip(*image, #Null, 0)
      StartDrawing(ImageOutput(Parameter))
      DrawImage(ImageID(Parameter),0,0)
      CopyMemory(*image\imageData, DrawingBuffer(), (*image\width) * (*image\height) * 3)
      StopDrawing()
      PostEvent(#Event_ThreadMessage, 0, Parameter, #EventType_UpdateFrame, Parameter)
    EndIf
  Wend
  ProcedureReturn
EndProcedure
Procedure OnThreadMessage()
  Select EventType()
    Case #EventType_UpdateFrame
      ResizeImage(EventData(),320,240)
      SetGadgetState(EventGadget(), ImageID(EventData()))
      ResizeImage(EventData(),640,480)
  EndSelect
  ProcedureReturn
EndProcedure
If *capture
  If OpenWindow(0, 0, 0, 640, 520, "PB Native@OpenCV", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    
    BindEvent(#Event_ThreadMessage, @OnThreadMessage())
    
    FrameSyncMutex = CreateMutex()
    
    ButtonGadget(100, 10, 490, 200, 20, "Exit")
    CreateImage(0, 640, 480)
    CreateImage(1, 640, 480)
    CreateImage(2, 640, 480)
    CreateImage(3, 640, 480)
    ImageGadget(0,0,0,320,240, ImageID(0))
    ImageGadget(1,320,0,320,240, ImageID(1))
    ImageGadget(2,0,240,320,240, ImageID(2))
    ImageGadget(3,320,240,320,240, ImageID(3))
    
    font1.CvFont
    font2.CvFont
    font3.CvFont
    cvInitFont(@font1, #CV_FONT_HERSHEY_SCRIPT_COMPLEX, 1.5, 1.5, #Null, 1, #CV_AA)
    cvInitFont(@font2, #CV_FONT_HERSHEY_SIMPLEX, 1.5, 1.5, #Null, 1, #CV_AA)
    cvInitFont(@font3, #CV_FONT_HERSHEY_TRIPLEX | #CV_FONT_ITALIC, 1.5, 1.5, #Null, 1, #CV_AA)
        
    *param.USER_INFO = AllocateMemory(SizeOf(USER_INFO))
    *param\uValue = WindowID(0)
    
    For i = 0 To 3
      Thr(i) = CreateThread(@RefreshFrame(), i)
    Next
    
    Repeat
      Event = WaitWindowEvent()
      
      Select Event
        Case #PB_Event_Gadget
          Select EventGadget()
            Case 100
              ThreadFlag = 0
              FreeMemory(*param)
              cvReleaseCapture(@*capture)
              End 0
          EndSelect
      EndSelect
    Until Event = #PB_Event_CloseWindow
  EndIf
EndIf
Code: Select all
ThreadFlag = 0
Delay(250)
For i = 0 To 3
  If IsThread(Thr(i))
    KillThread(Thr(i))
  EndIf
Next