MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __init__

Method __init__

digital_image_processing/resize/resize.py:13–28  ·  view source on GitHub ↗
(self, img, dst_width: int, dst_height: int)

Source from the content-addressed store, hash-verified

11 """
12
13 def __init__(self, img, dst_width: int, dst_height: int):
14 if dst_width < 0 or dst_height < 0:
15 raise ValueError("Destination width/height should be > 0")
16
17 self.img = img
18 self.src_w = img.shape[1]
19 self.src_h = img.shape[0]
20 self.dst_w = dst_width
21 self.dst_h = dst_height
22
23 self.ratio_x = self.src_w / self.dst_w
24 self.ratio_y = self.src_h / self.dst_h
25
26 self.output = self.output_img = (
27 np.ones((self.dst_h, self.dst_w, 3), np.uint8) * 255
28 )
29
30 def process(self):
31 for i in range(self.dst_h):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected