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
-
@ihf , I am not trying to be the gringe of Christmas.but I think what you are looking for is impractical. Maybe not, but my 2 cents worth is that depending on what country you are in a house/condo Sqm is calculated differently. Example in Australia with a condo, if you have a car space that is included in the advertised sqm. Totally legal. But depending on the type of title, a balcony maybe included or excluded from the advertised sqm. So that's just a few gotchas. You would also assume your floor plan is too scale. But unless you have the a0 paper plan from the architect, reproductions can get so bad on scaling. They will be relative, mostly. But to try an accurately measure them digitally in my opinion not easy. If from the drawings you have, you can put a scale ruler on top of it and get good readings, maybe you have a chance. But the practical side of it is not easy
-
This is incredibly easy to do with Pythonista if that's what you're asking for.
from PIL import Image import photos im = photos.pick_image() # Load the image with whatever method you'd like dimension = 1 if raw_input("Which dimension are you inputting?\n").lower() == "width" else 0 dimension_value = int(raw_input("Value: ")) """ We can use the proportion: image_width your_width ------------ = ----------------- image_height unknown_dimension and with this, cross-multiply""" if dimension: # We're solving for the height print im.size[1]*dimension_value / float(im.size[0]) else: print im.size[0]*dimension_value / float(im.size[1])
If this isn't what you're looking for, please elaborate. If my code is wrong, tell me, I wrote it without testing :)
P. S. @Phuket2 it's "grinch" ;)
-
@Webmaster4o Thank you. I think this is a wonderful start but what I want to be able to do is draw a straight line on the jpeg (e.g. one side of a room) and input what the drawing says that is in feet. Then I want to be able to trace the perimeter of the entire plan) and get the area in sq ft. In Adobe Acrobat this is done by measuring one known dimension and setting the scale ratio so that, for example, 1.2in = 14 ft (or whatever the plan says). Then I click at any place on the jpeg and a straight line is drawn until I close the polygon and the area in sq ft is displayed.
-
Right. This is harder, but still doable with proportions and Pythagorean theorem. Use the distance formula (which is really just Pythagorean theorem rewritten) to find diagonal distance between 2 points:
, then use that as a proportion to the known distance. -
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.