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

Method get_x

digital_image_processing/resize/resize.py:35–46  ·  view source on GitHub ↗

Get parent X coordinate for destination X :param x: Destination X coordinate :return: Parent X coordinate based on `x ratio` >>> nn = NearestNeighbour(imread("digital_image_processing/image_data/lena.jpg", ... 1), 100, 100)

(self, x: int)

Source from the content-addressed store, hash-verified

33 self.output[i][j] = self.img[self.get_y(i)][self.get_x(j)]
34
35 def get_x(self, x: int) -> int:
36 """
37 Get parent X coordinate for destination X
38 :param x: Destination X coordinate
39 :return: Parent X coordinate based on `x ratio`
40 >>> nn = NearestNeighbour(imread("digital_image_processing/image_data/lena.jpg",
41 ... 1), 100, 100)
42 >>> nn.ratio_x = 0.5
43 >>> nn.get_x(4)
44 2
45 """
46 return int(self.ratio_x * x)
47
48 def get_y(self, y: int) -> int:
49 """

Callers 1

processMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected