Question Get rectangles from pixels

demarkr

New member
Joined
Sep 7, 2017
Messages
2
Programming Experience
3-5
I am making a game, And I want to be able to draw a level in photoshop. And the game to read it.

For this, I need a way to determine what are rectangles in a picture.

For example, I have this kind of picture:
eObNJkQ.png

And I want the program to realize what is a rectangle, What it's size and position.
Like this:
NV0jkDC.png (Rectangles highlighted in red.)

I thought about using a For loop for each Y value. And reading the green pixels one by one. But I just can't figure out the logic. And my head hurts when I think about it too much.
Any genius that can help me?
 

Attachments

  • yedN4p6.png
    yedN4p6.png
    173 bytes · Views: 55
I've never worked with it but you might want to check out the Emgu project, if you download the source then this project: Emgu.CV.Example\ShapeDetection\ should indicate how to detect shapes using their library.
https://sourceforge.net/projects/emgucv/

Thank you for the suggestion!
I tried it and it is not quite the result I wanted.
svZeP-6aSpW3wDj7k3W-2w.png
It only captured the lines for some reason.
 
Back
Top Bottom