在菜单edit和鼠标右键 增加图片左右旋转功能 且有标注框的情况下不可以旋转
This commit is contained in:
parent
4df7ada91d
commit
e0ae8b4428
|
@ -800,13 +800,20 @@ class MainWindow(QMainWindow, WindowMixin):
|
||||||
filename = self.mImgList[self.currIndex]
|
filename = self.mImgList[self.currIndex]
|
||||||
|
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
_value = True
|
if self.itemsToShapesbox:
|
||||||
self.actions.rotateLeft.setEnabled(_value)
|
if self.lang == 'ch':
|
||||||
pix = cv2.imread(filename)
|
self.msgBox.warning(self, "提示", "\n 该图片已经有标注框,旋转操作会打乱标注,建议清除标注框后旋转。")
|
||||||
pix = np.rot90(pix, k=1)
|
else:
|
||||||
cv2.imwrite(filename, pix)
|
self.msgBox.warning(self, "Warn", "\n The picture already has a label box, and rotation will disrupt the label.\
|
||||||
self.canvas.update()
|
It is recommended to clear the label box and rotate it.")
|
||||||
self.loadFile(filename)
|
else:
|
||||||
|
_value = True
|
||||||
|
self.actions.rotateLeft.setEnabled(_value)
|
||||||
|
pix = cv2.imread(filename)
|
||||||
|
pix = np.rot90(pix, k=1)
|
||||||
|
cv2.imwrite(filename, pix)
|
||||||
|
self.canvas.update()
|
||||||
|
self.loadFile(filename)
|
||||||
else:
|
else:
|
||||||
_value = False
|
_value = False
|
||||||
if self.lang == 'ch':
|
if self.lang == 'ch':
|
||||||
|
@ -821,13 +828,20 @@ class MainWindow(QMainWindow, WindowMixin):
|
||||||
filename = self.mImgList[self.currIndex]
|
filename = self.mImgList[self.currIndex]
|
||||||
|
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
_value = True
|
if self.itemsToShapesbox:
|
||||||
self.actions.rotateRight.setEnabled(_value)
|
if self.lang == 'ch':
|
||||||
pix = cv2.imread(filename)
|
self.msgBox.warning(self, "提示", "\n 该图片已经有标注框,旋转操作会打乱标注,建议清除标注框后旋转。")
|
||||||
pix = np.rot90(pix, k=-1)
|
else:
|
||||||
cv2.imwrite(filename, pix)
|
self.msgBox.warning(self, "Warn", "\n The picture already has a label box, and rotation will disrupt the label.\
|
||||||
self.canvas.update()
|
It is recommended to clear the label box and rotate it.")
|
||||||
self.loadFile(filename)
|
else:
|
||||||
|
_value = True
|
||||||
|
self.actions.rotateRight.setEnabled(_value)
|
||||||
|
pix = cv2.imread(filename)
|
||||||
|
pix = np.rot90(pix, k=-1)
|
||||||
|
cv2.imwrite(filename, pix)
|
||||||
|
self.canvas.update()
|
||||||
|
self.loadFile(filename)
|
||||||
else:
|
else:
|
||||||
_value = False
|
_value = False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue