0

I've done a simple image processing using openCV that has a RGB-Array as the output.

is it possible to transfer and display my RGB-Array to a HTML without initially saving it as .jpg or any other picture format?

I can't use CGI, since I need to display this picture in an application, that only allows a HTML Code.

Ben
  • 21
  • 5
  • Can you better explain what you mean by "display my RGB-Array to a HTML without initially saving it"? – Scott Hunter Jan 21 '22 at 14:12
  • at the end I want to display my processed image (that I have as a RGB Array) from a HTML Code, without wasting memory saving the RGB initially as a .jpg or any other format of picture. – Ben Jan 21 '22 at 14:20
  • What is the difference between the image being in its own file or being in an HTML file? Especially since an image file can be compressed better than an image embedded in HTML? – Scott Hunter Jan 21 '22 at 14:25
  • I extracted a certain frame from a video and processed it using Python, therefore I don't have an actual image file. Instead I have only a RGB array as an output of Python script, which I want to display as an image using HTML. For sure I can save the RGB as an image file using Python, and display it with HTML, but I want to avoid that. – Ben Jan 21 '22 at 14:41
  • "I want to avoid that": why? What issue are you trying to address? – Scott Hunter Jan 21 '22 at 14:45
  • creating an image out of my RGB array from my python script. I want to avoid it since the timeframes that I need from one video are a lot. The idea is just displaying the timeframe, instead of saving each of the time frames as an individual image – Ben Jan 21 '22 at 14:52

1 Answers1

0

You could just draw them to an HTML canvas object. Drawing to canvas requires the use of JavaScript, but you could easily put your drawing function in the onload event of the body element. This StackOverflow thread talks more about how to draw individual pixels to a canvas object. They built a function for drawing individual pixels, and then demonstrate how to use it to draw a simple image. If you just build a script that takes the data in some hidden html element, and then have your Python script manipulate that hidden element, you'd only need to write your code once.

JohnAlexINL
  • 615
  • 7
  • 15