Closed bang9 closed 5 years ago
I solved problem like this
GPUImageRawDataInput -> levelsFilter -> whiteBalanceFilter -> GPUImageView
// Just update GPUImageRawDataInput data on every frame
// imageSource = GPUImageRawDataInput(...)
let newImage = getCurrentFrameImage()
DispatchQueue.main.async {
let imageData = newImage.cgImage?.dataProvider?.data
let imageBytes = UnsafeMutablePointer(mutating: CFDataGetBytePtr(dataFromImageDataProvider))
//need to imageBytes convert RGBA to BGRA, I use opencv
self._imageSource.updateData(fromBytes: UnsafeMutablePointer<GLubyte>(imageBytes), size: newImage.size)
self._imageSource.processData()
}
There's a category named "GPUImagePicture+TextureSubimage.h", you can also use this to update the image.
I have more than a dozen pictures(It is not video, just continuous image), and I can change these pictures through the thumbnail slider. (when changed position of thumbnail slider, picture will be changed)
I show up picture like this
The image changes with the sliding speed. so I just changed image like this (while sliding on every frames)
It works, but cause stuck of slider ui(when create a new GPUImagePicture object) For this reason, I tried replace main queue with global queue and sliding smoothly very well but It crash when sliding fast..
There is no way to change image data in GPUImagePicture?