Malaji71 commited on
Commit
a4174c2
·
verified ·
1 Parent(s): 77acbe4

Upload professional_photography.py

Browse files
Files changed (1) hide show
  1. professional_photography.py +1155 -0
professional_photography.py ADDED
@@ -0,0 +1,1155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Professional Photography Knowledge Base
3
+ Advanced camera settings, lighting, and composition rules from expert photography practice
4
+ Extracted from 30+ years of professional photography experience
5
+ """
6
+
7
+ import re
8
+ from typing import Dict, List, Optional, Tuple, Any
9
+
10
+ # =====================================================
11
+ # PARTE 1: CONFIGURACIONES BASE Y TIPOS DE ESCENA
12
+ # =====================================================
13
+
14
+ EXPERT_PHOTOGRAPHY_KNOWLEDGE = {
15
+
16
+ # TIPOS DE ESCENA Y CONFIGURACIONES PROFESIONALES
17
+ "scene_types": {
18
+
19
+ "portrait_studio": {
20
+ "description": "Professional studio portrait photography",
21
+ "camera_settings": {
22
+ "mode": "AV/A",
23
+ "aperture": "f/2.8",
24
+ "iso": "100-400",
25
+ "focus": "single point AF on eyes",
26
+ "metering": "spot or center-weighted"
27
+ },
28
+ "equipment": {
29
+ "camera": "Canon EOS R5",
30
+ "lens": "85mm f/1.4",
31
+ "alternative_lens": "105mm f/2.8"
32
+ },
33
+ "lighting": {
34
+ "primary": "3-point studio lighting setup",
35
+ "key_light": "large softbox at 45 degrees",
36
+ "fill_light": "reflector or secondary softbox",
37
+ "rim_light": "subtle rim light for separation"
38
+ },
39
+ "composition": [
40
+ "rule of thirds for eye placement",
41
+ "shallow depth of field to isolate subject",
42
+ "focus on nearest eye for sharpness",
43
+ "leave breathing room in frame direction"
44
+ ]
45
+ },
46
+
47
+ "portrait_exterior": {
48
+ "description": "Natural light outdoor portrait photography",
49
+ "camera_settings": {
50
+ "mode": "AV/A",
51
+ "aperture": "f/2.8-f/4",
52
+ "iso": "100-800",
53
+ "focus": "continuous AF for moving subjects",
54
+ "exposure_compensation": "+0.3 to +0.7 for faces"
55
+ },
56
+ "equipment": {
57
+ "camera": "Canon EOS R6",
58
+ "lens": "85mm f/1.4",
59
+ "alternative_lens": "70-200mm f/2.8"
60
+ },
61
+ "lighting": {
62
+ "preferred": "soft natural light",
63
+ "golden_hour": "best for warm, flattering light",
64
+ "overcast": "natural diffusion, even lighting",
65
+ "open_shade": "avoid harsh direct sunlight",
66
+ "reflector": "use to fill shadows when needed"
67
+ },
68
+ "composition": [
69
+ "environmental context for storytelling",
70
+ "rule of thirds with subject placement",
71
+ "watch background for distractions",
72
+ "use natural leading lines"
73
+ ]
74
+ },
75
+
76
+ "street_photography": {
77
+ "description": "Spontaneous urban and documentary photography",
78
+ "camera_settings": {
79
+ "mode": "TV/S or Program",
80
+ "shutter_speed": "1/125s minimum for sharp subjects",
81
+ "aperture": "f/5.6-f/8 for sufficient depth of field",
82
+ "iso": "400-1600 adaptive to lighting",
83
+ "focus": "zone focusing or continuous AF"
84
+ },
85
+ "equipment": {
86
+ "camera": "Leica M11",
87
+ "lens": "35mm f/1.4",
88
+ "alternative_lens": "50mm f/2.8"
89
+ },
90
+ "lighting": {
91
+ "available_light": "work with existing conditions",
92
+ "dramatic_contrast": "use shadows and highlights",
93
+ "window_light": "exploit urban light sources",
94
+ "golden_hour": "warm street lighting mix"
95
+ },
96
+ "composition": [
97
+ "anticipation of decisive moments",
98
+ "rule of Z for visual flow",
99
+ "layered composition with depth",
100
+ "leading lines from urban architecture",
101
+ "respect distance and privacy"
102
+ ]
103
+ },
104
+
105
+ "landscape": {
106
+ "description": "Natural landscape and scenic photography",
107
+ "camera_settings": {
108
+ "mode": "AV/A or Manual",
109
+ "aperture": "f/8-f/11 for maximum sharpness",
110
+ "iso": "100-400 for lowest noise",
111
+ "focus": "hyperfocal distance or infinity",
112
+ "exposure": "often requires bracketing"
113
+ },
114
+ "equipment": {
115
+ "camera": "Phase One XT",
116
+ "lens": "24-70mm f/4",
117
+ "wide_alternative": "16-35mm f/2.8",
118
+ "telephoto_alternative": "70-200mm f/4"
119
+ },
120
+ "lighting": {
121
+ "golden_hour": "optimal warm light",
122
+ "blue_hour": "dramatic twilight colors",
123
+ "overcast": "even light for forests/waterfalls",
124
+ "side_lighting": "enhance texture and depth"
125
+ },
126
+ "composition": [
127
+ "rule of thirds for horizon placement",
128
+ "foreground, middle ground, background layers",
129
+ "leading lines from natural features",
130
+ "point of interest as focal anchor",
131
+ "patience for optimal light conditions"
132
+ ]
133
+ },
134
+
135
+ "architecture": {
136
+ "description": "Building and structural photography",
137
+ "camera_settings": {
138
+ "mode": "AV/A",
139
+ "aperture": "f/8-f/11 for sharp details",
140
+ "iso": "100-400",
141
+ "focus": "single point AF on key details",
142
+ "perspective_correction": "use tilt-shift when available"
143
+ },
144
+ "equipment": {
145
+ "camera": "Canon EOS R5",
146
+ "lens": "24-70mm f/2.8",
147
+ "wide_lens": "16-35mm f/2.8",
148
+ "tilt_shift": "24mm f/3.5 TS-E for correction"
149
+ },
150
+ "lighting": {
151
+ "side_lighting": "reveal texture and form",
152
+ "golden_hour": "warm light on facades",
153
+ "blue_hour": "interior lights vs exterior",
154
+ "overcast": "even light for details"
155
+ },
156
+ "composition": [
157
+ "strong geometric lines and patterns",
158
+ "symmetry and balance",
159
+ "leading lines and vanishing points",
160
+ "watch for converging verticals",
161
+ "isolate key architectural elements"
162
+ ]
163
+ },
164
+
165
+ "action_sports": {
166
+ "description": "High-speed movement and sports photography",
167
+ "camera_settings": {
168
+ "mode": "TV/S",
169
+ "shutter_speed": "1/500s+ to freeze motion",
170
+ "aperture": "f/2.8-f/4 for subject isolation",
171
+ "iso": "800-3200 adaptive",
172
+ "focus": "continuous AF with tracking",
173
+ "burst_mode": "high speed continuous"
174
+ },
175
+ "equipment": {
176
+ "camera": "Sony A1",
177
+ "lens": "70-200mm f/2.8",
178
+ "longer_lens": "300mm f/2.8",
179
+ "wide_lens": "24-70mm f/2.8 for close action"
180
+ },
181
+ "lighting": {
182
+ "fast_shutter": "freeze motion priority",
183
+ "available_light": "work with venue lighting",
184
+ "iso_performance": "accept higher ISO for speed"
185
+ },
186
+ "composition": [
187
+ "anticipate action and peak moments",
188
+ "leave space in direction of movement",
189
+ "fill frame with subject",
190
+ "capture emotion and intensity",
191
+ "continuous focus tracking"
192
+ ]
193
+ }
194
+ },
195
+
196
+ # PRINCIPIOS DE ILUMINACIÓN PROFESIONAL
197
+ "lighting_principles": {
198
+
199
+ "natural_light_types": {
200
+ "golden_hour": {
201
+ "timing": "first hour after sunrise, last hour before sunset",
202
+ "characteristics": "warm, soft, directional",
203
+ "best_for": "portraits, landscapes, architecture",
204
+ "camera_settings": "lower ISO, wider aperture possible"
205
+ },
206
+ "blue_hour": {
207
+ "timing": "20-30 minutes after sunset",
208
+ "characteristics": "even blue light, dramatic mood",
209
+ "best_for": "cityscapes, architecture with lights",
210
+ "camera_settings": "tripod required, longer exposures"
211
+ },
212
+ "overcast": {
213
+ "characteristics": "soft, even, diffused light",
214
+ "best_for": "portraits, forests, waterfalls",
215
+ "advantage": "no harsh shadows",
216
+ "camera_settings": "watch for flat contrast"
217
+ },
218
+ "open_shade": {
219
+ "characteristics": "soft directional light",
220
+ "best_for": "outdoor portraits",
221
+ "advantage": "avoids harsh sun",
222
+ "camera_settings": "may need exposure compensation"
223
+ }
224
+ },
225
+
226
+ "artificial_light_setups": {
227
+ "three_point_lighting": {
228
+ "key_light": "primary light source at 45 degrees",
229
+ "fill_light": "softer light to reduce shadows",
230
+ "rim_light": "separation from background",
231
+ "ratio": "3:1 or 2:1 key to fill for drama"
232
+ },
233
+ "window_lighting": {
234
+ "side_lighting": "place subject 90 degrees to window",
235
+ "frontal": "face window directly for even light",
236
+ "reflector_use": "bounce light back to fill shadows"
237
+ }
238
+ },
239
+
240
+ "lighting_directions": {
241
+ "frontal": {
242
+ "effect": "even illumination, minimal shadows",
243
+ "mood": "clean, professional, safe",
244
+ "best_for": "corporate portraits, documentation"
245
+ },
246
+ "side_lateral": {
247
+ "effect": "dramatic shadows, depth and texture",
248
+ "mood": "artistic, mysterious, powerful",
249
+ "best_for": "creative portraits, artistic work"
250
+ },
251
+ "backlighting": {
252
+ "effect": "rim lighting, silhouettes",
253
+ "mood": "dreamy, romantic, dramatic",
254
+ "technical": "watch for exposure compensation"
255
+ },
256
+ "top_lighting": {
257
+ "effect": "dramatic shadows under eyes",
258
+ "mood": "harsh, dramatic, theatrical",
259
+ "use_carefully": "can be unflattering for portraits"
260
+ }
261
+ }
262
+ }
263
+ # =====================================================
264
+ # PARTE 2: REGLAS DE COMPOSICIÓN Y TÉCNICAS AVANZADAS
265
+ # =====================================================
266
+
267
+ # REGLAS DE COMPOSICIÓN PROFESIONAL
268
+ "composition_rules": {
269
+
270
+ "rule_of_thirds": {
271
+ "principle": "divide frame into 9 equal sections",
272
+ "application": "place key elements on intersection points",
273
+ "subject_placement": "eyes on upper third line for portraits",
274
+ "horizon_placement": "upper or lower third for landscapes",
275
+ "when_to_break": "center composition for symmetry or impact"
276
+ },
277
+
278
+ "rule_of_z": {
279
+ "principle": "visual examination technique following Z pattern",
280
+ "purpose": "eliminate distracting elements systematically",
281
+ "application": "scan image from top-left to bottom-right",
282
+ "focus_check": "ensure sharp focus where intended",
283
+ "composition_check": "verify all elements contribute to story"
284
+ },
285
+
286
+ "leading_lines": {
287
+ "purpose": "guide viewer's eye through the image",
288
+ "types": ["diagonal lines", "curved lines", "converging lines"],
289
+ "sources": ["roads", "rivers", "architecture", "shadows"],
290
+ "technique": "use lines to lead to main subject"
291
+ },
292
+
293
+ "vanishing_points": {
294
+ "single_point": "all lines converge to one point",
295
+ "two_point": "vertical lines stay vertical, horizontals converge",
296
+ "application": "create depth and draw attention",
297
+ "photography_use": "architecture, streets, interiors"
298
+ },
299
+
300
+ "fibonacci_spiral": {
301
+ "mathematical_basis": "golden ratio spiral",
302
+ "composition_tool": "place subject at spiral intersection",
303
+ "relationship_to_thirds": "refined version of rule of thirds",
304
+ "application": "when precise composition balance needed"
305
+ },
306
+
307
+ "symmetry_and_patterns": {
308
+ "perfect_symmetry": "exact mirror image composition",
309
+ "near_symmetry": "almost symmetrical with subtle variation",
310
+ "pattern_breaking": "disruption in regular pattern creates focus",
311
+ "application": "architecture, reflections, nature patterns"
312
+ },
313
+
314
+ "depth_layers": {
315
+ "foreground": "nearest elements to camera",
316
+ "middle_ground": "main subject area typically here",
317
+ "background": "context and environment",
318
+ "technique": "create separation between layers",
319
+ "depth_cues": "overlapping, size variation, atmospheric perspective"
320
+ }
321
+ },
322
+
323
+ # ÁNGULOS Y PERSPECTIVAS
324
+ "camera_angles": {
325
+
326
+ "eye_level_normal": {
327
+ "description": "camera at subject's eye level",
328
+ "effect": "neutral, natural perspective",
329
+ "psychological_impact": "equality, relatability",
330
+ "best_for": "portraits, documentary, street photography"
331
+ },
332
+
333
+ "low_angle_worms_eye": {
334
+ "description": "camera below subject looking up",
335
+ "effect": "subject appears larger, more powerful",
336
+ "psychological_impact": "dominance, strength, heroic",
337
+ "technical": "watch for distortion with wide lenses",
338
+ "best_for": "architecture, powerful portraits, dramatic scenes"
339
+ },
340
+
341
+ "high_angle_birds_eye": {
342
+ "description": "camera above subject looking down",
343
+ "effect": "subject appears smaller, vulnerable",
344
+ "psychological_impact": "submission, overview, context",
345
+ "aerial_version": "complete overhead view",
346
+ "best_for": "environmental context, patterns, vulnerability"
347
+ },
348
+
349
+ "dutch_angle": {
350
+ "description": "camera tilted off horizontal",
351
+ "effect": "dynamic tension, unease",
352
+ "psychological_impact": "instability, energy, confusion",
353
+ "use_sparingly": "can become gimmicky if overused",
354
+ "best_for": "creative portraits, dynamic scenes"
355
+ }
356
+ },
357
+
358
+ # PLANOS FOTOGRÁFICOS
359
+ "photographic_planes": {
360
+
361
+ "extreme_wide_shot": {
362
+ "framing": "subject very small in environment",
363
+ "purpose": "establish location and context",
364
+ "best_for": "landscapes, establishing shots",
365
+ "composition_focus": "environment tells the story"
366
+ },
367
+
368
+ "wide_shot": {
369
+ "framing": "full body visible with environment",
370
+ "purpose": "show subject in context",
371
+ "best_for": "environmental portraits, action",
372
+ "composition_balance": "subject and environment both important"
373
+ },
374
+
375
+ "medium_shot": {
376
+ "framing": "from waist up approximately",
377
+ "purpose": "balance between subject and environment",
378
+ "best_for": "conversation, interaction, casual portraits",
379
+ "composition_focus": "subject is primary, environment secondary"
380
+ },
381
+
382
+ "close_up": {
383
+ "framing": "head and shoulders, tight on face",
384
+ "purpose": "show emotion and expression clearly",
385
+ "best_for": "emotional portraits, interviews",
386
+ "technical_focus": "eyes must be perfectly sharp"
387
+ },
388
+
389
+ "extreme_close_up": {
390
+ "framing": "part of face or specific detail",
391
+ "purpose": "intense emotion or specific detail",
392
+ "best_for": "artistic portraits, product details",
393
+ "technical_challenge": "depth of field very shallow"
394
+ },
395
+
396
+ "detail_shot": {
397
+ "framing": "specific small element",
398
+ "purpose": "highlight particular aspect",
399
+ "best_for": "hands, jewelry, textures, products",
400
+ "technical_requirements": "macro capabilities often needed"
401
+ }
402
+ },
403
+
404
+ # TÉCNICAS DE ENFOQUE Y PROFUNDIDAD DE CAMPO
405
+ "focus_techniques": {
406
+
407
+ "shallow_depth_of_field": {
408
+ "aperture_range": "f/1.4 - f/2.8",
409
+ "effect": "subject sharp, background blurred",
410
+ "best_for": "portraits, product photography, subject isolation",
411
+ "technical_consideration": "precise focus critical",
412
+ "creative_use": "bokeh quality becomes important"
413
+ },
414
+
415
+ "deep_depth_of_field": {
416
+ "aperture_range": "f/8 - f/16",
417
+ "effect": "everything sharp from front to back",
418
+ "best_for": "landscapes, architecture, group photos",
419
+ "technical_consideration": "diffraction at very small apertures",
420
+ "hyperfocal_distance": "maximize sharp zone"
421
+ },
422
+
423
+ "selective_focus": {
424
+ "technique": "choose specific focal plane",
425
+ "creative_control": "direct viewer attention",
426
+ "applications": ["isolate subject", "hide distractions", "create mood"],
427
+ "lens_choice": "longer focal lengths enhance effect"
428
+ },
429
+
430
+ "focus_stacking": {
431
+ "technique": "multiple shots at different focus points",
432
+ "purpose": "extend depth of field beyond single shot",
433
+ "best_for": "macro photography, product shots",
434
+ "post_processing": "requires blending software"
435
+ }
436
+ },
437
+
438
+ # MODO DE CÁMARA Y CONFIGURACIONES
439
+ "camera_modes": {
440
+
441
+ "program_mode": {
442
+ "description": "camera selects aperture and shutter speed",
443
+ "when_to_use": "quick shooting, changing conditions",
444
+ "photographer_control": "ISO, exposure compensation, focus",
445
+ "advantage": "fast response to opportunities",
446
+ "limitation": "less creative control over depth of field"
447
+ },
448
+
449
+ "aperture_priority": {
450
+ "mode_designation": "AV (Canon) / A (Nikon)",
451
+ "photographer_sets": "aperture value",
452
+ "camera_sets": "shutter speed for correct exposure",
453
+ "best_for": "controlling depth of field",
454
+ "applications": ["portraits", "landscapes", "creative control"],
455
+ "watch_for": "shutter speed dropping too low"
456
+ },
457
+
458
+ "shutter_priority": {
459
+ "mode_designation": "TV (Canon) / S (Nikon)",
460
+ "photographer_sets": "shutter speed",
461
+ "camera_sets": "aperture for correct exposure",
462
+ "best_for": "controlling motion",
463
+ "applications": ["sports", "action", "panning techniques"],
464
+ "watch_for": "aperture limits at extreme speeds"
465
+ },
466
+
467
+ "manual_mode": {
468
+ "photographer_sets": "both aperture and shutter speed",
469
+ "when_to_use": ["consistent lighting", "studio work", "long exposures"],
470
+ "requires": "good understanding of exposure triangle",
471
+ "advantage": "complete creative control",
472
+ "tools": "light meter, histogram, experience"
473
+ }
474
+ },
475
+
476
+ # TÉCNICAS DE MOVIMIENTO Y ACCIÓN
477
+ "movement_techniques": {
478
+
479
+ "freeze_motion": {
480
+ "shutter_speed": "1/250s or faster",
481
+ "applications": ["sports", "action", "sharp movement"],
482
+ "considerations": ["adequate light needed", "higher ISO may be required"],
483
+ "focus_mode": "continuous AF with tracking"
484
+ },
485
+
486
+ "motion_blur_panning": {
487
+ "shutter_speed": "1/15s - 1/60s typically",
488
+ "technique": "follow subject smoothly while shooting",
489
+ "effect": "sharp subject with blurred background",
490
+ "creates": "sense of speed and movement",
491
+ "requires": "practice and smooth camera movement"
492
+ },
493
+
494
+ "intentional_camera_movement": {
495
+ "technique": "deliberate camera shake during exposure",
496
+ "creative_effect": "abstract, artistic blur patterns",
497
+ "shutter_speed": "1/4s - 2s typically",
498
+ "applications": ["creative landscapes", "abstract art", "impressionistic effects"]
499
+ }
500
+ }
501
+ # =====================================================
502
+ # PARTE 3: CONFIGURACIONES ISO Y CONDICIONES DE LUZ
503
+ # =====================================================
504
+
505
+ # CONFIGURACIONES ISO PROFESIONALES
506
+ "iso_guidelines": {
507
+
508
+ "base_iso": {
509
+ "range": "100-200",
510
+ "quality": "maximum image quality, lowest noise",
511
+ "lighting_needed": "bright daylight, studio lighting",
512
+ "best_for": "landscapes, studio portraits, product photography"
513
+ },
514
+
515
+ "low_iso": {
516
+ "range": "400-800",
517
+ "quality": "excellent quality, minimal noise",
518
+ "lighting_needed": "good available light",
519
+ "best_for": "outdoor portraits, street photography, indoor with windows"
520
+ },
521
+
522
+ "medium_iso": {
523
+ "range": "1600-3200",
524
+ "quality": "good quality, manageable noise",
525
+ "lighting_needed": "indoor available light, overcast outdoor",
526
+ "best_for": "event photography, indoor sports, available light portraits"
527
+ },
528
+
529
+ "high_iso": {
530
+ "range": "6400-12800",
531
+ "quality": "acceptable quality, visible noise",
532
+ "lighting_needed": "low light situations",
533
+ "best_for": "concerts, nighttime events, astrophotography",
534
+ "post_processing": "noise reduction recommended"
535
+ }
536
+ },
537
+
538
+ # SITUACIONES DE LUZ ESPECÍFICAS
539
+ "lighting_situations": {
540
+
541
+ "bright_daylight": {
542
+ "iso": "100-200",
543
+ "aperture_considerations": "can use smaller apertures for sharpness",
544
+ "challenge": "harsh shadows",
545
+ "solutions": ["use reflectors", "find open shade", "use fill flash"]
546
+ },
547
+
548
+ "overcast_day": {
549
+ "iso": "200-400",
550
+ "characteristics": "soft, even light but dimmer",
551
+ "advantage": "natural diffusion",
552
+ "watch_for": "flat contrast, may need post-processing boost"
553
+ },
554
+
555
+ "indoor_natural_light": {
556
+ "iso": "800-1600",
557
+ "window_light": "excellent for portraits",
558
+ "technique": "position subject relative to window",
559
+ "tools": "reflectors to control shadow fill"
560
+ },
561
+
562
+ "low_light_available": {
563
+ "iso": "1600-6400",
564
+ "stabilization": "essential for sharp images",
565
+ "technique": "wider apertures, slower movements",
566
+ "creative_opportunities": "dramatic lighting, mood"
567
+ },
568
+
569
+ "night_photography": {
570
+ "iso": "3200-12800",
571
+ "equipment": "tripod usually required",
572
+ "techniques": ["long exposures", "image stacking", "noise reduction"],
573
+ "subjects": ["cityscapes", "astrophotography", "light trails"]
574
+ }
575
+ },
576
+
577
+ # TÉCNICAS ESPECIALIZADAS
578
+ "specialized_techniques": {
579
+
580
+ "macro_photography": {
581
+ "equipment": "macro lens or extension tubes",
582
+ "camera_settings": {
583
+ "aperture": "f/8-f/16 for adequate depth of field",
584
+ "iso": "200-800",
585
+ "focus": "manual focus recommended",
586
+ "stabilization": "tripod essential"
587
+ },
588
+ "lighting": "ring flash or diffused lighting",
589
+ "challenges": ["shallow depth of field", "camera shake", "subject movement"]
590
+ },
591
+
592
+ "long_exposure": {
593
+ "equipment": "tripod, neutral density filters",
594
+ "camera_settings": {
595
+ "mode": "Manual or Bulb",
596
+ "aperture": "f/8-f/16",
597
+ "iso": "100-200",
598
+ "shutter_speed": "30s to several minutes"
599
+ },
600
+ "subjects": ["waterfalls", "clouds", "star trails", "traffic"],
601
+ "technique": "use timer or remote to avoid camera shake"
602
+ },
603
+
604
+ "high_key_photography": {
605
+ "lighting": "bright, even, minimal shadows",
606
+ "exposure": "intentionally overexposed by 1-2 stops",
607
+ "post_processing": "maintain detail in highlights",
608
+ "mood": "clean, optimistic, airy",
609
+ "subjects": ["fashion", "beauty", "products"]
610
+ },
611
+
612
+ "low_key_photography": {
613
+ "lighting": "dramatic, contrasty, deep shadows",
614
+ "exposure": "underexposed to maintain shadow detail",
615
+ "technique": "single light source often",
616
+ "mood": "mysterious, dramatic, moody",
617
+ "subjects": ["portraits", "still life", "artistic work"]
618
+ }
619
+ }
620
+ }
621
+
622
+ # =====================================================
623
+ # PARTE 4: CLASES DE ANÁLISIS PROFESIONAL
624
+ # =====================================================
625
+
626
+ class ProfessionalPhotoAnalyzer:
627
+ """Expert photography context provider for intelligent prompt enhancement"""
628
+
629
+ def __init__(self):
630
+ self.knowledge = EXPERT_PHOTOGRAPHY_KNOWLEDGE
631
+
632
+ def detect_scene_type(self, description: str) -> str:
633
+ """Detect primary scene type from image description"""
634
+ description_lower = description.lower()
635
+
636
+ # Scene type detection patterns
637
+ scene_patterns = {
638
+ "portrait_studio": ["studio", "portrait", "professional lighting", "controlled lighting"],
639
+ "portrait_exterior": ["portrait", "person", "outdoor", "natural light", "exterior"],
640
+ "street_photography": ["street", "urban", "candid", "documentary", "city"],
641
+ "landscape": ["landscape", "nature", "mountain", "horizon", "scenic", "outdoor scene"],
642
+ "architecture": ["building", "architecture", "structure", "geometric", "facade"],
643
+ "action_sports": ["action", "sport", "movement", "running", "dynamic", "motion"]
644
+ }
645
+
646
+ # Score each scene type based on keyword matches
647
+ scene_scores = {}
648
+ for scene_type, keywords in scene_patterns.items():
649
+ score = sum(1 for keyword in keywords if keyword in description_lower)
650
+ if score > 0:
651
+ scene_scores[scene_type] = score
652
+
653
+ # Return highest scoring scene type, default to general if none match
654
+ if scene_scores:
655
+ return max(scene_scores.items(), key=lambda x: x[1])[0]
656
+ else:
657
+ return "general"
658
+
659
+ def analyze_lighting_conditions(self, description: str) -> Dict[str, Any]:
660
+ """Analyze lighting conditions from description"""
661
+ description_lower = description.lower()
662
+
663
+ lighting_analysis = {
664
+ "type": "unknown",
665
+ "quality": "unknown",
666
+ "direction": "unknown",
667
+ "recommendations": []
668
+ }
669
+
670
+ # Detect lighting type
671
+ if any(term in description_lower for term in ["studio", "controlled", "professional lighting"]):
672
+ lighting_analysis["type"] = "studio"
673
+ lighting_analysis["recommendations"].append("3-point lighting setup")
674
+ elif any(term in description_lower for term in ["natural", "daylight", "outdoor", "sun"]):
675
+ lighting_analysis["type"] = "natural"
676
+ lighting_analysis["recommendations"].append("consider time of day for optimal light")
677
+ elif any(term in description_lower for term in ["low light", "dark", "night", "dim"]):
678
+ lighting_analysis["type"] = "low_light"
679
+ lighting_analysis["recommendations"].append("higher ISO and stabilization needed")
680
+
681
+ # Detect lighting quality
682
+ if any(term in description_lower for term in ["soft", "diffused", "even"]):
683
+ lighting_analysis["quality"] = "soft"
684
+ elif any(term in description_lower for term in ["harsh", "dramatic", "contrasty"]):
685
+ lighting_analysis["quality"] = "hard"
686
+
687
+ # Detect lighting direction
688
+ if any(term in description_lower for term in ["side lit", "lateral", "from side"]):
689
+ lighting_analysis["direction"] = "side"
690
+ elif any(term in description_lower for term in ["backlit", "rim light", "silhouette"]):
691
+ lighting_analysis["direction"] = "back"
692
+ elif any(term in description_lower for term in ["front lit", "frontal"]):
693
+ lighting_analysis["direction"] = "front"
694
+
695
+ return lighting_analysis
696
+
697
+ def get_camera_recommendations(self, scene_type: str, lighting_conditions: Dict[str, Any]) -> Dict[str, Any]:
698
+ """Get professional camera setup recommendations"""
699
+
700
+ if scene_type not in self.knowledge["scene_types"]:
701
+ scene_type = "portrait_exterior" # Default fallback
702
+
703
+ scene_config = self.knowledge["scene_types"][scene_type]
704
+
705
+ recommendations = {
706
+ "camera_body": scene_config["equipment"]["camera"],
707
+ "primary_lens": scene_config["equipment"]["lens"],
708
+ "camera_settings": scene_config["camera_settings"].copy(),
709
+ "lighting_setup": scene_config["lighting"],
710
+ "composition_tips": scene_config["composition"]
711
+ }
712
+
713
+ # Adjust ISO based on lighting conditions
714
+ if lighting_conditions["type"] == "low_light":
715
+ recommendations["camera_settings"]["iso"] = "1600-6400"
716
+ elif lighting_conditions["type"] == "studio":
717
+ recommendations["camera_settings"]["iso"] = "100-200"
718
+ elif lighting_conditions["type"] == "natural":
719
+ recommendations["camera_settings"]["iso"] = "200-800"
720
+
721
+ return recommendations
722
+
723
+ def get_composition_guidance(self, scene_type: str, description: str) -> List[str]:
724
+ """Get composition recommendations based on scene type and content"""
725
+
726
+ guidance = []
727
+ description_lower = description.lower()
728
+
729
+ # Base composition rules
730
+ guidance.append("apply rule of thirds for key element placement")
731
+
732
+ # Scene-specific composition
733
+ if scene_type == "portrait_studio" or scene_type == "portrait_exterior":
734
+ guidance.extend([
735
+ "focus on nearest eye for maximum sharpness",
736
+ "use shallow depth of field to isolate subject",
737
+ "leave appropriate headroom and breathing space"
738
+ ])
739
+ elif scene_type == "landscape":
740
+ guidance.extend([
741
+ "place horizon on upper or lower third line",
742
+ "create depth with foreground, middle ground, background",
743
+ "use leading lines to guide viewer's eye"
744
+ ])
745
+ elif scene_type == "street_photography":
746
+ guidance.extend([
747
+ "apply rule of Z for comprehensive composition check",
748
+ "anticipate decisive moments",
749
+ "maintain respectful distance while capturing authenticity"
750
+ ])
751
+ elif scene_type == "architecture":
752
+ guidance.extend([
753
+ "watch for converging verticals",
754
+ "use strong geometric lines and patterns",
755
+ "consider symmetry and balance"
756
+ ])
757
+
758
+ # Motion-specific guidance
759
+ if any(term in description_lower for term in ["movement", "motion", "running", "action"]):
760
+ guidance.extend([
761
+ "leave space in direction of movement",
762
+ "consider panning technique for motion blur",
763
+ "use continuous autofocus for tracking"
764
+ ])
765
+
766
+ return guidance
767
+
768
+ def get_technical_context(self, scene_type: str, lighting_conditions: Dict[str, Any]) -> str:
769
+ """Generate technical context string for prompt enhancement"""
770
+
771
+ recommendations = self.get_camera_recommendations(scene_type, lighting_conditions)
772
+
773
+ context_parts = []
774
+
775
+ # Camera and lens
776
+ context_parts.append(f"Professional setup: {recommendations['camera_body']}")
777
+ context_parts.append(f"with {recommendations['primary_lens']}")
778
+
779
+ # Key settings
780
+ settings = recommendations['camera_settings']
781
+ if 'mode' in settings:
782
+ context_parts.append(f"shot in {settings['mode']} mode")
783
+ if 'aperture' in settings:
784
+ context_parts.append(f"at {settings['aperture']}")
785
+ if 'iso' in settings:
786
+ context_parts.append(f"ISO {settings['iso']}")
787
+
788
+ # Lighting insight
789
+ if lighting_conditions["type"] != "unknown":
790
+ if lighting_conditions["type"] == "studio":
791
+ context_parts.append("professional studio lighting")
792
+ elif lighting_conditions["type"] == "natural":
793
+ context_parts.append("natural lighting conditions")
794
+ elif lighting_conditions["type"] == "low_light":
795
+ context_parts.append("available light photography")
796
+
797
+ return ", ".join(context_parts)
798
+ def _generate_professional_insight(self, scene_type: str, lighting_conditions: Dict[str, Any]) -> str:
799
+ """Generate professional photography insight based on scene and lighting"""
800
+
801
+ insights = []
802
+
803
+ # Scene-specific professional insights
804
+ if scene_type == "portrait_studio":
805
+ insights.append("Professional studio portraiture requires precise lighting control")
806
+ insights.append("3-point lighting setup ensures dimensional modeling of facial features")
807
+ elif scene_type == "portrait_exterior":
808
+ insights.append("Natural light portraiture benefits from soft, directional lighting")
809
+ insights.append("Golden hour provides optimal warmth and flattering illumination")
810
+ elif scene_type == "street_photography":
811
+ insights.append("Street photography requires anticipation and quick technical adaptation")
812
+ insights.append("Available light mastery is essential for authentic documentary capture")
813
+ elif scene_type == "landscape":
814
+ insights.append("Landscape photography demands patience for optimal natural lighting")
815
+ insights.append("Hyperfocal distance technique maximizes front-to-back sharpness")
816
+ elif scene_type == "architecture":
817
+ insights.append("Architectural photography emphasizes form, texture, and geometric precision")
818
+ insights.append("Side lighting reveals dimensional qualities and surface textures")
819
+
820
+ # Lighting-specific insights
821
+ if lighting_conditions["type"] == "studio":
822
+ insights.append("Controlled studio environment allows precise mood and contrast control")
823
+ elif lighting_conditions["type"] == "natural":
824
+ insights.append("Natural lighting varies continuously, requiring adaptive technical approach")
825
+ elif lighting_conditions["type"] == "low_light":
826
+ insights.append("Low light conditions demand technical precision and creative interpretation")
827
+
828
+ return ". ".join(insights)
829
+
830
+ def generate_enhanced_context(self, bagel_description: str) -> Dict[str, Any]:
831
+ """
832
+ Main method: Generate professional photography context for BAGEL enhancement
833
+ NON-INVASIVE: Provides guidance without overriding BAGEL's creativity
834
+ """
835
+
836
+ # Analyze the image description from BAGEL
837
+ scene_type = self.detect_scene_type(bagel_description)
838
+ lighting_conditions = self.analyze_lighting_conditions(bagel_description)
839
+ composition_guidance = self.get_composition_guidance(scene_type, bagel_description)
840
+ technical_context = self.get_technical_context(scene_type, lighting_conditions)
841
+
842
+ enhanced_context = {
843
+ "scene_type": scene_type,
844
+ "lighting_analysis": lighting_conditions,
845
+ "technical_context": technical_context,
846
+ "composition_guidance": composition_guidance,
847
+ "professional_insight": self._generate_professional_insight(scene_type, lighting_conditions),
848
+ "equipment_recommendation": self.get_camera_recommendations(scene_type, lighting_conditions)
849
+ }
850
+
851
+ return enhanced_context
852
+
853
+ def format_bagel_enhancement_prompt(self, base_prompt: str, enhanced_context: Dict[str, Any]) -> str:
854
+ """
855
+ Format enhanced prompt for BAGEL while preserving its creative freedom
856
+ """
857
+
858
+ context_guidance = f"""
859
+
860
+ PROFESSIONAL PHOTOGRAPHY CONTEXT:
861
+ Scene Type: {enhanced_context['scene_type'].replace('_', ' ').title()}
862
+ Technical Setup: {enhanced_context['technical_context']}
863
+
864
+ COMPOSITION CONSIDERATIONS:
865
+ {' • '.join(enhanced_context['composition_guidance'])}
866
+
867
+ PROFESSIONAL INSIGHT:
868
+ {enhanced_context['professional_insight']}
869
+
870
+ Apply these principles flexibly to enhance your creative analysis.
871
+ """
872
+
873
+ return base_prompt + context_guidance
874
+
875
+
876
+ # =====================================================
877
+ # PARTE 5: FUNCIONES DE INTEGRACIÓN Y UTILIDADES
878
+ # =====================================================
879
+
880
+ class ProfessionalScoring:
881
+ """Enhanced scoring system incorporating professional photography principles"""
882
+
883
+ def __init__(self):
884
+ self.analyzer = ProfessionalPhotoAnalyzer()
885
+
886
+ def calculate_professional_score(self, prompt: str, analysis_data: Optional[Dict[str, Any]] = None) -> Tuple[int, Dict[str, int]]:
887
+ """
888
+ Calculate enhanced quality score incorporating professional photography principles
889
+ """
890
+ breakdown = {}
891
+
892
+ # 1. TECHNICAL EXCELLENCE (0-30 points)
893
+ technical_score = 0
894
+
895
+ # Professional camera bodies
896
+ professional_cameras = [
897
+ 'canon eos r5', 'canon eos r6', 'sony a1', 'sony a7r',
898
+ 'leica m11', 'phase one', 'hasselblad', 'fujifilm gfx'
899
+ ]
900
+ if any(camera in prompt.lower() for camera in professional_cameras):
901
+ technical_score += 10
902
+
903
+ # Professional lens specifications
904
+ lens_pattern = r'\d+mm.*f/[\d.]+'
905
+ if re.search(lens_pattern, prompt.lower()):
906
+ technical_score += 8
907
+
908
+ # Specific aperture settings
909
+ aperture_pattern = r'f/[\d.]+'
910
+ if re.search(aperture_pattern, prompt.lower()):
911
+ technical_score += 6
912
+
913
+ # ISO considerations
914
+ iso_pattern = r'iso\s*\d+'
915
+ if re.search(iso_pattern, prompt.lower()):
916
+ technical_score += 6
917
+
918
+ breakdown["technical_excellence"] = min(30, technical_score)
919
+
920
+ # 2. LIGHTING MASTERY (0-25 points)
921
+ lighting_score = 0
922
+
923
+ # Professional lighting terms
924
+ lighting_terms = [
925
+ 'studio lighting', 'natural lighting', 'golden hour', 'blue hour',
926
+ 'side lighting', 'rim lighting', 'dramatic lighting', 'soft lighting',
927
+ '3-point lighting', 'key light', 'fill light', 'diffused light'
928
+ ]
929
+ lighting_matches = sum(1 for term in lighting_terms if term in prompt.lower())
930
+ lighting_score += min(15, lighting_matches * 3)
931
+
932
+ # Advanced lighting concepts
933
+ advanced_lighting = [
934
+ 'lighting ratio', 'hard light', 'soft light', 'directional light',
935
+ 'ambient light', 'available light', 'controlled lighting'
936
+ ]
937
+ advanced_matches = sum(1 for term in advanced_lighting if term in prompt.lower())
938
+ lighting_score += min(10, advanced_matches * 2)
939
+
940
+ breakdown["lighting_mastery"] = min(25, lighting_score)
941
+
942
+ # 3. COMPOSITION EXPERTISE (0-25 points)
943
+ composition_score = 0
944
+
945
+ # Classic composition rules
946
+ composition_rules = [
947
+ 'rule of thirds', 'leading lines', 'depth of field', 'shallow depth',
948
+ 'bokeh', 'symmetry', 'balance', 'framing', 'perspective'
949
+ ]
950
+ rule_matches = sum(1 for rule in composition_rules if rule in prompt.lower())
951
+ composition_score += min(15, rule_matches * 2)
952
+
953
+ # Advanced composition concepts
954
+ advanced_composition = [
955
+ 'vanishing point', 'fibonacci', 'golden ratio', 'dynamic composition',
956
+ 'layered composition', 'negative space', 'visual flow'
957
+ ]
958
+ advanced_comp_matches = sum(1 for concept in advanced_composition if concept in prompt.lower())
959
+ composition_score += min(10, advanced_comp_matches * 2)
960
+
961
+ breakdown["composition_expertise"] = min(25, composition_score)
962
+
963
+ # 4. PROFESSIONAL TERMINOLOGY (0-20 points)
964
+ terminology_score = 0
965
+
966
+ # Professional photography terms
967
+ pro_terms = [
968
+ 'professional photography', 'commercial photography', 'editorial',
969
+ 'documentary style', 'photojournalism', 'fine art photography',
970
+ 'architectural photography', 'landscape photography', 'portraiture'
971
+ ]
972
+ term_matches = sum(1 for term in pro_terms if term in prompt.lower())
973
+ terminology_score += min(12, term_matches * 2)
974
+
975
+ # Technical photography terms
976
+ technical_terms = [
977
+ 'hyperfocal distance', 'exposure triangle', 'metering', 'focus stacking',
978
+ 'bracketing', 'tilt-shift', 'macro photography', 'telephoto compression'
979
+ ]
980
+ tech_matches = sum(1 for term in technical_terms if term in prompt.lower())
981
+ terminology_score += min(8, tech_matches * 2)
982
+
983
+ breakdown["professional_terminology"] = min(20, terminology_score)
984
+
985
+ # Calculate total score
986
+ total_score = sum(breakdown.values())
987
+
988
+ return total_score, breakdown
989
+
990
+
991
+ def get_professional_camera_setup(scene_description: str) -> Dict[str, str]:
992
+ """
993
+ Quick function to get camera setup recommendation based on scene description
994
+ """
995
+ analyzer = ProfessionalPhotoAnalyzer()
996
+
997
+ scene_type = analyzer.detect_scene_type(scene_description)
998
+ lighting_conditions = analyzer.analyze_lighting_conditions(scene_description)
999
+ recommendations = analyzer.get_camera_recommendations(scene_type, lighting_conditions)
1000
+
1001
+ # Format as simple dictionary for easy use
1002
+ return {
1003
+ "camera": recommendations["camera_body"],
1004
+ "lens": recommendations["primary_lens"],
1005
+ "aperture": recommendations["camera_settings"].get("aperture", "f/4"),
1006
+ "mode": recommendations["camera_settings"].get("mode", "AV"),
1007
+ "iso": recommendations["camera_settings"].get("iso", "400"),
1008
+ "scene_type": scene_type
1009
+ }
1010
+
1011
+
1012
+ def enhance_flux_prompt_with_professional_knowledge(original_prompt: str, image_analysis: str = "") -> str:
1013
+ """
1014
+ Main integration function: Enhance FLUX prompts with professional photography knowledge
1015
+ PRESERVES CREATIVITY while adding technical expertise
1016
+ """
1017
+ analyzer = ProfessionalPhotoAnalyzer()
1018
+
1019
+ # Use image analysis if provided, otherwise use the prompt itself
1020
+ analysis_text = image_analysis if image_analysis else original_prompt
1021
+
1022
+ # Get professional context
1023
+ enhanced_context = analyzer.generate_enhanced_context(analysis_text)
1024
+
1025
+ # Build enhancement that supplements rather than replaces
1026
+ enhancement_parts = []
1027
+
1028
+ # Add technical context naturally
1029
+ technical_context = enhanced_context["technical_context"]
1030
+ if technical_context:
1031
+ enhancement_parts.append(f"Shot on {technical_context}")
1032
+
1033
+ # Add composition guidance as suggestion
1034
+ composition_tips = enhanced_context["composition_guidance"]
1035
+ if composition_tips:
1036
+ # Pick most relevant composition tip
1037
+ primary_tip = composition_tips[0] if composition_tips else ""
1038
+ if "rule of thirds" in primary_tip:
1039
+ enhancement_parts.append("composed using rule of thirds")
1040
+ elif "shallow depth" in primary_tip:
1041
+ enhancement_parts.append("with shallow depth of field")
1042
+
1043
+ # Add lighting enhancement
1044
+ lighting_analysis = enhanced_context["lighting_analysis"]
1045
+ if lighting_analysis["type"] == "studio":
1046
+ enhancement_parts.append("professional studio lighting")
1047
+ elif lighting_analysis["type"] == "natural":
1048
+ enhancement_parts.append("natural lighting")
1049
+ elif lighting_analysis["type"] == "low_light":
1050
+ enhancement_parts.append("available light photography")
1051
+
1052
+ # Combine original prompt with enhancements
1053
+ if enhancement_parts:
1054
+ enhanced_prompt = f"{original_prompt}, {', '.join(enhancement_parts)}"
1055
+ else:
1056
+ enhanced_prompt = f"{original_prompt}, professional photography"
1057
+
1058
+ return enhanced_prompt
1059
+
1060
+
1061
+ def get_scene_specific_camera_config(scene_keywords: List[str]) -> Dict[str, Any]:
1062
+ """
1063
+ Get camera configuration based on scene keywords
1064
+ Useful for quick scene-based recommendations
1065
+ """
1066
+ scene_mappings = {
1067
+ "portrait": "portrait_studio",
1068
+ "person": "portrait_exterior",
1069
+ "street": "street_photography",
1070
+ "urban": "street_photography",
1071
+ "landscape": "landscape",
1072
+ "nature": "landscape",
1073
+ "building": "architecture",
1074
+ "architecture": "architecture",
1075
+ "action": "action_sports",
1076
+ "sport": "action_sports",
1077
+ "movement": "action_sports"
1078
+ }
1079
+
1080
+ # Find matching scene type
1081
+ scene_type = "portrait_exterior" # default
1082
+ for keyword in scene_keywords:
1083
+ if keyword.lower() in scene_mappings:
1084
+ scene_type = scene_mappings[keyword.lower()]
1085
+ break
1086
+
1087
+ # Get configuration from knowledge base
1088
+ if scene_type in EXPERT_PHOTOGRAPHY_KNOWLEDGE["scene_types"]:
1089
+ config = EXPERT_PHOTOGRAPHY_KNOWLEDGE["scene_types"][scene_type]
1090
+ return {
1091
+ "scene_type": scene_type,
1092
+ "equipment": config["equipment"],
1093
+ "settings": config["camera_settings"],
1094
+ "lighting": config["lighting"],
1095
+ "composition": config["composition"]
1096
+ }
1097
+
1098
+ return {}
1099
+
1100
+
1101
+ # =====================================================
1102
+ # UTILIDADES DE EXPORTACIÓN
1103
+ # =====================================================
1104
+
1105
+ def export_professional_prompt_enhancement(bagel_output: str, bagel_metadata: Dict[str, Any] = None) -> Dict[str, Any]:
1106
+ """
1107
+ Complete integration function for use in your existing pipeline
1108
+ Returns enhanced prompt and metadata for seamless integration
1109
+ """
1110
+ analyzer = ProfessionalPhotoAnalyzer()
1111
+ scorer = ProfessionalScoring()
1112
+
1113
+ # Generate professional context
1114
+ enhanced_context = analyzer.generate_enhanced_context(bagel_output)
1115
+
1116
+ # Create enhanced prompt
1117
+ enhanced_prompt = enhance_flux_prompt_with_professional_knowledge(bagel_output)
1118
+
1119
+ # Calculate professional score
1120
+ score, score_breakdown = scorer.calculate_professional_score(enhanced_prompt, bagel_metadata)
1121
+
1122
+ # Prepare metadata
1123
+ enhanced_metadata = bagel_metadata.copy() if bagel_metadata else {}
1124
+ enhanced_metadata.update({
1125
+ "professional_enhancement": True,
1126
+ "scene_type": enhanced_context["scene_type"],
1127
+ "professional_score": score,
1128
+ "score_breakdown": score_breakdown,
1129
+ "technical_context": enhanced_context["technical_context"],
1130
+ "professional_insights": enhanced_context["professional_insight"]
1131
+ })
1132
+
1133
+ return {
1134
+ "enhanced_prompt": enhanced_prompt,
1135
+ "metadata": enhanced_metadata,
1136
+ "original_prompt": bagel_output,
1137
+ "enhancement_context": enhanced_context
1138
+ }
1139
+
1140
+
1141
+ # Global analyzer instance for easy access
1142
+ professional_analyzer = ProfessionalPhotoAnalyzer()
1143
+ professional_scorer = ProfessionalScoring()
1144
+
1145
+ # Export main functions for integration
1146
+ __all__ = [
1147
+ "ProfessionalPhotoAnalyzer",
1148
+ "ProfessionalScoring",
1149
+ "enhance_flux_prompt_with_professional_knowledge",
1150
+ "get_professional_camera_setup",
1151
+ "export_professional_prompt_enhancement",
1152
+ "professional_analyzer",
1153
+ "professional_scorer",
1154
+ "EXPERT_PHOTOGRAPHY_KNOWLEDGE"
1155
+ ]