Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3318394
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:42:02+00:00 2026-05-17T22:42:02+00:00

here’s the problem: I have a custom hardware device and I have to grab

  • 0

here’s the problem: I have a custom hardware device and I have to grab images from it in C#/WPF and display them in a window, all with 120+ FPS.

The problem is that there is no event to indicate the images are ready, but I have to constantly poll the device and check whether there are any new images and then download them.

There are apparently a handful of ways to do it, but I haven’t been able to find the right one yet.

Here’s what I tried:

  • A simple timer (or DispatcherTimer) – works great for slower frame rates but I can’t get it past let’s say, 60 FPS.

  • An single threaded infinite loop – quite fast but I have to put the DoEvents/it’s WPF equivalent in the loop in order for window to be redrawn; this has some other unwanted (strange) consequences such as key press events from some controls not being fired etc..

  • Doing polling/downloading in another thread and displaying in UI thread, something like this:

     new Thread(() =>
            {
                while (StillCapturing)
                {
                    if (Camera.CheckForAndDownloadImage(CameraInstance))
                    {
                        this.Dispatcher.Invoke((Action)this.DisplayImage);
                    }
                }
            }).Start();
    

    Well, this works relatively well, but puts quite a load on a CPU and of course completely kills the machine if it doesn’t have more than one CPU/core, which is unacceptable. Also, I there is a large number of thread contentions this way.

The question is obvious – are there any better alternatives, or is one of these the way to go in this case?

Update:
I somehow forgot to mention that (well, forgot to think about it while writing this question), but of course I don’t need all frames to be displayed, however I still need to capture all of them so they can be saved to a hard drive.

Update2:
I found out that the DispatcherTimer method is slow not because it can’t process everything fast enough, but because the DispatcherTimer waits for the next vertical sync before firing the tick event; which is actually good in my case, because in the tick event I can save all pending images to a memory buffer (used for saving images to disk) and display just the last one.

As for the old computers being completely “killed” by capturing, it appears that WPF falls back to software rendering which is very slow. There’s probably nothing I can do about.

Thanks for all the answers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:42:02+00:00Added an answer on May 17, 2026 at 10:42 pm

    I think you’re trying for too simplistic of an approach. Here’s what I would do.

    a) put a Thread.Sleep(5) in your polling loop, that should allow you to get close to 120fps while still keeping CPU times low.

    b) Only update the display with every 5th frame or so. That will cut down on the amount of processing as I’m not sure that WPF is made to handle much more than 60fps.

    c) Use ThreadPool to spawn a subtask for each frame that will then go and save it to the disk (in a seperate file per frame), that way you won’t be as limited by disk performance. Extra frames will just pile up in memory.

    Personally I would implement them in that order. Chances are a or b will fix your problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my problem : I have a post controller with the action create.
Here is the problem that I am trying to solve. I have two folders
Here is my problem.. I have the option to create(add) two new input fields,
Here's the code I have. It works. The only problem is that the first
Here's a problem I ran into recently. I have attributes strings of the form
Here I am trying to retrieve the response from the server and display it,
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
Here is the script I'm using, copied directly from Google: <script type=text/javascript> var _gaq
Here's the basic setup: I have a thin bar at the top of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.