Skip to content

Commit

Permalink
remove redundant crop image
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcorsini committed Nov 7, 2024
1 parent 0841e99 commit 101c21b
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions source/genutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,6 @@ def figureToQPixmap(fig, dpi, width, height):

return pxmap

def cropQImage(qimage_map, bbox):

left = bbox[1]
top = bbox[0]
h = bbox[3]
w = bbox[2]

qimage_cropped = qimage_map.copy(int(left), int(top), int(w), int(h))

return qimage_cropped

def cropImage(img, bbox):
"""
Copy the given mask inside the box used to crop the plot.
Expand Down Expand Up @@ -252,26 +241,6 @@ def cropImage(img, bbox):

return crop

def qimageToNumpyArray(qimg):

w = qimg.width()
h = qimg.height()

fmt = qimg.format()
#assert (fmt == QImage.Format_RGB32)

arr = np.zeros((h, w, 3), dtype=np.uint8)

bits = qimg.bits()
bits.setsize(int(h * w * 4))
arrtemp = np.frombuffer(bits, np.uint8).copy()
arrtemp = np.reshape(arrtemp, [h, w, 4])
arr[:, :, 0] = arrtemp[:, :, 2]
arr[:, :, 1] = arrtemp[:, :, 1]
arr[:, :, 2] = arrtemp[:, :, 0]

return arr

def autolevel(img, percent):

'''
Expand Down Expand Up @@ -543,16 +512,14 @@ def removeOverlapping(created, sam_blobs, annotated = False):
if blobO in created:
created.remove(blobO)


#for SAM
def cropQImage(qimage_map, bbox):

left = bbox[1]
top = bbox[0]
h = bbox[3]
w = bbox[2]

qimage_cropped = qimage_map.copy(left, top, w, h)
qimage_cropped = qimage_map.copy(int(left), int(top), int(w), int(h))

return qimage_cropped

Expand All @@ -562,7 +529,7 @@ def qimageToNumpyArray(qimg):
h = qimg.height()

fmt = qimg.format()
assert (fmt == QImage.Format_RGB32)
#assert (fmt == QImage.Format_RGB32)

arr = np.zeros((h, w, 3), dtype=np.uint8)

Expand Down

0 comments on commit 101c21b

Please sign in to comment.