@umituz/react-native-ai-generation-content 1.17.229 → 1.17.231

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +346 -0
  3. package/package.json +1 -3
  4. package/src/domain/README.md +503 -0
  5. package/src/domains/content-moderation/README.md +363 -0
  6. package/src/domains/creations/README.md +394 -0
  7. package/src/domains/face-detection/README.md +395 -0
  8. package/src/domains/prompts/README.md +387 -0
  9. package/src/features/ai-hug/README.md +276 -0
  10. package/src/features/ai-kiss/README.md +276 -0
  11. package/src/features/anime-selfie/README.md +325 -0
  12. package/src/features/audio-generation/README.md +370 -0
  13. package/src/features/colorization/README.md +289 -0
  14. package/src/features/couple-future/README.md +270 -0
  15. package/src/features/face-swap/README.md +431 -0
  16. package/src/features/future-prediction/README.md +281 -0
  17. package/src/features/hd-touch-up/README.md +309 -0
  18. package/src/features/image-captioning/README.md +361 -0
  19. package/src/features/image-to-image/README.md +418 -0
  20. package/src/features/image-to-video/README.md +369 -0
  21. package/src/features/inpainting/README.md +302 -0
  22. package/src/features/meme-generator/README.md +327 -0
  23. package/src/features/photo-restoration/README.md +286 -0
  24. package/src/features/remove-background/README.md +292 -0
  25. package/src/features/remove-object/README.md +352 -0
  26. package/src/features/replace-background/README.md +288 -0
  27. package/src/features/script-generator/README.md +362 -0
  28. package/src/features/shared/README.md +280 -0
  29. package/src/features/sketch-to-image/README.md +296 -0
  30. package/src/features/style-transfer/README.md +301 -0
  31. package/src/features/text-to-image/README.md +394 -0
  32. package/src/features/text-to-video/README.md +245 -0
  33. package/src/features/text-to-voice/README.md +335 -0
  34. package/src/features/upscaling/README.md +247 -0
  35. package/src/infrastructure/config/README.md +310 -0
  36. package/src/infrastructure/middleware/README.md +378 -0
  37. package/src/infrastructure/orchestration/README.md +362 -0
  38. package/src/infrastructure/services/README.md +382 -0
  39. package/src/infrastructure/utils/README.md +523 -0
  40. package/src/infrastructure/wrappers/README.md +336 -0
  41. package/src/presentation/components/README.md +535 -0
  42. package/src/presentation/components/result/ResultStoryCard.tsx +1 -6
  43. package/src/presentation/hooks/README.md +380 -0
  44. package/src/presentation/layouts/README.md +374 -0
  45. package/src/presentation/screens/README.md +430 -0
  46. package/src/presentation/types/result-config.types.ts +3 -3
  47. package/src/presentation/layouts/types/.npmignore.tmp +0 -0
