BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.25k stars 4.61k forks source link

Sometimes camera shows black screen #284

Closed jadelmag closed 12 years ago

jadelmag commented 12 years ago

Sometimes when you change filters you have a black screen in your output. I have this problem with AdaptiveThreshold and GPUImageSmoothToonFilter with stillcamera.

How can i solve it? Only happens with this filters

nocaseguy commented 12 years ago

How many filter do you have in your pipe? For my case, it works if I have less than 3 filters. More than that, sometimes it turns black...

jadelmag commented 12 years ago

well, my problem is with GPUImageToonFilter and AdaptiveThreshold, and they use more than 3 filters So i think this is the problem.

Thanks

nocaseguy commented 12 years ago

Have you tried "prepareForImageCapture" on the last filter?

jadelmag commented 12 years ago

Yes, or I think so...

ordinary commented 12 years ago

each filters use prepareForImageCapture。

BradLarson commented 12 years ago

This is a known issue (see other issues here) that I am working on.

iamcam commented 12 years ago

Well, I'm glad I found this before spending too much time. My filter chain looks something like crop -> {group} -> output, where group is subclassed and constructs ToneCurve -> Monochrome -> Vignette. Seems that removing the vignette is the most reliable, though not perfect. Calling prepareForImageCapture doesn't seem to work reliably as it should.

BradLarson commented 12 years ago

Try this now. I believe that I've tracked down where the black frames were coming from. The latest code in the repository should fix this.

nocaseguy commented 12 years ago

Tested. It works! And now I dont even have to use "prepareForImageCapture". Nice work, Brad-san!

iamcam commented 12 years ago

I think that did it! I can't reproduce the bug anymore.

Great work!

ForrestShi commented 12 years ago

When I use GPUImageSmoothToonFilter, it is quite easy to reproduce this black screen issue again. When use GPUImageToonFilter , this issue happen randomly. Even it is black screen, it can still provide the valid data because it is okay capture the real image.

What is the root cause of the black screen ?