0

i search a solution to segment a image in different parts (Especial a saliency map (see image)). I knew about some Solutions like Graph-Based segmentation by Pedro F. Felzenszwalb, but for large images my implementation is very slow. Is there some other solution? Map

Greetings, Destiny

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
501 - not implemented
  • 2,638
  • 4
  • 39
  • 74

1 Answers1

2

Destiny,

What is the specific goal of this segmentation? Are you just trying to create separate regions in a still image? Are you looking for objects, and segmenting the image to find ROIs for later work?

The more specific you can be about your segmentation goals, the more specifically you can tailor your code. Binarizing your image through thresholding, or separating it into smaller chunks via feature detection, could significantly speed up your code.

The only other general image segmentation algorithm I can think of that is implemented in the OpenCV libraries is the water shed algorithm. You can find it in the docs, or look up Laganiere's OpenCV 2 Computer Vision Application Programming Cookbook, which contains an excellent tutorial on both of these algorithms.

gankoji
  • 853
  • 1
  • 10
  • 23
  • First, i want use it to exert the rule of thirds goal. But at least i want to crop detected objects from background (GrabCut). I know that openCV implement GrabCut. But there i must indicate a Rectangle which foreground informations. With the saliency-map i have some foreground informations. But i don't know how to extract this for the grabCut algo – 501 - not implemented Jul 28 '12 at 16:19
  • If you interpret your saliency map as a mask of possible foreground regions, you can use either method (grabCut or waterShed) by using the saliency map as the mask input. For the record, you can specify the rectangle ROI for watershed as the entire image grame. – gankoji Jul 28 '12 at 20:45
  • yeah, but how can i make a rectange around the white pixels in my mask? If i use waterShed, it's look like http://imageshack.us/photo/my-images/140/resl.jpg. – 501 - not implemented Jul 28 '12 at 23:00
  • now i've found a solution. But it takes 10 seconds for a 1920x1280px picture. In this solution i combined the waterShed algorithm with grabcut. Maybe there is some place to optimize (kill watershed). I can post my solution, if it's tidy – 501 - not implemented Jul 29 '12 at 00:32
  • Try it without waterShed, and convert the saliency map to values that grabCut can understand (i think it only accepts four integer values, 0 for definitely background, 1 for definitely foreground, 2 for probable bg, and 3 for probable fg). Define the input rectangle as the entire image, and see how that affects your performance. IIRC, waterShed and grabCut are relatively similar in their demands on resources, so this should speed things up. – gankoji Jul 29 '12 at 15:00
  • @gankoji can you please help me with this. How did you achieve result. I am using Grabcut but it takes a lot of time even for small images. My Watershed returns black & white image which i don't know how to give exact color. – Muhammad Umair Shafique Nov 06 '19 at 16:56