Giter Site home page Giter Site logo

Comments (14)

SMA2016a avatar SMA2016a commented on August 24, 2024

Would post the IP address and subnetmask of the camera and network card.

from pypylon.

camron-musashi avatar camron-musashi commented on August 24, 2024

Camera:
IP: 192:168:2.21:3956
Subnet mask: 255.255.255.0

Network Card:
IPv4: 192.168.1.99
Subnet Mask: 255.255.0.0

from pypylon.

SMA2016a avatar SMA2016a commented on August 24, 2024

The camera must be findable using unicast communication.
The Subnet not mating each other.

Camera:
IP: 192:168:1.21:3956
Subnet mask: 255.255.255.0

Network Card:
IPv4: 192.168.1.99
Subnet Mask: 255.255.255.0

or

Camera:
IP: 192:168:2.21:3956
Subnet mask: 255.255.0.0

Network Card:
IPv4: 192.168.1.99
Subnet Mask: 255.255.0.0

from pypylon.

camron-musashi avatar camron-musashi commented on August 24, 2024

Changed camera's Subnet mask to match computers, and now connects. However image grab is not working.

ip_address = '192.168.2.21:3956'
subnet_mask = '255.255.0.0'

factory = pylon.TlFactory.GetInstance()
ptl = factory.CreateTl('BaslerGigE')
empty_camera_info = ptl.CreateDeviceInfo()

empty_camera_info.SetPropertyValue('IpAddress', ip_address)
empty_camera_info.SetPropertyValue('SubnetMask', subnet_mask)

camera_device = factory.CreateDevice(empty_camera_info)
camera = pylon.InstantCamera(camera_device)
camera.Open()
print("Using device ", camera.GetDeviceInfo().GetModelName())
camera.Height.SetValue(height)

camera.TriggerSelector.Value = 'FrameStart'
camera.TriggerMode.Value = 'On'
camera.TriggerSource.Value = 'Software'

camera.StartGrabbingMax(countOfImagesToGrab)
camera.TriggerSoftware.Execute()
print('Camera triggered')
print("starting capture")

actuatorThread = myThread("Actuator-thread", 1)
actuatorThread.start()

#don't grab any images until enought time has passsed for the first frame of the line scan to come through
#convert exposure from us to s
timeDelay = (exp / 1000000) * height
time.sleep(timeDelay)

while camera.IsGrabbing():
    print('Grabbing')
    result = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
    if result.GrabSucceeded():
        image = result.Array
        result.Release()
        path = "C:\\Users\\camron.sabahi-pourka\\Desktop"
        cv2.imwrite(path + "\\light_1.bmp", image)
        print("Image saved successfully.")
        break
    if not result.GrabSucceeded():
        print('Grab failed')
    result.Release()

from pypylon.

HighImp avatar HighImp commented on August 24, 2024

Hi,
can you provide the output of your script? What is not working exactly?
Best Regards

from pypylon.

camron-musashi avatar camron-musashi commented on August 24, 2024

The grabs were all failing/time out-ing/crashing my computer.

Type Time Source Message
Error 2024-03-20 13:31:26.314 Basler raL4096-24gm (23861554) Image acquisition on "Basler raL4096-24gm (23861554)" failed! Error: "The buffer was incompletely grabbed. This can be caused by performance problems of the network hardware used, i.e., the network adapter, switch, or Ethernet cable. Buffer underruns can also cause image loss. To fix this, use the pylonGigEConfigurator tool to optimize your setup and use more buffers for grabbing in your application to prevent buffer underruns."

This is what I would get when I try to capture a frame on Pylon Viewer. Very weird because I wasn't getting these errors in the previous days I was using the camera

from pypylon.

HighImp avatar HighImp commented on August 24, 2024

Have you tried the GigE-Configurator in the Pylon Viewer?

from pypylon.

camron-musashi avatar camron-musashi commented on August 24, 2024

Yes. However, when we would click the configuration button it would just close the window

from pypylon.

SMA2016a avatar SMA2016a commented on August 24, 2024

Does your script work, if you do not write the image to hardware?

from pypylon.

camron-musashi avatar camron-musashi commented on August 24, 2024

Yes the script works, and I'm able to connect to the camera however now I get this error
_genicam.TimeoutException: Grab timed out. Possible reasons are: The image transport from the camera device is not working properly, e.g., all GigE network packets for streaming are dropped; The camera uses explicit triggering (see TriggerSelector for more information) and has not been triggered; Single frame acquisition mode is used and one frame has already been acquired; The acquisition has not been started or has been stopped. : TimeoutException thrown (file 'instantcameraimpl.h', line 1036)

This is my code

ptl = factory.CreateTl('BaslerGigE')
empty_camera_info = ptl.CreateDeviceInfo()

empty_camera_info.SetPropertyValue('IpAddress', ip_address)
empty_camera_info.SetPropertyValue('SubnetMask', subnet_mask)

camera_device = factory.CreateDevice(empty_camera_info)
camera = pylon.InstantCamera(camera_device)

#Camera Setup for capturing
countOfImagesToGrab = 10
camera.Open()
print("Using device ", camera.GetDeviceInfo().GetModelName())
camera.Height.SetValue(height)
camera.PixelFormat.Value = "Mono8"
camera.TriggerSelector.Value = 'FrameStart'
camera.TriggerMode.Value = 'On'
camera.TriggerSource.Value = 'Software'
# camera.MaxNumBuffer.Value = 5
# camera.AcquisiutionMode.Value = 'Single Frame'
# camera.AcquisitionStart.Execute()

camera.StartGrabbingMax(countOfImagesToGrab)
camera.TriggerSoftware.Execute()
print('Camera triggered')
print("starting capture")

actuatorThread = myThread("Actuator-thread", 1)
actuatorThread.start()

#don't grab any images until enought time has passsed for the first frame of the line scan to come through

timeDelay = (exp / 1000000) * height
time.sleep(timeDelay - 1.5)
degPerS = velocity / (16*14) * 1.8
imagingTime = int(360 // degPerS)
print(imagingTime)

while camera.IsGrabbing():
    print('Grabbing')
    result = camera.RetrieveResult(6000, pylon.TimeoutHandling_ThrowException)
    if result.GrabSucceeded():
        image = result.Array
        result.Release()
        path = "C:\\Users\\camron.sabahi-pourka\\Desktop"
        cv2.imwrite(path + "\\light_2.bmp", image)
        print("Image saved successfully.")
        result.Release()
        camera.StopGrabbing()
        camera.Close()
        break
    if not result.GrabSucceeded():
        print('Grab failed')
        result.Release()
        camera.StopGrabbing()
        camera.Close()
        print('Camera closed and grabbing stopped')
    result.Release()

result.Release()
camera.StopGrabbing()
camera.Close()```

from pypylon.

SMA2016a avatar SMA2016a commented on August 24, 2024

remove this line
ptl = factory.CreateTl('BaslerGigE')

try this:

ip_address = '192.168.1.40'
tlf = pylon.TlFactory.GetInstance()
cam_info = pylon.DeviceInfo()   
cam_info.SetIpAddress(ip_address)
cam = pylon.InstantCamera(tlf.CreateDevice(cam_info))

from pypylon.

SMA2016a avatar SMA2016a commented on August 24, 2024

@camron-musashi did you try this?

from pypylon.

camron-musashi avatar camron-musashi commented on August 24, 2024

Yes I did. For some reason I have no issues one on computer, however on the other computer (exact same computers) it throws errors and often crashes the computer. The computer shows issues both with pypylon and the Pylon Viewer GUI, but it was installed to have the packages needed for USB and gigE.

from pypylon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.