1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['/mnt/f/workspace/GIStudio/SVIkit/SVIkit/examples', '/root/miniconda3/envs/shiqi/lib/python310.zip', '/root/miniconda3/envs/shiqi/lib/python3.10', '/root/miniconda3/envs/shiqi/lib/python3.10/lib-dynload', '', '/root/miniconda3/envs/shiqi/lib/python3.10/site-packages', '/mnt/f/workspace/GIStudio/SVIkit/SVIkit/src', '/root/miniconda3/envs/shiqi/lib/python3.10/site-packages/setuptools/_vendor']\n"
]
}
],
"source": [
"import sys\n",
"print(sys.path)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/root/miniconda3/envs/shiqi/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"source": [
"import sys\n",
"sys.path.append('/mnt/f/workspace/GIStudio/SVIkit/src/svikit')\n",
"from svikit.core import StreetData"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"from pathlib import Path\n",
"from svikit import StreetData\n",
"# from svikit.processing import ImageProcessor\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"from svikit.downloader import ImageDownloader\n",
"# ======================\n",
"# 0. 准备测试数据\n",
"# ======================\n",
"# 创建测试文件夹并下载示例图片(实际使用时可以跳过)\n",
"test_folder = Path(\"./test_street_images\")\n",
"\n",
"# 示例街景图片URL(含GPS元数据)\n",
"sample_images = [\n",
" \"https://upload.wikimedia.org/wikipedia/commons/c/c4/San_Francisco_Street_View.jpg\",\n",
" \"https://upload.wikimedia.org/wikipedia/commons/7/7a/Paris_Street_View.jpg\",\n",
" \"https://github.com/ianare/exif-samples/raw/master/jpg/gps/DSCN0012.jpg\"\n",
"]\n",
"\n",
"downloader = ImageDownloader.download_test_images(sample_images, test_folder)\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"PNG file does not have exif data.\n",
"PNG file does not have exif data.\n",
"PNG file does not have exif data.\n",
"PNG file does not have exif data.\n",
"PNG file does not have exif data.\n",
"PNG file does not have exif data.\n",
"PNG file does not have exif data.\n",
"PNG file does not have exif data.\n",
"PNG file does not have exif data.\n",
"PNG file does not have exif data.\n",
"PNG file does not have exif data.\n",
"PNG file does not have exif data.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"[步骤1] 加载数据...\n"
]
}
],
"source": [
"test_folder = Path(\"./test_images/vistas\")\n",
"\n",
"# ======================\n",
"# 1. 加载数据 & 自动分析\n",
"# ======================\n",
"print(\"\\n[步骤1] 加载数据...\")\n",
"dataset = StreetData(test_folder)\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'total_images': 24, 'size_distribution': {'4608x3456': 6, '3264x2448': 6, '4032x3024': 2, '3840x2160': 2, '3264x1836': 2, '3984x2988': 2, '4000x3000': 2, '3232x2424': 2}, 'gps_coverage': '0.0%'}\n"
]
}
],
"source": [
"analysis_report = dataset.analysis_report\n",
"print(analysis_report)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"自动分析报告:\n",
"- 图片总数: 24\n",
"- 尺寸分布: {'4608x3456': 6, '3264x2448': 6, '4032x3024': 2, '3840x2160': 2, '3264x1836': 2, '3984x2988': 2, '4000x3000': 2, '3232x2424': 2}\n",
"- GPS覆盖率: 0.0%\n"
]
}
],
"source": [
"\n",
"# 验证基础分析\n",
"print(\"\\n自动分析报告:\")\n",
"print(f\"- 图片总数: {dataset.analysis_report['total_images']}\")\n",
"print(f\"- 尺寸分布: {dataset.analysis_report['size_distribution']}\")\n",
"print(f\"- GPS覆盖率: {dataset.analysis_report['gps_coverage']}\")\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"[步骤2] 处理图像...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"0it [00:00, ?it/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"24it [00:00, 87.98it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理结果: {'_create_thumbnail': [{'original_path': 'test_images/vistas/Asia/zW2IXTP-cGQes3JQU3db9A.jpg', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_zW2IXTP-cGQes3JQU3db9A.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Oceania/kdbqeR8gwZlS-gEXQMWo_g.jpg', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_kdbqeR8gwZlS-gEXQMWo_g.jpg', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/Africa/DaEwgFJdh-5zMGQTlRBqCg.jpg', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_DaEwgFJdh-5zMGQTlRBqCg.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Asia/tlxGlVwxyGUdUBfkjy1UOQ.jpg', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_tlxGlVwxyGUdUBfkjy1UOQ.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/aSqVUgt36gddhmJdI1lXNA.jpg', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_aSqVUgt36gddhmJdI1lXNA.jpg', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/Africa/eYZY4l-9Ibo0UV5x_wr-Gg.jpg', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_eYZY4l-9Ibo0UV5x_wr-Gg.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Oceania/YB4zlqniEISsphPiRZqTlg.jpg', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_YB4zlqniEISsphPiRZqTlg.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/W44CKHfkF4GYfRd_zLTbKw.jpg', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_W44CKHfkF4GYfRd_zLTbKw.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/ubHSgySsaD2kcJrVYKgxew.jpg', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_ubHSgySsaD2kcJrVYKgxew.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/cc5dEAyQECBFF9MN3MbdZA.jpg', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_cc5dEAyQECBFF9MN3MbdZA.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Asia/tlxGlVwxyGUdUBfkjy1UOQ.png', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_tlxGlVwxyGUdUBfkjy1UOQ.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Asia/zW2IXTP-cGQes3JQU3db9A.png', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_zW2IXTP-cGQes3JQU3db9A.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/W44CKHfkF4GYfRd_zLTbKw.png', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_W44CKHfkF4GYfRd_zLTbKw.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/ubHSgySsaD2kcJrVYKgxew.png', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_ubHSgySsaD2kcJrVYKgxew.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Africa/eYZY4l-9Ibo0UV5x_wr-Gg.png', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_eYZY4l-9Ibo0UV5x_wr-Gg.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Africa/DaEwgFJdh-5zMGQTlRBqCg.png', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_DaEwgFJdh-5zMGQTlRBqCg.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/aSqVUgt36gddhmJdI1lXNA.png', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_aSqVUgt36gddhmJdI1lXNA.png', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/South America/TaF_gvVUZx_nN_t6o5WnOw.jpg', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_TaF_gvVUZx_nN_t6o5WnOw.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/cc5dEAyQECBFF9MN3MbdZA.png', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_cc5dEAyQECBFF9MN3MbdZA.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Oceania/kdbqeR8gwZlS-gEXQMWo_g.png', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_kdbqeR8gwZlS-gEXQMWo_g.png', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/Oceania/YB4zlqniEISsphPiRZqTlg.png', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_YB4zlqniEISsphPiRZqTlg.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/South America/TaF_gvVUZx_nN_t6o5WnOw.png', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_TaF_gvVUZx_nN_t6o5WnOw.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/South America/JK-DJw5pl3wpJLDdTcxSEQ.jpg', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_JK-DJw5pl3wpJLDdTcxSEQ.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/South America/JK-DJw5pl3wpJLDdTcxSEQ.png', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_JK-DJw5pl3wpJLDdTcxSEQ.png', 'processed_size': (256, 192)}]}\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"from svikit.processing import ProcessingAPI\n",
"# ======================\n",
"# 2. 图像处理(示例:缩略图生成)\n",
"# ======================\n",
"print(\"\\n[步骤2] 处理图像...\")\n",
"\n",
"\n",
"# 应用处理并绑定结果\n",
"processor = ProcessingAPI(dataset)\n",
"processed_data = processor.create_thumbnail()\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"处理结果示例:\n",
"处理结果: {'_create_thumbnail': [{'original_path': 'test_images/vistas/Asia/zW2IXTP-cGQes3JQU3db9A.jpg', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_zW2IXTP-cGQes3JQU3db9A.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Oceania/kdbqeR8gwZlS-gEXQMWo_g.jpg', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_kdbqeR8gwZlS-gEXQMWo_g.jpg', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/Africa/DaEwgFJdh-5zMGQTlRBqCg.jpg', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_DaEwgFJdh-5zMGQTlRBqCg.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Asia/tlxGlVwxyGUdUBfkjy1UOQ.jpg', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_tlxGlVwxyGUdUBfkjy1UOQ.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/aSqVUgt36gddhmJdI1lXNA.jpg', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_aSqVUgt36gddhmJdI1lXNA.jpg', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/Africa/eYZY4l-9Ibo0UV5x_wr-Gg.jpg', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_eYZY4l-9Ibo0UV5x_wr-Gg.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Oceania/YB4zlqniEISsphPiRZqTlg.jpg', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_YB4zlqniEISsphPiRZqTlg.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/W44CKHfkF4GYfRd_zLTbKw.jpg', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_W44CKHfkF4GYfRd_zLTbKw.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/ubHSgySsaD2kcJrVYKgxew.jpg', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_ubHSgySsaD2kcJrVYKgxew.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/cc5dEAyQECBFF9MN3MbdZA.jpg', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_cc5dEAyQECBFF9MN3MbdZA.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Asia/tlxGlVwxyGUdUBfkjy1UOQ.png', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_tlxGlVwxyGUdUBfkjy1UOQ.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Asia/zW2IXTP-cGQes3JQU3db9A.png', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_zW2IXTP-cGQes3JQU3db9A.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/W44CKHfkF4GYfRd_zLTbKw.png', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_W44CKHfkF4GYfRd_zLTbKw.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/ubHSgySsaD2kcJrVYKgxew.png', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_ubHSgySsaD2kcJrVYKgxew.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Africa/eYZY4l-9Ibo0UV5x_wr-Gg.png', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_eYZY4l-9Ibo0UV5x_wr-Gg.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Africa/DaEwgFJdh-5zMGQTlRBqCg.png', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_DaEwgFJdh-5zMGQTlRBqCg.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/aSqVUgt36gddhmJdI1lXNA.png', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_aSqVUgt36gddhmJdI1lXNA.png', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/South America/TaF_gvVUZx_nN_t6o5WnOw.jpg', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_TaF_gvVUZx_nN_t6o5WnOw.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/cc5dEAyQECBFF9MN3MbdZA.png', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_cc5dEAyQECBFF9MN3MbdZA.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Oceania/kdbqeR8gwZlS-gEXQMWo_g.png', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_kdbqeR8gwZlS-gEXQMWo_g.png', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/Oceania/YB4zlqniEISsphPiRZqTlg.png', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_YB4zlqniEISsphPiRZqTlg.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/South America/TaF_gvVUZx_nN_t6o5WnOw.png', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_TaF_gvVUZx_nN_t6o5WnOw.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/South America/JK-DJw5pl3wpJLDdTcxSEQ.jpg', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_JK-DJw5pl3wpJLDdTcxSEQ.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/South America/JK-DJw5pl3wpJLDdTcxSEQ.png', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_JK-DJw5pl3wpJLDdTcxSEQ.png', 'processed_size': (256, 192)}]}\n",
"原始文件: zW2IXTP-cGQes3JQU3db9A.jpg\n",
"缩略图尺寸: (256, 192)\n",
"保存路径: test_images/vistas/Asia/thumbs/thumb_zW2IXTP-cGQes3JQU3db9A.jpg\n"
]
}
],
"source": [
"# 验证处理结果\n",
"print(\"\\n处理结果示例:\")\n",
"print(f\"处理结果: {processed_data.data.processed}\") # 添加调试信息\n",
"first_result = processed_data.data.processed.get('_create_thumbnail', [None])[0]\n",
"if first_result:\n",
" print(f\"原始文件: {Path(first_result['original_path']).name}\")\n",
" print(f\"缩略图尺寸: {first_result['processed_size']}\")\n",
" print(f\"保存路径: {first_result['thumbnail_path']}\")\n",
"else:\n",
" print(\"没有找到处理结果。\")"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"[步骤3] 导出数据...\n",
"\n",
"DataFrame格式:\n",
" path exif\n",
"0 test_images/vistas/Africa/DaEwgFJdh-5zMGQTlRBq... {}\n",
"1 test_images/vistas/Africa/eYZY4l-9Ibo0UV5x_wr-... {}\n",
"2 test_images/vistas/Asia/tlxGlVwxyGUdUBfkjy1UOQ... {}\n",
"3 test_images/vistas/Asia/zW2IXTP-cGQes3JQU3db9A... {}\n",
"4 test_images/vistas/Europe/ubHSgySsaD2kcJrVYKgx... {}\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"24it [00:00, 54.68it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"处理结果: {'_create_thumbnail': [{'original_path': 'test_images/vistas/Asia/zW2IXTP-cGQes3JQU3db9A.jpg', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_zW2IXTP-cGQes3JQU3db9A.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Oceania/kdbqeR8gwZlS-gEXQMWo_g.jpg', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_kdbqeR8gwZlS-gEXQMWo_g.jpg', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/Asia/tlxGlVwxyGUdUBfkjy1UOQ.jpg', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_tlxGlVwxyGUdUBfkjy1UOQ.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/W44CKHfkF4GYfRd_zLTbKw.jpg', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_W44CKHfkF4GYfRd_zLTbKw.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/aSqVUgt36gddhmJdI1lXNA.jpg', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_aSqVUgt36gddhmJdI1lXNA.jpg', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/Africa/eYZY4l-9Ibo0UV5x_wr-Gg.jpg', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_eYZY4l-9Ibo0UV5x_wr-Gg.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Africa/DaEwgFJdh-5zMGQTlRBqCg.jpg', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_DaEwgFJdh-5zMGQTlRBqCg.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/ubHSgySsaD2kcJrVYKgxew.jpg', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_ubHSgySsaD2kcJrVYKgxew.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Oceania/YB4zlqniEISsphPiRZqTlg.jpg', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_YB4zlqniEISsphPiRZqTlg.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Africa/DaEwgFJdh-5zMGQTlRBqCg.png', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_DaEwgFJdh-5zMGQTlRBqCg.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/cc5dEAyQECBFF9MN3MbdZA.jpg', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_cc5dEAyQECBFF9MN3MbdZA.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Africa/eYZY4l-9Ibo0UV5x_wr-Gg.png', 'thumbnail_path': 'test_images/vistas/Africa/thumbs/thumb_eYZY4l-9Ibo0UV5x_wr-Gg.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Asia/tlxGlVwxyGUdUBfkjy1UOQ.png', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_tlxGlVwxyGUdUBfkjy1UOQ.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Asia/zW2IXTP-cGQes3JQU3db9A.png', 'thumbnail_path': 'test_images/vistas/Asia/thumbs/thumb_zW2IXTP-cGQes3JQU3db9A.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/South America/TaF_gvVUZx_nN_t6o5WnOw.jpg', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_TaF_gvVUZx_nN_t6o5WnOw.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/ubHSgySsaD2kcJrVYKgxew.png', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_ubHSgySsaD2kcJrVYKgxew.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Europe/W44CKHfkF4GYfRd_zLTbKw.png', 'thumbnail_path': 'test_images/vistas/Europe/thumbs/thumb_W44CKHfkF4GYfRd_zLTbKw.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/aSqVUgt36gddhmJdI1lXNA.png', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_aSqVUgt36gddhmJdI1lXNA.png', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/South America/JK-DJw5pl3wpJLDdTcxSEQ.jpg', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_JK-DJw5pl3wpJLDdTcxSEQ.jpg', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/Oceania/kdbqeR8gwZlS-gEXQMWo_g.png', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_kdbqeR8gwZlS-gEXQMWo_g.png', 'processed_size': (256, 144)}, {'original_path': 'test_images/vistas/Oceania/YB4zlqniEISsphPiRZqTlg.png', 'thumbnail_path': 'test_images/vistas/Oceania/thumbs/thumb_YB4zlqniEISsphPiRZqTlg.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/South America/TaF_gvVUZx_nN_t6o5WnOw.png', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_TaF_gvVUZx_nN_t6o5WnOw.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/North America/cc5dEAyQECBFF9MN3MbdZA.png', 'thumbnail_path': 'test_images/vistas/North America/thumbs/thumb_cc5dEAyQECBFF9MN3MbdZA.png', 'processed_size': (256, 192)}, {'original_path': 'test_images/vistas/South America/JK-DJw5pl3wpJLDdTcxSEQ.png', 'thumbnail_path': 'test_images/vistas/South America/thumbs/thumb_JK-DJw5pl3wpJLDdTcxSEQ.png', 'processed_size': (256, 192)}]}\n",
"\n",
"生成的缩略图已保存至: /mnt/f/workspace/GIStudio/SVIkit/SVIkit/examples/output_thumbs\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"# ======================\n",
"# 3. 导出为其他格式\n",
"# ======================\n",
"print(\"\\n[步骤3] 导出数据...\")\n",
"\n",
"# 导出到DataFrame\n",
"import pandas as pd\n",
"df = pd.DataFrame(dataset.data)\n",
"print(\"\\nDataFrame格式:\")\n",
"print(df.head())\n",
"\n",
"# 创建 ProcessingAPI 实例\n",
"from svikit.processing import ProcessingAPI\n",
"\n",
"# 实例化 ProcessingAPI\n",
"processing_api = ProcessingAPI(dataset)\n",
"\n",
"# 生成缩略图\n",
"thumbnail_data = processing_api.create_thumbnail(output_size=(256, 256))\n",
"print(f\"\\n生成的缩略图已保存至: {os.path.abspath('./output_thumbs')}\")"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<svikit.processing.ProcessingAPI at 0x7f579c966ec0>"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"thumbnail_data"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>path</th>\n",
" <th>exif</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>test_images/vistas/Africa/DaEwgFJdh-5zMGQTlRBq...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>test_images/vistas/Africa/eYZY4l-9Ibo0UV5x_wr-...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>test_images/vistas/Asia/tlxGlVwxyGUdUBfkjy1UOQ...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>test_images/vistas/Asia/zW2IXTP-cGQes3JQU3db9A...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>test_images/vistas/Europe/ubHSgySsaD2kcJrVYKgx...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>test_images/vistas/Europe/W44CKHfkF4GYfRd_zLTb...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>test_images/vistas/North America/aSqVUgt36gddh...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>test_images/vistas/North America/cc5dEAyQECBFF...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>test_images/vistas/Oceania/kdbqeR8gwZlS-gEXQMW...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>test_images/vistas/Oceania/YB4zlqniEISsphPiRZq...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>test_images/vistas/South America/JK-DJw5pl3wpJ...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>test_images/vistas/South America/TaF_gvVUZx_nN...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>test_images/vistas/Africa/DaEwgFJdh-5zMGQTlRBq...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>test_images/vistas/Africa/eYZY4l-9Ibo0UV5x_wr-...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>test_images/vistas/Asia/tlxGlVwxyGUdUBfkjy1UOQ...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>test_images/vistas/Asia/zW2IXTP-cGQes3JQU3db9A...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>test_images/vistas/Europe/ubHSgySsaD2kcJrVYKgx...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>test_images/vistas/Europe/W44CKHfkF4GYfRd_zLTb...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>test_images/vistas/North America/aSqVUgt36gddh...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>test_images/vistas/North America/cc5dEAyQECBFF...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>test_images/vistas/Oceania/kdbqeR8gwZlS-gEXQMW...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>test_images/vistas/Oceania/YB4zlqniEISsphPiRZq...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>test_images/vistas/South America/JK-DJw5pl3wpJ...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>test_images/vistas/South America/TaF_gvVUZx_nN...</td>\n",
" <td>{}</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" path exif\n",
"0 test_images/vistas/Africa/DaEwgFJdh-5zMGQTlRBq... {}\n",
"1 test_images/vistas/Africa/eYZY4l-9Ibo0UV5x_wr-... {}\n",
"2 test_images/vistas/Asia/tlxGlVwxyGUdUBfkjy1UOQ... {}\n",
"3 test_images/vistas/Asia/zW2IXTP-cGQes3JQU3db9A... {}\n",
"4 test_images/vistas/Europe/ubHSgySsaD2kcJrVYKgx... {}\n",
"5 test_images/vistas/Europe/W44CKHfkF4GYfRd_zLTb... {}\n",
"6 test_images/vistas/North America/aSqVUgt36gddh... {}\n",
"7 test_images/vistas/North America/cc5dEAyQECBFF... {}\n",
"8 test_images/vistas/Oceania/kdbqeR8gwZlS-gEXQMW... {}\n",
"9 test_images/vistas/Oceania/YB4zlqniEISsphPiRZq... {}\n",
"10 test_images/vistas/South America/JK-DJw5pl3wpJ... {}\n",
"11 test_images/vistas/South America/TaF_gvVUZx_nN... {}\n",
"12 test_images/vistas/Africa/DaEwgFJdh-5zMGQTlRBq... {}\n",
"13 test_images/vistas/Africa/eYZY4l-9Ibo0UV5x_wr-... {}\n",
"14 test_images/vistas/Asia/tlxGlVwxyGUdUBfkjy1UOQ... {}\n",
"15 test_images/vistas/Asia/zW2IXTP-cGQes3JQU3db9A... {}\n",
"16 test_images/vistas/Europe/ubHSgySsaD2kcJrVYKgx... {}\n",
"17 test_images/vistas/Europe/W44CKHfkF4GYfRd_zLTb... {}\n",
"18 test_images/vistas/North America/aSqVUgt36gddh... {}\n",
"19 test_images/vistas/North America/cc5dEAyQECBFF... {}\n",
"20 test_images/vistas/Oceania/kdbqeR8gwZlS-gEXQMW... {}\n",
"21 test_images/vistas/Oceania/YB4zlqniEISsphPiRZq... {}\n",
"22 test_images/vistas/South America/JK-DJw5pl3wpJ... {}\n",
"23 test_images/vistas/South America/TaF_gvVUZx_nN... {}"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "shiqi",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.15"
}
},
"nbformat": 4,
"nbformat_minor": 2
}