Heat map generator of a floor plan image

匆匆过客 提交于 2019-12-12 09:54:44

问题


I want to generate a heat map image of a floor. I have the following things:

  1. A black & white .png image of the floor
  2. A three column array stored in Matlab. -- The first two columns indicate the X & Y coordinates of the floorpan image -- The third coordinate denotes the "temperature" of that particular coordinate

I want to generate a heat map of the floor that will show the "temperature" strength in those coordinates. However, I want to display the heat map on top of the floor plan so that the viewers can see which rooms lead to which "temperatures".

Is there any software that does this job? Can I use Matlab or Python to do this?

Thanks,

Nazmul


回答1:


One way to do this would be:

1) Load in the floor plan image with Matlab or NumPy/matplotlib.

2) Use some built-in edge detection to locate the edge pixels in the floor plan.

3) Form a big list of (x,y) locations where an edge is found in the floor plan.

4) Plot your heat map

5) Scatterplot the points of the floor plan as an overlay.

It sounds like you know how to do each of these steps individually, so all you'll need to do is look up some stuff on how to overlay plots onto the same axis, which is pretty easy in both Matlab and matplotlib.

If you're unfamiliar, the right commands look at are things like meshgrid and surf, possibly contour and their Python equivalents. I think Matlab has a built-in for Canny edge detection. I believe this was more difficult in Python, but if you use the PIL library, the Mahotas library, the scikits.image library, and a few others tailored for image manipulation, it's not too bad. SciPy may actually have an edge filter by now though, so check there first.

The only sticking point will be if your (x,y) data for the temperature are not going to line up with the (x,y) pixel locations in the image. In that case, you'll have to play around with some x-scale factor and y-scale factor to transform your heat map's coordinates into pixel coordinates first, and then plot the heat map, and then the overlay should work.

This is a fairly low-tech way to do it; I assume you just need a quick and dirty plot to illustrate how something's working. This method does have the advantage that you can change the style of the floorplan points easily, making them larger, thicker, thinner, different colors, or transparent, depending on how you want it to interact with the heat map. However, to do this for real, use GIMP, Inkscape, or Photoshop and overlay the heatmap onto the image after the fact.




回答2:


I would take a look at using Python with a module called Polygon

Polygon will allow you to draw up the room using geometric shapes and I believe you can just do the borders of a room as an overlay on your black and white image. While I haven't used to a whole lot at this point, I do know that you only need a single (x,y) coordinate pair to be able to "hit test" against the given shape and then use that "hit test" to know the shape who's color you'd want to change.

Ultimately I think polygon would make your like a heck of a lot easier when it comes to creating the room shapes, especially when they aren't nice rectangles =)

A final little note though. Make sure to read through all of the documentation that Jorg has with his project. I haven't used it in the Python 3.x environment yet, but it was a little painstaking to get it up an running in 2.7.

Just my two cents, enjoy!



来源:https://stackoverflow.com/questions/11805983/heat-map-generator-of-a-floor-plan-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!