Ask Your Question

Training for roof tile detection

asked 2020-12-02 07:58:05 -0500

ChwanPang gravatar image

updated 2020-12-03 05:02:03 -0500

I am trying to use CV2 to detect all the roof tiles on a roof and that way calculating the roof's size. At the moment openCV is having a lot of trouble recognizing individual tiles. I think this is mostly because there aren''t very distinct vertical lines. My question is what is the best way to train it? Do I cut out individual rooftiles in PhotoShop, do I film a few roof tiles in real life from several angles or do I make it recognize the small arc that the rooftiles have and make a connecting line between the 2 arcs? For the latter I would not have a clue where to start.image description

edit retag flag offensive close merge delete


please show, what you tried, so far ! also, some example images would be helpful here

berak gravatar imageberak ( 2020-12-02 08:23:43 -0500 )edit I put all the files in here.

ChwanPang gravatar imageChwanPang ( 2020-12-03 04:30:50 -0500 )edit

no, please add 1 or 2 example images to your question, not on an external dropbox

berak gravatar imageberak ( 2020-12-03 04:52:22 -0500 )edit

I added the clearest picture.

ChwanPang gravatar imageChwanPang ( 2020-12-03 05:02:45 -0500 )edit

and what are you trying to detect roof tiles, exactly ? is there any code to show ?

berak gravatar imageberak ( 2020-12-03 06:16:52 -0500 )edit

I'm trying to count the amount of roof tiles to determine the size of the roof.

ChwanPang gravatar imageChwanPang ( 2020-12-03 07:16:59 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-12-03 11:36:09 -0500

crackwitz gravatar image

here's how I would solve it:

  • ask the user to click on the corners of a rectangle on the roof


  • warp the picture so the view is straight on (adjust control points well!)

perspective warp given corners of a rectangle

  • select a tile as a template

image description

  • find that template

image description

you can find those peaks and count them.

edit flag offensive delete link more


Thank you I will try it that way

ChwanPang gravatar imageChwanPang ( 2020-12-03 15:32:16 -0500 )edit

How did u get the dots so round? I have to move my cursor if I use opencv to draw the dots.

ChwanPang gravatar imageChwanPang ( 2020-12-03 16:02:28 -0500 )edit

those response peaks are the result of matchTemplate or other correlation methods. they indicate the strength of the correlation for that position of the template against the search space. slight misalignment already causes the fit to worsen rapidly. that causes them to be nice and sharp.

crackwitz gravatar imagecrackwitz ( 2020-12-03 16:26:11 -0500 )edit

Question Tools

1 follower


Asked: 2020-12-02 07:58:05 -0500

Seen: 56 times

Last updated: Dec 03 '20