# Revision history [back]

### Grid graph construction for Graph Cut

Hi all,

In the algorithm I'm developing I need to use graph cut for images.
I have to define a new graph from an Image with custom weight of arcs and then use graph cut to find the min cut. I know that there is a the grabcut opencv function that fits well but i don' t know how to edit the graph I obtain from the image with my custom weights: here is the grab cut description

The weights of edges connecting pixels to source node/end node are defined by the probability of a pixel being foreground/background. The weights between the pixels are defined by the edge information or pixel similarity. If there is a large difference in pixel color, the edge between them will get a low weight.

Any idea?

Thank you!

P.s. I'm working with Python

### Grid graph construction for Graph Cut

Hi all,

In the algorithm I'm developing I need to use graph cut for images.images using opencv with python.
I have to define a new graph from an Image image with custom weight of arcs and then use graph cut to find the min cut. I know that there is a the grabcut opencv function that fits well but i don' t know how to edit the graph I obtain from the image with my custom weights: here uses a user-specified bounding box around the object to be segmented to find the background/foreground.

Here is the grab cut descriptiongrabcut weight of edges description:

The weights of edges connecting pixels to source node/end node are defined by the probability of a pixel being foreground/background. The weights between the pixels are defined by the edge information or pixel similarity. If there is a large difference in pixel color, the edge between them will get a low weight.

I don't have to find the background of an image, I need something similar opencv function but with the possibility to set my custom weight of edges connecting pixels, and then use graph cut to find the min cut.

Any idea?

Thank you!

P.s. I'm working with Python

### Grid graph construction for Graph CutCreate a grid graph from an image and set custom weight of edges connecting pixels

Hi all,

In the algorithm I'm developing I need to use graph cut for images using opencv with python.
I have to define a new graph from an image with custom weight of arcs and then use graph cut to find the min cut. I know that there is the grabcut opencv function that uses a user-specified bounding box around the object to be segmented to find the background/foreground.

Here is grabcut weight of edges description:

The weights of edges connecting pixels to source node/end node are defined by the probability of a pixel being foreground/background. The weights between the pixels are defined by the edge information or pixel similarity. If there is a large difference in pixel color, the edge between them will get a low weight.

I don't have to find the background of an image, I need something similar opencv function but with the possibility to set my custom weight of edges connecting pixels, and then use graph cut to find the min cut.

Any idea?

Thank you!

### Graph cut: Create a grid graph from an image and set custom weight of edges connecting pixels

Hi all,

In the algorithm I'm developing I need to use graph cut for images using opencv with python.
I have to define a new graph from an image with custom weight of arcs and then use graph cut to find the min cut. I know that there is the grabcut opencv function that uses a user-specified bounding box around the object to be segmented to find the background/foreground.

Here is grabcut weight of edges description:

The weights of edges connecting pixels to source node/end node are defined by the probability of a pixel being foreground/background. The weights between the pixels are defined by the edge information or pixel similarity. If there is a large difference in pixel color, the edge between them will get a low weight.

I don't have to find the background of an image, I need something similar opencv function but with the possibility to set my custom weight of edges connecting pixels, and then use graph cut to find the min cut.

Any idea?

Thank you!

 5 retagged sturkmen 6772 ●3 ●48 ●79 https://github.com/stu...

### Graph cut: Create a grid graph from an image and set custom weight of edges connecting pixels

Hi all,

In the algorithm I'm developing I need to use graph cut for images using opencv with python.
I have to define a new graph from an image with custom weight of arcs and then use graph cut to find the min cut. I know that there is the grabcut opencv function that uses a user-specified bounding box around the object to be segmented to find the background/foreground.

Here is grabcut weight of edges description:

The weights of edges connecting pixels to source node/end node are defined by the probability of a pixel being foreground/background. The weights between the pixels are defined by the edge information or pixel similarity. If there is a large difference in pixel color, the edge between them will get a low weight.

I don't have to find the background of an image, I need something similar opencv function but with the possibility to set my custom weight of edges connecting pixels, and then use graph cut to find the min cut.

Any idea?

Thank you!