Open Topwiz opened 6 years ago
func filterimage(insertImage: UIImage) -> UIImage { let toonFilter = SmoothToonFilter() let testImage = insertImage let pictureInput = PictureInput(image:testImage) let pictureOutput = PictureOutput() pictureOutput.imageAvailableCallback = {image in // Do something with image } pictureInput --> toonFilter --> pictureOutput pictureInput.processImage(synchronously:true) }
I'm using this codes to filter still image but the problem is when I filter one image it is ok. But when I filter image repeatedly the pictureOutput has the before filtered image in it.
For example.
let filteredImage1 = filterimage(insertImage: PicOne) let filteredImage2 = filterimage(insertImage: PicTwo)
When I do this, filteredImage2 has the same image of filteredImage1.
and when I input the third image like this,
let filteredImage3 = filterimage(insertImage: PicThree)
this filteredImage3 has the image of filteredImage2
So I tried to use
removeAllTargets(), pictureOutput.removeSourceAtIndex(0)
after filtering one image but it has no change.Can anyone help me..
Did you find the decision of the problem?
@Semty
Yep. But it's a half answer. I was using a live View on the RenderView and changed a little code in gpuimage to get a full size of the .Photo preset. When I use the default func to capture photo it gets 750*1000 size. Using capturePhoto I got a Original image. and I got that image and rendered it again for the filtered image.
But the problem was. I was using camera --> filter --> renderView and getting a live filtered image on the view. But I called inputPhoto --> filter --> outputPhoto. But when I call that I think it crashes with the renderView that is in live. So I just made another renderview in hidden and I put camera --> filter --> renderView2 than I filtered image will live video is going on in renderView1 and it works.
But the problem is as I am using 2 renderView in live it takes ram × 2 ..
I think its not that good way to do this but it works..
I'm using this codes to filter still image but the problem is when I filter one image it is ok. But when I filter image repeatedly the pictureOutput has the before filtered image in it.
For example.
When I do this, filteredImage2 has the same image of filteredImage1.
and when I input the third image like this,
let filteredImage3 = filterimage(insertImage: PicThree)
this filteredImage3 has the image of filteredImage2
So I tried to use
removeAllTargets(), pictureOutput.removeSourceAtIndex(0)
after filtering one image but it has no change.Can anyone help me..