Home Image-Pro Automation (Macros, Apps, Reports)

CAMERA MODE IDENTIFICATION -- SIMULATION or REAL . . . .

2022-10-21-153628

All --

Is there CODE that an APP can use to learn whether the CAPTURE TOOL is running in SIMULATION MODE or whether it is communicating with a REAL CAMERA?

Thanks.

-- Matt

Answers

  • Hi Matt,

    The active camera is set to the one which is selected in the UI. Here is some code which will determine whether a real camera, simulation, or no camera is the active camera. No camera is the case when there is no real camera attached and the simulation is turned off.

    This code requires a reference to MediaCy.IQL.Capture.Manager.

    Imports MediaCy.IQL.Capture.Manager
    
    Public Module Module1
    
        Function IsCameraSimulation(Optional ByRef noCamera As Boolean = False) As Boolean
            Dim captObj As IMcCaptureManagerDevice2
    
            With Capture.CaptureCommands.GetDeviceObject(Nothing)
                .Run()
                captObj = .Output.Value
            End With
    
            If captObj Is Nothing Then noCamera = True
            If captObj IsNot Nothing AndAlso captObj.Information.DeviceName.Contains("Capture Simulation") Then Return True
    
            Return False
    
        End Function
    
        Sub WhichCamera()
            Dim cameraSim As Boolean = False
            Dim cameraNone As Boolean = False
    
            cameraSim = IsCameraSimulation(cameraNone)
    
            ThisApplication.Output.Show()
            If cameraSim Then
                ThisApplication.Output.PrintMessage("Capture Simulation is the active camera")
            ElseIf cameraNone Then
                ThisApplication.Output.PrintMessage("There is no currently active camera")
            Else
                ThisApplication.Output.PrintMessage("There is a real camera active")
            End If
    
        End Sub
    
    End Module
  • 2022-11-01-142938

    Trey --

    Thank you for the information and code.

    I apologize for my slow response.  I had to put this project on STANDBY for a bit.

    Thanks again.

    -- Matt


Sign In or Register to comment.