Skip to content
New issue

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

GrabCut.py #1

Open
molyswu opened this issue Jan 9, 2020 · 8 comments
Open

GrabCut.py #1

molyswu opened this issue Jan 9, 2020 · 8 comments

Comments

@molyswu
Copy link

molyswu commented Jan 9, 2020

Try to :
python yoloUtils/GrabCut.py --image ./images/person.jpg --yolo yolo-fish

File "yoloUtils/GrabCut.py", line 44, in
img, boxes, idxs = yolo.runYOLODetection(args)
ValueError: too many values to unpack (expected 3)

Thaks

Cuda-Chen added a commit that referenced this issue Jan 9, 2020
1. Fix too many values to unpack issue mentioned in Issue #1.
2. change python script from `yolo.py` to `main.py` in README.
@Cuda-Chen
Copy link
Owner

Hi molyswu,

Thanks for your response, I have fixed this issue.
The reason is that runYOLODetection only returns 1 argument, whereas runYOLOBoundingBoxes returns 3 arguments.

Anyway, I have pushed a new commit to fix the problem :)

@molyswu
Copy link
Author

molyswu commented Jan 14, 2020

Hi, Cuda-Chen
Thank you for your help !
How to calculator pixel or size at grabcut area.

@Cuda-Chen
Copy link
Owner

You said to calculate the area of the rectangle, or bounding box?

@molyswu
Copy link
Author

molyswu commented Jan 15, 2020

box

@Cuda-Chen
Copy link
Owner

Cuda-Chen commented Jan 15, 2020

In line 193, utils/yolo.py I write the following:
boxes.append([x, y, int(width), int(height)])
Also, in line 16, utils/GrabCut.py:
rect = (boxes[i][0], boxes[i][1], boxes[i][2], boxes[i][3])
Therefore, you can calculate the area of bounding box by multiply width with height (boxes[i][2] represents width, whereas boxes[i][3] represents height).

Maybe this helps :)

@molyswu
Copy link
Author

molyswu commented Jan 15, 2020

Thank you

@molyswu
Copy link
Author

molyswu commented Jan 15, 2020

bounding box of area ==fgbModel of area?

I want to get the object of area

@Cuda-Chen
Copy link
Owner

If you mean to get the foreground area after GrabCut,
maybe grabCut helps (GrabCut.py:20).

Shown in OpenCV doc, the grabCut function returns three objects: mask, bgdModel, and fgdModel.
I guess fgdModel is what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants