Reputation: 2106
I am trying to do a segmentation based on the spines of the book. I have been having problems for quite a while. The two images below is an example of an unsuccessful segmentation using Hough Lines. I am trying to draw a line in between all the books.
I have also tried HoughLineP, which actually render worse results. I tried tweaking all the parameters of both HoughLine and HoughLineP. But I cannot seem to improve the detection rate. or even worsen the wrong detection.
I wish to ask if anyone have any ideas how to segment the book spines out? I had tried pre- processing methods, but it merges book spines of the same colour together, I was thinking of trying to search for black lines in the middle of the books since it tends to be slightly darker, but if you look at the book of seth godin and cutting edge advertisement, I cannot see any gap between them.
Rectangle detection won't work well too considering that some book spines have 2 different colour, forming a small rectangle of their own, for instance the cutting edge advertising book. I also have tried finding the contours which did not have good result either.
The final program i am looking to do is counting the number of books there is. but to do that, first of all I need a clean and successful segmentation.
Have anybody got any other methods that I can try?
Upvotes: 1
Views: 1367
Reputation: 296
Make sure to take out the edge found after detecting each one and repeat the edge detection. Also you can inspect the peaks for their relative strength and repeat only when its more difficult to pick out.
Lately I've been doing edge detection in a nonlinear way by finding the gradient in all eight directions and taking the max of those as the output for each pixel. Then repeating for each of the color when its a color picture. This is easy in Matlab but I'm not familiar Visual Studio.
Upvotes: 1
Reputation: 311245
If you can assume that your spines will always be aligned vertically within the image, it would make sense to use an edge detection filter that detects only vertical lines. That will reduce some of the noise from detail on the spines themselves (titles etc) and give the Hough transform a greater chance of success.
A convolution filter such as this could be used:
-1 0 1
-1 0 1
-1 0 1
Upvotes: 1