gpt4 book ai didi

ios - 调整图像选定区域的大小

转载 作者:行者123 更新时间:2023-11-28 13:55:09 24 4
gpt4 key购买 nike

我只想增加/减少图像中所描绘的选定区域(白线之间的区域)的图像高度,而不是该区域的外部。

enter image description here

这与应用 Manly - Body Muscle Editor Pro 中执行的功能相同

我怎样才能做到这一点?感谢您的帮助。

最佳答案

我从未为 IOS 编写过代码,但我知道 OpenCV 也适用于 IOS。这里我使用了cv2.resize

import cv2
import numpy as np

img = cv2.imread("1.jpg")

print(img.shape)

h = img.shape[0]
w = img.shape[1]

part_to_resize = img[120:240,:]

old_height = 120 #240-120
new_height = 200

final_result = np.zeros((h-(240-120)+new_height,w,3),dtype='uint8')

final_result[0:119,:] = img[0:119,:]
final_result[120:320,:] = cv2.resize(part_to_resize, (w, new_height))
final_result[321:h-old_height+new_height,:] = img[241:h,:]

cv2.imshow("final_result", final_result)
cv2.imshow("img", img)
cv2.waitKey()

enter image description here

关于ios - 调整图像选定区域的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53976838/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com