Poissonfish / GRID

GRID: Deal with Field Segmentations Elegantly
https://poissonfish.github.io/GRID/index.html
GNU General Public License v3.0
32 stars 11 forks source link

Crash after the define POI #16

Open zlin67 opened 2 months ago

zlin67 commented 2 months ago

Describe the bug I have loaded my own images and define the POI and run the clustering successfully. But when I click the next it crashed. I have tried for several images, all of them have the same issue.

Screenshot 2024-07-17 at 11 18 28 AM

The error message is shown below:

GRID: Image was reshaped to (3065, 3175) Traceback (most recent call last): File "/opt/anaconda3/envs/grid/lib/python3.9/site-packages/grid/gridGUI.py", line 140, in self.btNext.clicked.connect(lambda: self.showAnchor()) File "/opt/anaconda3/envs/grid/lib/python3.9/site-packages/grid/gridGUI.py", line 152, in showAnchor self.updateMainPn(panel=Panels.ANCHOR, isNew=isNew) File "/opt/anaconda3/envs/grid/lib/python3.9/site-packages/grid/gridGUI.py", line 189, in updateMainPn self.pnMain.addWidget(panel.value1) File "/opt/anaconda3/envs/grid/lib/python3.9/site-packages/grid/gui/anchor.py", line 20, in init self.grid.findPlots() File "/opt/anaconda3/envs/grid/lib/python3.9/site-packages/grid/grid.py", line 245, in findPlots self.map.findPlots( File "/opt/anaconda3/envs/grid/lib/python3.9/site-packages/grid/gmap.py", line 90, in findPlots self.angles = self.detectAngles(img=imgBin, rangeAngle=self._degRot) File "/opt/anaconda3/envs/grid/lib/python3.9/site-packages/grid/gmap.py", line 99, in detectAngles imgR = rotateBinNdArray(img, angle) File "/opt/anaconda3/envs/grid/lib/python3.9/site-packages/grid/lib.py", line 320, in rotateBinNdArray matRot = cv2.getRotationMatrix2D(pivot, -angle, 1.0) TypeError: Can't parse 'center'. Sequence item with index 0 has a wrong type zsh: abort python -m grid

Desktop (please complete the following information):

OS: Mac Version :1.3.11

xianjunhong commented 1 month ago

I had the same problem, have you solved it yet?

xianjunhong commented 1 month ago

On line 315 of lib.py, replace the code with the following to fix it

  # if is_old_cv.
    # pivot = tuple((np.array(imgP.shape[:2]) / 2).astype(int))
    # else.
    # pivot = (np.array(imgP.shape[:2]) / 2).astype(int).tolist()
    # rotate images
    if is_old_cv.
        pivot = tuple((np.array(imgP.shape[:2]) / 2).astype(np.float32))
    else.
        pivot = (np.array(imgP.shape[:2]) / 2).astype(np.float32).tolist()