Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Request for an App
-
is your goal for something that auto-detects walls and computes area? Or you set scale, thrn manually trace, or perhaps set a series of corner points using a zoomed view for accuracy?
-
The latter. If still unclear: I want to do in Pythonista what is shown in this video using Acrobat Pro. (https://www.youtube.com/watch?v=5Ra4kgOGq9Q)
-
and do you want to aquire your image via camera? or scan? i.e, do we need to "flatten" image and take out perspective errors?
https://www.mathsisfun.com/geometry/area-irregular-polygons.html is a good summary of how to calculate area from a set of ordered coordinates. I would probably do everything in pixel units, then scale the area by (ft/pixel)**2 at the end.
-
No need to flatten anything as I will be starting with floor plans. I have no trouble with the math involved. It's really the Pythonista UI (getting the points, drawing the lines on the image, recognizing and closing the polygon. I'm sure that all of this is easy for someone (not me) who has used the UI. The calculations are really quite straightforward. I suppose it will be a good learning experience :-)
-
@ihf Make a new repo, name it RoomAreaFinder and add a jpg or png file of a floor plan. Look at https://github.com/humberry/photo_text and get enough code to grab your floor plan from the camera roll and display it within a Pythonista UI. If you then provide the URL to that repo, we can provide improvement suggestions until you have your app.
-
-
Sounds like a plan. Thanks guys!
-
OK, I created (my first) git repo (https://github.com/ifuchs/RoomAreaFinder) using Stash. You will see the functions that are now largely stubs that get the scale line endpoints and the polygon vertices all from a jpg. I uploaded a sample floor plan. Please excuse the python. Any help for acquiring the coordinates would be much appreciated.
P.S. It just occurred to me that I also need another function that is called by getPolygonVertices to determine when the polygon is closed...have to figure out how to do that.
-
@ihf , this may sound stupid, but it's ok, I am used to making stupid remarks. But as a quick and dirty idea, if you can place rects on the image and name them like bedroom1 etc. you could add up the total sqm as well as individual named areas. My idea being that a room/area might consist or more that one named rect. Ok, if there is a lot of angles it's not great. But it's also not that bad. With multiple rects of differing sizes you could get most of it. But yes polygons are better
-
@Phuket2 Not a stupid idea at all but I really need to be able to trace the outline to get the total sq. ft. and not just the room outlines. I need to be able to compare the total to the one that is asserted. As you can see, the polygon area calculation is quite simple. Now I just need a UI that captures the points.
-
@ihf , do you have a pic of a plan that's ok to share? Whilst I am not great on the math, I used to draw 2d kitchen plans as a job many years ago. That was on a Mac plus. I was using Mac Draft. I think from Microspot at the time, a U.K. Company. But I have dealt with many plans in my life span. It's the only encouraging thing about getting old 😱
-
I added one to the git.
-
@ihf , ok a little bit more exotic than the normal floor plan. But if the red rectangle around the floor plan below is the sqm then minus all the yellow rectangles. If all was to scale in the ui, would be very close. Look, just trying to help. Normally floor plans are just a series of rectangles more often than not. Just about getting the scale right. I can't remember clearly, but I think for kitchens (1 room) we did 25:1. I think for a house it was more like 250:1
-
I appreciate your help but I really need the square footage of the full outline as that is what real estate listing show. Also some of the floor plans I am dealing with would not be amenable to this approach as they have some less than right angles in them.
-
@ihf , ok no problems. I understand. Was just trying to make the problem similar to solve. But I had fun contributing 😎
-
Another approach - one used to estimate Pi - is to generate random points and see if they're inside or outside the building.
The proportion that are to those that aren't can be used with the overall scene's area.
-
Thanks, that's interesting but given that the jpg may contain other extraneous items, I think it would be better to outline the area of interest. The calculation part of the script is in the git. What I need is help with the UI.
-
Could you colour flood fill from the outside and then test pixels? You might need to eliminate e.g. the compass in your example. Though I doubt it adds much to the inaccuracy.
-
Is there something wrong with the approach of entering vertices by touching them?
-
@ihf , I think you are getting frustrated now. I understand why 🤐
But I am sure guys here can help with what you need. If you look at the path demo in the examples folder, pretty sure it's what you are looking for with a ui. Not something I can do competently, so I will we another one answer. But I think that's on the right track