@@ -0,0 +1,395 @@
1
+ # Face Detection Domain
2
+
3
+ Face detection and analysis system for AI features.
4
+
5
+ ## Overview
6
+
7
+ The Face Detection domain provides comprehensive face detection and analysis capabilities. It's used by various AI features like face swap, AI hug, AI kiss, and more to detect, analyze, and process faces in images.
8
+
9
+ ## Features
10
+
11
+ - **Face Detection**: Detect faces in images
12
+ - **Face Analysis**: Analyze facial features and attributes
13
+ - **Multiple Faces**: Support for multiple faces in one image
14
+ - **Face Metrics**: Extract facial measurements and landmarks
15
+ - **Face Matching**: Compare and match faces
16
+ - **Bounding Boxes**: Get face bounding boxes for cropping
17
+ - **Landmarks**: Extract facial landmark points
18
+
19
+ ## Installation
20
+
21
+ This domain is part of `@umituz/react-native-ai-generation-content`.
22
+
23
+ ```bash
24
+ npm install @umituz/react-native-ai-generation-content
25
+ ```
26
+
27
+ ## Basic Usage
28
+
29
+ ### Detecting Faces
30
+
31
+ ```tsx
32
+ import { detectFaces } from '@umituz/react-native-ai-generation-content';
33
+
34
+ const result = await detectFaces({
35
+ imageBase64: 'base64...',
36
+ });
37
+
38
+ if (result.faces.length > 0) {
39
+ console.log(`Found ${result.faces.length} face(s)`);
40
+
41
+ result.faces.forEach(face => {
42
+ console.log('Face bounding box:', face.boundingBox);
43
+ console.log('Confidence:', face.confidence);
44
+ });
45
+ } else {
46
+ console.log('No faces detected');
47
+ }
48
+ ```
49
+
50
+ ### Analyzing Faces
51
+
52
+ ```tsx
53
+ import { analyzeFace } from '@umituz/react-native-ai-generation-content';
54
+
55
+ const analysis = await analyzeFace({
56
+ imageBase64: 'base64...',
57
+ faceIndex: 0, // Analyze first detected face
58
+ });
59
+
60
+ console.log('Gender:', analysis.gender);
61
+ console.log('Age:', analysis.age);
62
+ console.log('Emotions:', analysis.emotions);
63
+ console.log('Landmarks:', analysis.landmarks);
64
+ ```
65
+
66
+ ### Comparing Faces
67
+
68
+ ```tsx
69
+ import { compareFaces } from '@umituz/react-native-ai-generation-content';
70
+
71
+ const similarity = await compareFaces({
72
+ image1Base64: 'base64...',
73
+ image2Base64: 'base64...',
74
+ });
75
+
76
+ console.log('Similarity score:', similarity.score);
77
+ console.log('Is same person:', similarity.isSamePerson);
78
+ ```
79
+
80
+ ## Data Models
81
+
82
+ ### FaceDetectionResult
83
+
84
+ ```tsx
85
+ interface FaceDetectionResult {
86
+ faces: DetectedFace[];
87
+ imageWidth: number;
88
+ imageHeight: number;
89
+ processingTime: number;
90
+ }
91
+
92
+ interface DetectedFace {
93
+ id: string;
94
+ boundingBox: BoundingBox;
95
+ confidence: number;
96
+ landmarks?: FacialLandmarks;
97
+ }
98
+ ```
99
+
100
+ ### BoundingBox
101
+
102
+ ```tsx
103
+ interface BoundingBox {
104
+ x: number; // Top-left X coordinate
105
+ y: number; // Top-left Y coordinate
106
+ width: number;
107
+ height: number;
108
+ }
109
+ ```
110
+
111
+ ### FacialLandmarks
112
+
113
+ ```tsx
114
+ interface FacialLandmarks {
115
+ leftEye: Point;
116
+ rightEye: Point;
117
+ nose: Point;
118
+ mouth: Point;
119
+ leftEar: Point;
120
+ rightEar: Point;
121
+ chin: Point;
122
+ // Additional landmarks
123
+ allPoints: Point[];
124
+ }
125
+
126
+ interface Point {
127
+ x: number;
128
+ y: number;
129
+ }
130
+ ```
131
+
132
+ ### FaceAnalysis
133
+
134
+ ```tsx
135
+ interface FaceAnalysis {
136
+ gender: 'male' | 'female' | 'unknown';
137
+ genderConfidence: number;
138
+ age: {
139
+ min: number;
140
+ max: number;
141
+ estimated: number;
142
+ };
143
+ emotions: {
144
+ happy: number;
145
+ sad: number;
146
+ angry: number;
147
+ surprised: number;
148
+ neutral: number;
149
+ };
150
+ dominantEmotion: string;
151
+ landmarks: FacialLandmarks;
152
+ faceQuality: {
153
+ brightness: number;
154
+ sharpness: number;
155
+ overall: 'good' | 'fair' | 'poor';
156
+ };
157
+ }
158
+ ```
159
+
160
+ ### FaceComparison
161
+
162
+ ```tsx
163
+ interface FaceComparison {
164
+ score: number; // 0-1 similarity score
165
+ isSamePerson: boolean;
166
+ confidence: number;
167
+ matchDetails: {
168
+ eyeDistance: number;
169
+ faceShape: number;
170
+ featureSimilarity: number;
171
+ };
172
+ }
173
+ ```
174
+
175
+ ## Hooks
176
+
177
+ ### useFaceDetection
178
+
179
+ ```tsx
180
+ import { useFaceDetection } from '@umituz/react-native-ai-generation-content';
181
+
182
+ function FaceDetectionComponent() {
183
+ const { detectFaces, detecting, result, error } = useFaceDetection();
184
+
185
+ const handleDetect = async (imageBase64: string) => {
186
+ await detectFaces({ imageBase64 });
187
+ };
188
+
189
+ return (
190
+ <View>
191
+ {result && (
192
+ <Text>Detected {result.faces.length} face(s)</Text>
193
+ )}
194
+ {error && <Text>Error: {error}</Text>}
195
+ </View>
196
+ );
197
+ }
198
+ ```
199
+
200
+ ### useFaceAnalysis
201
+
202
+ ```tsx
203
+ import { useFaceAnalysis } from '@umituz/react-native-ai-generation-content';
204
+
205
+ function FaceAnalysisComponent() {
206
+ const { analyzeFace, analyzing, analysis, error } = useFaceAnalysis();
207
+
208
+ const handleAnalyze = async (imageBase64: string) => {
209
+ await analyzeFace({ imageBase64 });
210
+ };
211
+
212
+ return (
213
+ <View>
214
+ {analysis && (
215
+ <View>
216
+ <Text>Gender: {analysis.gender}</Text>
217
+ <Text>Age: ~{analysis.age.estimated}</Text>
218
+ <Text>Emotion: {analysis.dominantEmotion}</Text>
219
+ </View>
220
+ )}
221
+ </View>
222
+ );
223
+ }
224
+ ```
225
+
226
+ ## Advanced Usage
227
+
228
+ ### Face Cropping
229
+
230
+ ```tsx
231
+ import { cropFace } from '@umituz/react-native-ai-generation-content';
232
+
233
+ // Crop face from image
234
+ const croppedImage = await cropFace({
235
+ imageBase64: 'base64...',
236
+ faceIndex: 0,
237
+ padding: 20, // Add padding around face
238
+ });
239
+
240
+ // Result: Base64 of cropped face image
241
+ ```
242
+
243
+ ### Face Quality Check
244
+
245
+ ```tsx
246
+ import { checkFaceQuality } from '@umituz/react-native-ai-generation-content';
247
+
248
+ const quality = await checkFaceQuality({
249
+ imageBase64: 'base64...',
250
+ faceIndex: 0,
251
+ });
252
+
253
+ if (quality.overall === 'good') {
254
+ console.log('Good quality face for processing');
255
+ } else {
256
+ console.log('Face quality issues:', quality.issues);
257
+ }
258
+ ```
259
+
260
+ ### Multiple Face Processing
261
+
262
+ ```tsx
263
+ import { detectFaces, cropFace } from '@umituz/react-native-ai-generation-content';
264
+
265
+ const result = await detectFaces({ imageBase64: 'base64...' });
266
+
267
+ // Process all detected faces
268
+ const croppedFaces = await Promise.all(
269
+ result.faces.map(async (face, index) => {
270
+ return await cropFace({
271
+ imageBase64: 'base64...',
272
+ faceIndex: index,
273
+ padding: 20,
274
+ });
275
+ })
276
+ );
277
+ ```
278
+
279
+ ### Face Matching
280
+
281
+ ```tsx
282
+ import { findMatchingFace } from '@umituz/react-native-ai-generation-content';
283
+
284
+ // Find a specific face in a group photo
285
+ const match = await findMatchingFace({
286
+ targetImageBase64: 'base64...', // Face to find
287
+ sourceImageBase64: 'base64...', // Group photo
288
+ });
289
+
290
+ if (match.found) {
291
+ console.log('Found face at index:', match.faceIndex);
292
+ console.log('Similarity:', match.similarity);
293
+ }
294
+ ```
295
+
296
+ ## Component Examples
297
+
298
+ ### Face Detection Overlay
299
+
300
+ ```tsx
301
+ import { FaceDetectionOverlay } from '@umituz/react-native-ai-generation-content';
302
+
303
+ <FaceDetectionOverlay
304
+ imageUri={imageUri}
305
+ faces={detectedFaces}
306
+ showLandmarks
307
+ showBoundingBoxes
308
+ boundingBoxColor="#00FF00"
309
+ landmarkColor="#FF0000"
310
+ />
311
+ ```
312
+
313
+ ### Face Analysis Display
314
+
315
+ ```tsx
316
+ import { FaceAnalysisDisplay } from '@umituz/react-native-ai-generation-content';
317
+
318
+ <FaceAnalysisDisplay
319
+ analysis={faceAnalysis}
320
+ showEmotions
321
+ showAge
322
+ showGender
323
+ showLandmarks
324
+ />
325
+ ```
326
+
327
+ ## Use Cases
328
+
329
+ ### Face Swap Preparation
330
+
331
+ ```tsx
332
+ // Detect faces before face swap
333
+ const result = await detectFaces({
334
+ imageBase64: sourceImage,
335
+ });
336
+
337
+ if (result.faces.length === 0) {
338
+ Alert.alert('No Face Detected', 'Please choose a photo with a clear face');
339
+ } else if (result.faces.length > 1) {
340
+ // Ask user to select which face to use
341
+ showFaceSelection(result.faces);
342
+ }
343
+ ```
344
+
345
+ ### Quality Validation
346
+
347
+ ```tsx
348
+ // Check face quality before processing
349
+ const quality = await checkFaceQuality({
350
+ imageBase64: image,
351
+ });
352
+
353
+ if (quality.overall === 'poor') {
354
+ Alert.alert(
355
+ 'Poor Photo Quality',
356
+ 'Please use a clearer, well-lit photo for best results',
357
+ [{ text: 'OK' }]
358
+ );
359
+ return;
360
+ }
361
+ ```
362
+
363
+ ### Face Verification
364
+
365
+ ```tsx
366
+ // Verify if two photos show the same person
367
+ const comparison = await compareFaces({
368
+ image1Base64: photo1,
369
+ image2Base64: photo2,
370
+ });
371
+
372
+ if (comparison.isSamePerson) {
373
+ console.log('Same person detected');
374
+ } else {
375
+ console.log('Different people');
376
+ }
377
+ ```
378
+
379
+ ## Best Practices
380
+
381
+ 1. **Image Quality**: Use high-quality, well-lit photos
382
+ 2. **Face Visibility**: Ensure faces are clearly visible
383
+ 3. **Frontal Faces**: Forward-facing photos work best
384
+ 4. **Single Face**: Features work best with single clear faces
385
+ 5. **Error Handling**: Always handle cases where no face is detected
386
+
387
+ ## Related Features
388
+
389
+ - [Face Swap](../../features/face-swap) - Swap faces between images
390
+ - [AI Hug](../../features/ai-hug) - Generate AI hug images
391
+ - [AI Kiss](../../features/ai-kiss) - Generate AI kiss images
392
+
393
+ ## License
394
+
395
+ MIT