The example cv_cam_logo.pb is very very nice!
But there is one drawback: the image of the logo fades on bright scenes.
I think that if you replace your original procedure on the following, logo will be better seen.
Code: Select all
Procedure OpenCV(ImageFile.s, *capture)
  If ImageFile
    *param.USER_INFO = AllocateMemory(SizeOf(USER_INFO))
    *logo.IplImage
    *resize.IplImage
    *border.IplImage
    *image.IplImage   
    *mask.IplImage
    
    cvNamedWindow(#CV_WINDOW_NAME, #CV_WINDOW_AUTOSIZE)
    window_handle = cvGetWindowHandle(#CV_WINDOW_NAME)
    *window_name = cvGetWindowName(window_handle)
    lpPrevWndFunc = SetWindowLongPtr_(window_handle, #GWL_WNDPROC, @WindowCallback())
    If CreatePopupImageMenu(0, #PB_Menu_ModernLook)
      MenuItem(1, "Open")
      MenuBar()
      MenuItem(2, "Exit")
    EndIf
    *param\uMsg = PeekS(*window_name, -1, #PB_Ascii) + ": "
    *param\uValue = window_handle
    cvSetMouseCallback(*window_name, @cvMouseCallback(), *param)
    hWnd = GetParent_(window_handle)
    ExtractIconEx_("shell32.dll", 1, #Null, @phiconSmall, 1)
    SendMessage_(hWnd, #WM_SETICON, 0, phiconSmall)
    wStyle = GetWindowLongPtr_(hWnd, #GWL_STYLE)
    SetWindowLongPtr_(hWnd, #GWL_STYLE, wStyle & ~(#WS_MAXIMIZEBOX | #WS_MINIMIZEBOX | #WS_SIZEBOX))
    *logo = cvLoadImage(ImageFile, #CV_LOAD_IMAGE_ANYDEPTH | #CV_LOAD_IMAGE_ANYCOLOR)
    
    If *logo\nChannels > 1
      If *logo\width > 100
        iRatio.d = 100 / *logo\width
        iWidth = *logo\width * iRatio
        iHeight = *logo\height * iRatio
        *resize = cvCreateImage(iWidth, iHeight, #IPL_DEPTH_8U, *logo\nChannels)
        cvResize(*logo, *resize, #CV_INTER_AREA)
      Else
        *resize = cvCloneImage(*logo)
      EndIf
      cvMoveWindow(#CV_WINDOW_NAME, 20, 20)
      offset = 5
      *border = cvCreateImage(*resize\width + offset - 1, *resize\height + offset - 1, #IPL_DEPTH_8U, *resize\nChannels)
      cvCopyMakeBorder(*resize, *border, (offset - 1) / 2, (offset - 1) / 2, #IPL_BORDER_CONSTANT, 0, 255, 255, 0)
      
      *mask = cvCloneImage(*border)
      cvSet(*mask, 0, 0, 0, 0, #Null)      
      
      Repeat
        *image = cvQueryFrame(*capture)
        If *image
          cvSetImageROI(*image, 20, 20, *border\width, *border\height)
          cvAnd(*image,*mask,*image,0)
          cvAdd(*image, *border, *image, #Null)
          cvResetImageROI(*image)
          cvShowImage(#CV_WINDOW_NAME, *image)
          keyPressed = cvWaitKey(1)
        EndIf
      Until keyPressed = 27 Or ExitCV
    Else
      MessageBox_(0, ImageFile + Chr(10) + Chr(10) + "... does not meet the channel requirements, please try another image.", #CV_WINDOW_NAME, #MB_ICONERROR)
      GetCV = #True
    EndIf
    cvDestroyWindow(#CV_WINDOW_NAME)
    cvReleaseImage(@*border)
    cvReleaseImage(@*resize)
    cvReleaseImage(@*logo)
    cvReleaseImage(@*mask)
    If GetCV
      GetCV = #False
      ExitCV = #False
      OpenCV(GetImage(), *capture)
    Else
      cvReleaseCapture(@*capture)
    EndIf
  EndIf
EndProcedureGood luck!


