Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# iOS-GPUImage-Plus
GPU accelerated filters for iOS based on OpenGL.

__New feature__: Face effects will be created with the ios11's `VNSequenceRequestHandler` & `VNDetectFaceLandmarksRequest`.
__Features__:
- Hundreds of built-in image filters
- Real-time camera filters
- Video player with filters
- **Image Deformation/Liquify** - Interactive mesh-based image deformation with forward, bloat, wrinkle, and restore tools (similar to Photoshop's Liquify tool)
- Face effects with iOS 11's `VNSequenceRequestHandler` & `VNDetectFaceLandmarksRequest`

>Android version: [https://github.com/wysaid/android-gpuimage-plus](https://github.com/wysaid/android-gpuimage-plus "http://wysaid.org")

Expand Down Expand Up @@ -97,6 +102,57 @@ En: [https://github.com/wysaid/android-gpuimage-plus/wiki/Parsing-String-Rule-En

Ch: [https://github.com/wysaid/android-gpuimage-plus/wiki/Parsing-String-Rule](https://github.com/wysaid/android-gpuimage-plus/wiki/Parsing-String-Rule "http://wysaid.org")

### 4. Image Deformation (Liquify) ###

The library includes a powerful mesh-based image deformation feature, similar to Photoshop's Liquify tool. This allows interactive image manipulation with various deformation modes:

- **Forward**: Push pixels in the direction of your finger movement
- **Bloat**: Expand/inflate pixels outward from the touch point
- **Wrinkle**: Contract/shrink pixels toward the touch point
- **Restore**: Restore deformed areas back to the original image

___Sample Code for Image Deformation___
```objc
#import "cgeDeformFilterWrapper.h"

// Create a deform filter wrapper
CGEDeformFilterWrapper* deformWrapper = [CGEDeformFilterWrapper createWithWidth:imageWidth
height:imageHeight
stride:10.0f];

// Set undo steps
[deformWrapper setUndoSteps:50];

// Forward deform (push)
[deformWrapper forwardDeformWithStartX:startX startY:startY
endX:endX endY:endY
width:canvasWidth height:canvasHeight
radius:100.0f intensity:0.15f];

// Bloat deform (expand)
[deformWrapper bloatDeformWithX:x y:y
width:canvasWidth height:canvasHeight
radius:100.0f intensity:0.15f];

// Wrinkle deform (shrink)
[deformWrapper wrinkleDeformWithX:x y:y
width:canvasWidth height:canvasHeight
radius:100.0f intensity:0.15f];

// Undo/Redo
if ([deformWrapper canUndo]) {
[deformWrapper undo];
}

// Restore mesh to original
[deformWrapper restore];

// Show/hide mesh overlay
[deformWrapper showMesh:YES];
```

Check out the **Image Deform Demo** in the demo app to see this feature in action!

## Tool ##

Some utils are available for creating filters: [https://github.com/wysaid/cge-tools](https://github.com/wysaid/cge-tools "http://wysaid.org")
Expand Down
26 changes: 26 additions & 0 deletions demo/cgeDemo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@
<segue destination="q5Z-Ce-WcC" kind="modal" id="SkW-TZ-1by"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="deform-btn-001">
<rect key="frame" x="16" y="373" width="175" height="51"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Image Deform Demo"/>
<connections>
<segue destination="deform-vc-001" kind="modal" id="deform-segue-001"/>
</connections>
</button>
</subviews>
</scrollView>
</subviews>
Expand Down Expand Up @@ -326,5 +334,23 @@
</objects>
<point key="canvasLocation" x="-864" y="666"/>
</scene>
<!--ImageDeformViewController-->
<scene sceneID="deform-scene-001">
<objects>
<viewController modalPresentationStyle="fullScreen" id="deform-vc-001" customClass="ImageDeformViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="deform-top-001"/>
<viewControllerLayoutGuide type="bottom" id="deform-bottom-001"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="deform-view-001">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="deform-responder-001" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="796" y="1008"/>
</scene>
</scenes>
</document>
13 changes: 13 additions & 0 deletions demo/cgeDemo/ImageDeformViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// ImageDeformViewController.h
// cgeDemo
//
// Created on 2024-11-28
// Description: Demo view controller for image deformation/liquify feature
//

#import <UIKit/UIKit.h>

@interface ImageDeformViewController : UIViewController

@end
Loading