@@ -41,7 +41,7 @@ def crop_image(
41
41
image.shape
42
42
# (1080, 1920, 3)
43
43
44
- xyxy = (200 , 400, 600 , 800)
44
+ xyxy = (400 , 400, 800 , 800)
45
45
cropped_image = sv.crop_image(image=image, xyxy=xyxy)
46
46
cropped_image.shape
47
47
# (400, 400, 3)
@@ -55,12 +55,14 @@ def crop_image(
55
55
image.size
56
56
# (1920, 1080)
57
57
58
- xyxy = (200 , 400, 600 , 800)
58
+ xyxy = (400 , 400, 800 , 800)
59
59
cropped_image = sv.crop_image(image=image, xyxy=xyxy)
60
60
cropped_image.size
61
61
# (400, 400)
62
62
```
63
- """
63
+
64
+ { align=center width="1000" }
65
+ """ # noqa E501 // docs
64
66
if isinstance (xyxy , (list , tuple )):
65
67
xyxy = np .array (xyxy )
66
68
xyxy = np .round (xyxy ).astype (int )
@@ -110,7 +112,9 @@ def scale_image(image: ImageType, scale_factor: float) -> ImageType:
110
112
scaled_image.size
111
113
# (960, 540)
112
114
```
113
- """
115
+
116
+ { align=center width="1000" }
117
+ """ # noqa E501 // docs
114
118
if scale_factor <= 0 :
115
119
raise ValueError ("Scale factor must be positive." )
116
120
@@ -170,7 +174,7 @@ def resize_image(
170
174
# (1000, 562)
171
175
```
172
176
173
- { align=center width="800 " }
177
+ { align=center width="1000 " }
174
178
""" # noqa E501 // docs
175
179
if keep_aspect_ratio :
176
180
image_ratio = image .shape [1 ] / image .shape [0 ]
@@ -238,7 +242,7 @@ def letterbox_image(
238
242
# (1000, 1000)
239
243
```
240
244
241
- { align=center width="800 " }
245
+ { align=center width="1000 " }
242
246
""" # noqa E501 // docs
243
247
assert isinstance (image , np .ndarray )
244
248
color = unify_to_bgr (color = color )
@@ -389,7 +393,7 @@ def tint_image(
389
393
390
394
image = cv2.imread("source.png")
391
395
tinted_image = sv.tint_image(
392
- image=image, color=sv.Color.BLACK , opacity=0.5
396
+ image=image, color=sv.Color.ROBOFLOW , opacity=0.5
393
397
)
394
398
cv2.imwrite("target.png", tinted_image)
395
399
```
@@ -400,11 +404,13 @@ def tint_image(
400
404
401
405
image = Image.open("source.png")
402
406
tinted_image = sv.tint_image(
403
- image=image, color=sv.Color.BLACK , opacity=0.5
407
+ image=image, color=sv.Color.ROBOFLOW , opacity=0.5
404
408
)
405
409
tinted_image.save("target.png")
406
410
```
407
- """
411
+
412
+ { align=center width="1000" }
413
+ """ # noqa E501 // docs
408
414
if not 0.0 <= opacity <= 1.0 :
409
415
raise ValueError ("opacity must be between 0.0 and 1.0" )
410
416
@@ -447,7 +453,9 @@ def grayscale_image(image: ImageType) -> ImageType:
447
453
grayscale_image = sv.grayscale_image(image=image)
448
454
grayscale_image.save("target.png")
449
455
```
450
- """
456
+
457
+ { align=center width="1000" }
458
+ """ # noqa E501 // docs
451
459
grayscaled = cv2 .cvtColor (image , cv2 .COLOR_BGR2GRAY )
452
460
return cv2 .cvtColor (grayscaled , cv2 .COLOR_GRAY2BGR )
453
461
0 commit comments