Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return both the original and the filtered image when capturing #42

Open
MrMatthewDavis opened this issue Oct 5, 2015 · 3 comments
Open

Comments

@MrMatthewDavis
Copy link

Hi there! First of all, amazing job with this camera. Really straightforward and fastttt! I wanted to see if there was a way to call takePhoto on the FastttFilterCamera and have it return both the original, unfiltered version of the image, as well as the filtered image. My best guess would be to capture the image without a filter, and then process the image with the self.fastttfilter.filter attribute to generate a second image. Not sure how much that would slow down the image capture process though.

I was going to fork and implement this on my own, but I figured I'd ask to see if there was a simpler way to do this before I embarked on that journey.

Thanks

EDIT: Just to clarify, my goal is to be able to show the user a live preview of the filters before capturing the photo, but to also allow the user to change the filter after the photo was captured without having to take a new photo.

@lauraskelton
Copy link
Contributor

@mad102190 This would be awesome! I don't know of a simpler way to do it. The cool thing about using the preview camera with no filter, then filtering the image after with fastttFilteredImageWithFilter (from UIImage+FastttFilters.h), is that you can let the user pick a filter and change them out, if you keep applying new filters to the original image.

If you want to show the filtered preview, then allow the filter to be changed afterwards, that's a much more complicated problem. I suspect the best way would be to use the lower-level GPUImage methods to change how the camera captures the image (check out the capturePhotoAsImageProcessedUpToFilter method on GPUImageStillCamera and how it's used in FastttFilterCamera - if you can figure out the right thing to change the filter parameter to there, you might be able to grab the unfiltered image from the filtered preview camera.)

@MrMatthewDavis
Copy link
Author

Ok cool I'll take a look and see what I come up with. If it works well, I'll submit a PR.

@MrMatthewDavis
Copy link
Author

I got it to work and submitted a Pull Request ( #43 ). Basically, I just use a plain filter below the fastFilter and only capture the photo up until that filter. Then, once the image is capture, I apply the filter to the captured image, and save the unfiltered image to a new property inside FastttCapturedImage.

For some reason the Travis-CI check is failing though, so I'll have to look at it more tomorrow. It runs perfectly fine in my tests, and I barely changed ~10 lines of code so I'm not exactly sure what Travis is complaining about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants