For Blender 2.8x use fSpy
(For blender versions 2.7x or older read the instructions at the bottom of this post.)
fSpy is an Open source still image camera matching app that sets the parameters of the Blender camera and optionally sets the camera background image.
Download the app (https://github.com/stuffmatic/fSpy/releases) and run it.
Open the picture within fSpy
Move the red and green lines and place them along lines that would be parallel in the real world, but that on the picture converge to a vanishing point.
Additionally set also the placement for the origin and grid (and if you know the distance between two points you can enter that as well).
In this case the tiles on the floor are perfect to set the lines, but for other images, all that matters is that the lines are on the same plane and are parallel in the real world, like walls, windows, ceilings, roads, etc. On the left side of the interface you can set what color line corresponds with what axis for the 3D envirionment. X and Y will be for horizontal lines and Z for vertical
Save the fspy project.
Download the fspy Addon for blender (https://github.com/stuffmatic/fSpy-Blender)
Open Blender 2.8, install and enable the fspy addon.
(detailed instructions on how to install the addon here)
Import the fspy project into blender.
A new camera will be created along with a camera background image.
Now you have a scene that matches that of the photograph, so that you can recreate the geometry and add whatever you want.
Start reconstructing the geometry.
You can choose to unwrap UVs Using Project from view, to place some of the original textures from the photograph.
From there on, you can create whatever materials you want and composite them on top of the original image.
Why settle with a boring old rug when you can have your own indoor soccer field?
#For version 2.79
Use version 1.0.2 of the fSpy addon.
For older versions of blender use Blam Add-on!
NOTE: Blam is no longer mantained
To use Blam.
- Download, install and enable the addon.
Load the image in the Movie Clip Editor.
Use the grease pencil to draw a series of lines following elements that would be parallel in the real world. Use a different layer of grease pencil for lines going in different directions.
In the Misc. tab. Set the camera calibration to use 2 vanishing points.
Determine the axis for each of the grease pencil layers.
Activate Set Background Image and click on Calibrate active camera
In the 3D viewport the camera lens will change to use the estimated focal length and will be placed using a matching perspective as the original image. The project render size will also change to match the dimensions of the original image.
Load the original image to be used as background and start reconstructing the geometry
Graphics Provided by Vecteezy.com
You could try using the photo as a texture on a plane. There's an addon "Images as planes" that does this for you. Another one is to use the viewport background images (N-panel, scroll down to "background images", "Add Image"). Those are only visible in orthogonal preset views (i.e. front/back/left/right/top/bottom or Numpad 1-3-7) Use numpad 5 to tobggle pesrppective to orthogonal) or the camera perspective view (Numpad 0)
Hope this helps.
Edit: This won't give you just the floor, you'd have to cut the floor into a separate image yourself.