0
결과 이미지를 반전시키기 위해 진정한 접근법을 찾을 수 없습니다. pygame.transform.threshold 메서드 내에서 inverse = True 인수를 사용하려고 시도했지만 오류가 발생합니다. 다시 말하면, 나는 역치를 취할 필요가있다.파이 게임을 사용하여 임계 값 이미지를 반전하려면 어떻게해야합니까?
def threshold_image(self, image):
"""Applies a threshold to an image and returns the thresholded image
arguments
image -- the image that should be thresholded, a
pygame.surface.Surface instance
returns
thresholded -- the thresholded image, a
pygame.surface.Surface instance
"""
# surface to apply threshold to surface
thimg = pygame.surface.Surface(self.get_size(), 0, image)
# perform thresholding
th = (self.settings['threshold'], self.settings['threshold'],
self.settings['threshold'])
pygame.transform.threshold(thimg, image, self.settings['pupilcol'], th,
self.settings['nonthresholdcol'], 1)
return thimg
어떤 오류가 발생합니까? – ryanpattison
[documentation] (http://www.pygame.org/docs/ref/transform.html#pygame.transform.threshold)에서 적절한 인수를'pygame.transform '에 전달하는 것처럼 보이지 않습니다. 임계 값()'. 'threshold' 인자는'th'에있는 세 가지가 아닌 네 가지 값의 튜플로 보여줍니다. – martineau
파이 게임 GUI가 열리지 않습니다. 이미지를 가져 오기 위해 웹캠을 사용하고 있습니다. –