Python Forum
Taking any 2d image and passing it to create a level
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Taking any 2d image and passing it to create a level
#1
Hello,

I need help please. I am trying to figure out how can I take any 2d image I got and pass it in a python program with outlines that would act as borders / collision area ? For example, I take a 2d maze picture made of squares, the red ones are borders and the rest is the “walk area” (sample picture bellow)

[Image: stickers-vector-2d-red-maze.jpg.jpg]).

Or I take a .png of a level i designed and draw lines to delimitate stuff and each colors should lead to a different action (red = border, blue = enter / quit area, green = grass, I don’t know)

Do you know how can I do this and what’s the name of this technique ?

PS: I am new to programming and Python, be nice with me senpais Blush
Thank you
Reply
#2
What are you trying to do? I mean other than somehow turn an image into something else. Are you trying to make a game with pygame? Are you trying to do something on the web? More info about how this will be used please.
Reply
#3
I guess what is more accurate for me will be making game levels plus I don't know anything about pygames.
With pygames can I load a image file into the program as a level ?
Reply
#4
Look up cv2, or maybe ask in a cv2 forum. It is a very specialised field.

cv2 can do many things. I believe it is the software behind, for example, facial recognition.

I use it for finding the bubbles on a multi-choice answer form, then find the marked bubbles by counting the pixels within the circular external edge.

Beginners tutorials will show you how to get the outlines of figures and colour them. That should get you on your way!

But I am no cv2 expert, all I do with it is mark multi-choice forms!
Reply
#5
Alright, thank you for the answer. I'll check pygame and cv2 as you both talked about each Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Passing argument from top-level function to embedded function JaneTan 2 2,273 Oct-15-2020, 03:50 PM
Last Post: deanhystad
  Create bitmap image for my exe atlass218 5 3,643 Nov-04-2018, 06:24 AM
Last Post: atlass218

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020