Ask Your Question

Devylin's profile - activity

2014-10-09 00:20:38 -0500 received badge  Editor (source)
2014-10-08 23:04:56 -0500 asked a question 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!

2013-05-23 17:15:21 -0500 received badge  Necromancer (source)
2013-02-21 04:51:46 -0500 answered a question What caused this happen?CV_XADD parse issue in Xcode 4.2

Into file operations.hpp you have to comment:

#ifdef __cplusplus
/*
/////// exchange-add operation for atomic operations on reference counters ///////
#if defined __INTEL_COMPILER && !(defined WIN32 || defined _WIN32)   // atomic 
[...]
#else
  static inline int CV_XADD(int* addr, int delta)
  { int tmp = *addr; *addr += delta; return tmp; }
#endif
*/

and add these lines

static inline int CV_XADD(int* addr, int delta)
{ int tmp = *addr; *addr += delta; return tmp; }

after this part:

#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4127) //conditional expression is constant
#endif