What is the optimal way to display images fast (C#)

天涯浪子 提交于 2019-12-25 07:39:28

问题


I am trying to create an application to display 8/16bit grayscale video. Currently, I create a BMP bitmap as RGB48 from frames, and simply assign

pictureBox.Image = bmp

This requires to create three redundant channels to make an RGB image look like grayscale (the grayscale image formats do not seem to work). This approach works on my fast computer, but slower computers can not keep up. So, I was hoping that someone could advise a better way of how to display images fast and efficient.

In my previous question, I was advised to display images on a panel using onPaint event, instead of picturebox. However, I still did not figure out how to do it.

  1. Is there a way to avoid creating three color channel for RGB if it is to be displayed as a grayscale?
  2. If I place a panel component on the current form, how to create an Onpaint event so the panel displays the image?

The general functioning of my program is as follows: One thread receives the image data and the other thread collects this data into a larger byte array. As soon as the larger array contains enough data for a full frame, I display the image.

来源:https://stackoverflow.com/questions/33401235/what-is-the-optimal-way-to-display-images-fast-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!