I am trying, for my own learning purposes, to develop an implementation of an algorithm that would list books, given an image of a bookshelf like the following:
The first step is to slice the image into individual books.
My algorithm, in Mathematica, is:
img = ColorConvert[Import["https://i.sstatic.net/IaLQk.jpg"], "GrayScale"]
- do a basic edge detection &
remove the text and try to keep the long lines
edge = DeleteSmallComponents[EdgeDetect[img, 3],Last[ImageDimensions[img]]/5]
then remove unwanted horizontal lines
lines = Sort[ImageLines[img5] /. {{0., _}, {_, _}} -> Sequence[]] Show[img, Graphics[{Thick, Orange, Line /@ lines}]]
The results, though, are less than great:
My questions are:
- How can I improve this to yield better results?
- Is there a smarter way to do this?
- how further should I process the images to increase accuracy at the (later) OCR phase?
- How to use the color information to improve the segmentation?