bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.42k stars 1.57k forks source link

High gamma when using CanvasFrame #2076

Closed iexavl closed 11 months ago

iexavl commented 11 months ago

When I submit a frame to CanvasFrame via the showImage(Frame image) method I get the image but the gamma is higher for some reason here is the initialization of the canvas:

final static CanvasFrame frame = new CanvasFrame("canvas",0.0); 

and here is how the image looks like submitted to the CanvasFrame: image and here is what it should actually look like: image

saudet commented 11 months ago

Try a gamma of 1.0 instead.

iexavl commented 11 months ago

@saudet genius(it worked). By the way I opened this issue (just saw your last comment from 5 days ago) https://github.com/bytedeco/javacv/issues/2064 and I realized where the problem was. It's true that most of the memory allocations happened because of the convert() method but the actual insane memory usage was coming from buffering decoded frames. Basically I am making something like a Video player and I am downloading from a web server. Naturally I want to buffer some frames ahead to smooth out playback but when buffering decoded frames it kind of goes to hell real fast. I changed the FFMpegFrameGrabber a bit and made methods dedicated to decoding audio and video frames instead of that happening in the grabFrame() method , that way I can buffer AVPackets and feed them into the decoder whenever I want to. I think it's a nice addition, I'm also using a custom seekCallback because the one that's written doesn't work for me. I have never made a commit to a github repository but perhaps I can clean up a bit here and there , make it possible for a user to make a custom opaque entirely and make a pull request.

saudet commented 11 months ago

Sounds good! Please do open a pull request