Boosting Frame Rate with ROI on Basler Cameras Using the pylon SDK (C# / .NET 8)

Boosting Frame Rate with ROI on Basler Cameras Using the pylon SDK (C# / .NET 8)

When developing machine-vision applications, you may find yourself asking:

  • “Can I increase the frame rate if I only need a portion of the image?”
  • “Can I reduce image size to speed up processing?”

The answer is often yes—by using ROI (Region of Interest).

By reducing the sensor readout area, you can significantly decrease data size and improve achievable frame rate. In this article, we explore how to configure ROI using the Basler pylon SDK in C#, along with real-world comparisons of full-frame vs ROI performance.


✔ What You Will Learn

  • How to configure ROI (Region of Interest) on Basler cameras
  • How ROI improves frame rate and processing speed
  • Common constraints, pitfalls, and error handling

✔ Environment

Item Details
Camera Basler acA2500-14gm
SDK Basler pylon Camera Software Suite
Lang C# / .NET 8 (Windows)
Lens VS-LD25N (25 mm C-mount)

🔍 What Is ROI?

ROI (Region of Interest) defines a rectangular area on the camera sensor that you want to capture. Basler cameras expose four parameters to control ROI:

  • OffsetX — horizontal position
  • OffsetY — vertical position
  • Width — ROI width
  • Height — ROI height

Reducing ROI has several benefits:

  • Smaller image size
  • Shorter readout time → higher potential frame rate
  • Faster downstream processing

🔧 Setting ROI in C#

Below are helper methods added to the BaslerCameraSample class from previous articles:

Setting ROI in one operation

Because ROI must remain inside the sensor boundaries, the order of parameter updates matters.

ROI using Rect (WPF)


📈 Why ROI Increases Frame Rate

Sensor readout time is almost always proportional to the number of pixels captured. Reducing the readout area:

  • Lowers pixel count
  • Reduces required bandwidth
  • Allows the camera to reach higher frame rates

This effect is independent of exposure time, so even long exposures benefit from faster readout afterward.


✔ Constraints When Setting ROI

Parameter Notes
Width / Height Many Basler models require values to follow a specific increment (2, 4, 8, 16… depending on sensor)
OffsetX / OffsetY Must not exceed sensor boundaries

To inspect the increment value:

Example test:


📏 Testing Frame Rate with ROI


🧪 Real-World Comparison

Full Resolution (2592 × 1944)

Frame timestamps demonstrate slower readout:

Frame 0 1 2 3 4
T [ms] 72 140 209 277 346
72ms 140ms 209ms 277 346

ROI (640 × 480)

Frame 0 1 2 3 4
T [ms] 23 67 87 120 154
23ms 67ms 87ms 120ms 154ms

Summary Comparison

Mode Resolution Resulting Frame Rate
Full Frame 2592×1944 ~14.6 fps
ROI 640×480 ~30.0 fps

→ ROI doubles the effective frame rate in this test.


⚠️ Common Errors & Solutions

Issue Cause
InvalidParameterException ROI exceeds sensor bounds, or width/height violates increments
No frames after setting ROI Some camera models require reinitialization after ROI changes

📝 Summary

  • ROI can significantly reduce readout time and increase frame rate
  • Combining ROI with proper frame-rate settings improves real-time performance
  • Pay attention to width/height increments and sensor boundaries
  • Ideal for speeding up burst capture and reducing processing load

筆者: @MilleVision


📦 Full Sample Code Package

👉 https://millevision.booth.pm/items/7316233 Includes ROI, burst capture, trigger control, and full pylon SDK integration.(With Japanese Comment)

コメント

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA