Ask Your Question

Which is the best way to detect object in this case?

asked 2013-04-01 00:45:38 -0500

RBishnoi gravatar image

updated 2013-04-01 00:50:38 -0500

I I am new to opencv. I will need some help. I want to detect titleblock in technical drawings through opencv. There will be a sample title block and there will be set of drawing files in which I have to detect the location of title block. The drawings can have (90n +/- 5) degree of rotation. The drawings will have contain title block of different dimensions. I have tried surf,freak, template matching. But all of these are not giving perfect results. I also would like to know in which cases object should be detected via surf like feature detection and in which cases LBP, Haar like cascade training? Sample Drawing File Sample Title block title.png

The approved by, date, title are filled with different values in different drawings but the overall structure and some of the text is same in title block.

Any suggestions would be of great help!! Thanks

edit retag flag offensive close merge delete


Can you post other samples where the drawing slightly rotated?

bsdnoobz gravatar imagebsdnoobz ( 2013-04-11 15:58:31 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-01 06:40:25 -0500

Guanta gravatar image

The keypoint-based features are typically used for feature extraction in images containing natural context for detecting a fast matching (e.g. for computing a homography-matrix). So these methods are not suitable in your case since you don't have much structure in your images. You could detect the logos properly but not the lines. The same basically holds for LBP, HOG, HAAR-like. These features are typically used for describing texture, e.g. used for segmentation but also used in learning approaches. However these don't seem to be useful either for your application. Or is this 'winter'-logo always present in your images? Then in theory you could use a cascade classifier using one of the 'texture'-features to detect that. But honestly, this would be overkill!!

If I got you right, then you have the title block in advance and only the drawing may be rotated but actually you don't care about the drawings at all. Ideas:

  1. Detect the title-block by hierarchical template-matching (see e.g. If you don't have the complete title-block but just the logo or parts of it you can also go for this approach, since you'll get the best match

  2. If you don't have the title block beforehand or would like to get first the rough location: Detect the two long lines bordering your title-block using cv::HoughLines or cv::HoughLinesP (,%20OutputArray%20lines,%20double%20rho,%20double%20theta,%20int%20threshold,%20double%20minLineLength,%20double%20maxLineGap%29).

The detected region you can then pass to tesseract (, an open-source text-recognition engine which will give you the text which you could then match with your words ('Approved by', etc.). Good luck!

edit flag offensive delete link more


Thanks for your suggestions!! In title block, company logo will always be there . I am trying the cascade classifier. I want to know if the cascade classifiers are invariant to scaling, rotation and brightness? Yeah you are right, the title block will be known in advance but the drawing can have any orientation. Although the title block can have slightly different brightness but it will have same structure. I will also try the hierarchical template-matching given by you. I didn't understand the second approach you mentioned...which 2 long lines you are referring to? Yeah you are right we are doing ocr to retrieve the values!! Thanks again!!

RBishnoi gravatar imageRBishnoi ( 2013-04-01 22:41:22 -0500 )edit

Glad I could help. For my 2nd approach: Your images lookk like these:

 |  img  |
 |  title  |

I referred to the lines above and below the title block. So the lower one is part of the overall border.

Guanta gravatar imageGuanta ( 2013-04-02 03:43:58 -0500 )edit

Question Tools

1 follower


Asked: 2013-04-01 00:45:38 -0500

Seen: 1,491 times

Last updated: Apr 01 '13