We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
def process(self, rect, width, height, region, rotation_angle):
pitch = int(rect.Pitch) if rotation_angle in (0, 180): offset = (region[1] if rotation_angle == 0 else height - region[3]) * pitch height = region[3] - region[1] else: offset = (region[0] if rotation_angle == 270 else width - region[2]) * pitch width = region[2] - region[0] buffer = (ctypes.c_char * (pitch * height)).from_address(ctypes.addressof(rect.pBits.contents) + offset) pitch = pitch // 4 if rotation_angle in (0, 180): image = np.ndarray((height, pitch, 4), dtype=np.uint8, buffer=buffer) elif rotation_angle in (90, 270): image = np.ndarray((width, pitch, 4), dtype=np.uint8, buffer=buffer) if rotation_angle == 90: image = np.rot90(image, axes=(1, 0)) elif rotation_angle == 180: image = np.rot90(image, k=2, axes=(0, 1)) elif rotation_angle == 270: image = np.rot90(image, axes=(0, 1)) if rotation_angle in (0, 180): image = image[region[1]:region[3], :width, :] else: image = image[:height, region[0]:region[2], :] # Convert the color of the cropped image only # reduce unnecessary CPU usage if self.color_mode is not None: image = self.process_cvtcolor(image) return image
The text was updated successfully, but these errors were encountered:
No branches or pull requests
def process(self, rect, width, height, region, rotation_angle):
The text was updated successfully, but these errors were encountered: