You can use Photoshop's Vanishing Point filter for this.
It's easiest to use a 3D-capable version of Photoshop,¹ which I presume you have, since you haven't mentioned any other 3D software. There is an alternate path for those using a version of Photoshop that lacks the 3D features, which I will cover inline below.
This technique works best with a rectilinear photo, meaning one without any distortion. Distortion makes it impossible for Photoshop to create 3D geometry that aligns accurately with features in the photo. You can manually edit the geometry Photoshop creates to make an inaccurate model to match your inaccurate photo, but that's an avoidable hassle.
The best way to achieve a rectilinear photograph is to use a low-distortion lens to take the picture. The DxO lens database can help you select one. Additionally, you should use a lens supported by the lens correction feature of Lightroom or ACR, then use that automatic correction on your photo before attempting to construct a 3D model from it.
Here's how you go about it:
Open your photo in Photoshop, then say Filter → Vanishing Point. Using the Create Plane tool, draw a box around the sitting surface of the two fully-visible cushions.
You need to be fairly accurate about how you establish this plane, since any errors here will propagate to the rest of the 3D model. Photoshop will help you with this: the grid inside the plane changes color to indicate how plausible the plane is. You want to see a blue grid, not yellow or red. A blue grid doesn't guarantee that it's correct for your scene, however, just that it could be correct.
While holding down Command (Mac) or Control (Windows), drag downward from the resizing box on the front edge of that plane to drop a new vertical plane down over the front edge of those far cushions.
Now repeat that Cmd/Ctrl-drag move 4 more times to create the planes that cover the cushion nearest the camera: first a vertical one to cover the hidden front of the cushion, then a horizontal one covering the sitting area, then two more vertical ones to cover the sides facing the camera.
Finally, extend the first plane to cover the sitting surface of the inside corner cushion.
Size these planes to cover the entire visible surface, even though this requires covering some areas of the photo that aren't part of the cushions:²
We'll adjust the plane coverage later.
If you find that as you get further from the first plane, the new ones align increasingly poorly with the sofa surfaces, the most likely cause is that you did not precisely align the first plane to the cushion's sitting surface. As you extend out from that misaligned plane, you're magnifying that error. The best fix for this is to delete all but the first plane, then tweak its corners a bit to make it match the scene better. When you re-extend those other 5 planes, they should now match the scene more accurately.
Another likely cause is that you ignored the advice above to start with a rectilinear photo.
Tell the Vanishing Point filter that you want it to return a 3D layer to Photoshop:
If your version of Photoshop lacks this feature, stay in the Vanishing Point filter for now. We'll do the next step a bit differently to work around this lack of direct 3D support.
Otherwise, say OK, and you'll get a new 3D layer with a primitive model of the sofa surfaces you've outlined.
That pretty much answers your original question. Yes, it's only 6 surfaces in 3D, not exactly a detailed model, but as you will see, it is enough for some purposes.
What we're going to do next is akin to camera mapping, a technique often used in VFX to get quick 3D effects in a 2D scene without going fully 3D. Instead of projecting a photograph onto rough 3D geometry, we're going to use our rough 3D geometry to aid projection of textures back onto the photograph.
When you return the 3D layer to Photoshop from the Vanishing Point filter dialog, it may ask you if you want to jump to the 3D workspace;³ accept the offer.
If it asks about the measurement units for the new layer, you can fill in accurate values if it makes you happy, but it won't affect the results, as far as this answer goes. This only matters if you're going to export the 3D layer to another program and need the new geometry to fit the scale of a larger scene.
You will now see your primitive 3D model layered over the base photograph. Photoshop will attempt to extract textures from the base photo for this model, but don't worry about those; we'll use Photoshop's painting tools to fill these 3D surfaces with the texture we want instead.⁴
Here I've used the pattern brush with a gaudy pattern, so it's easy to see the effect. Just fill all the surfaces with your texture to begin with:
Notice that the pattern is in proper perspective, shrinking into the distance. This happens because we're painting onto a 3D surface that matches the rough geometry of our 2D scene.
If you're using a version that lacks this ability to create a 3D object from Vanishing Point planes, you can use the Stamp tool from within the Vanishing Point dialog to copy flat textures onto the planes. This has the same effect as painting onto a 3D model, which is to apply your texture to the scene in proper perspective.
Add a black layer mask to the 3D layer by Option/Alt-clicking the layer's mask icon, then paint white over the areas you want to show the pattern:
As you can see, I did a very rough job here. I intentionally made the mask a bit bigger than needed, using a big hard-edged brush and big, sloppy strokes. If this takes you more than 30 seconds, you're wasting time. We'll choke the mask back with some detail work in the next step.
Drop the layer's opacity to about 50% so you can see the underlying photograph well enough to see the cushion edges, then carefully refine the edges of your mask to cover only the parts of the 3D model that you want to show the pattern.
Pro tip: A single click with a Photoshop brush followed by a Shift-click elsewhere gives you a nice straight stroke which you can't easily duplicate by hand. Here, you can click on the layer mask near one corner of a cushion with a hard-edged brush so that the brush just barely touches the cushion's edge, then Shift-click the same distance away from the other corner along that edge of the cushion. This lets you quickly and accurately trim away the mask's excursions beyond the straight edges.
Raise the 3D layer's opacity to 90-100% and switch its blend mode to something suitable. For this texture and background photo combination, Linear Burn works well:⁵
Voilà, electronic upholstery!
Now, this technique isn't perfect. The model is just a few planes, so textures painted on it don't bend around the sofa's curves precisely. As you can see in the picture above, this limitation may not matter for some practical purposes. The shadows from the photo blend with the texture to give the illusion that the texture wraps tightly to the sofa surface, though it really does not.
One quick way to fix this, if you needed to, is to use the Liquify and Warp filters to bend the texture a bit to follow the contours.
If you really need an accurate model or a 2D UV map file so that you can do automated texture replacements, you have a couple of options:
Go through steps 1 and 2 above. Then, instead of selecting the "Return 3D Layer to Photoshop" option from the flyout menu, tell Photoshop to Export to 3DS...
This gets you a 3ds Max file, which many other 3D applications can also open. This format is used widely enough that you can usually get good-fidelity imports into programs other than 3ds Max, particularly for geometry as simple as what we've created here.
In Photoshop CS4 Extended or later, you can continue through step 3 above to return the 3D layer to Photoshop from the Vanishing Point filter dialog, then say 3D → Export 3D Layer...
Oddly, the 3ds Max format isn't one of your choices here. Of the ones Photoshop gives you, I recommend Wavefront OBJ. It's about as widely compatible as
*.3ds. Many 3D programs will open both, while others will open only one or the other.
COLLADA is an open standard, so in theory it should be the best option, but I find that importers frequently mangle the geometry.⁶ Still, you may want to try it if the
*.obj options don't work for you.
Photoshop can also export to STL and DXF, which are widely supported but inappropriate for this sort of work. They're real-world CAD formats, not creative imaging formats. You could use them in the manufacture of actual sofas.
All the other options are "standards" in the XKCD sense. Avoid them.
Now you "just" need to open this model file in a true 3D modeler, and refine it. A full-featured 3D package will also let you work directly with the UV map, if you need to.
This gets us way outside the scope of this site, though. Even if 3D modeling were on topic here, to go much further than this, I'd basically have to answer the question, "How do you do 3D modeling?" That topic takes whole books to explain. You need months of practice to acquire competence, and about 10,000 hours of focused, skill-building practice to achieve a measure of expertise. This skill is rare enough, difficult enough, and valuable enough that you can make a living doing it.
Once you have a detailed 3D model, you can bring it back into Photoshop if you like. Photoshop is a pretty good 3D texture painting tool. There are also dedicated tools like MARI, 3D-Coat, and BodyPaint 3D. High-end 3D packages often include texture painting features that rival or exceed Photoshop within their more specialized scope: CINEMA 4D, modo, Blender, etc...
If you're subscribed to the full Creative Cloud, you already have CINEMA 4D Lite, a stripped-down but quite functional version of C4D, which now includes BodyPaint, a feature that used to be available only in the non-Lite versions. You can think of BodyPaint as a 3D-only alternative to Photoshop, made to paint directly on models like we've done above. The main practical restriction is that you must use it through After Effects, which is awkward if you weren't already using AE for your project. On the plus side, you can get to AE straight from the Vanishing Point filter:
This means CS3 Extended through CS6 Extended, or any of the Creative Cloud versions. I have tested this technique in CS3 Extended and in CC 2014.2.
You will see blue grids, rather than solidly-colored numbered planes. I colored and numbered the planes to make the example clearer.
If you're looking for the yellow third plane, it's facing away from the camera. We only had to construct it in order to get around the corner of the sofa's L shape.
All 3D-capable versions of Photoshop have the Workspaces feature, but earlier versions didn't do this automatic workspace mode switching. The 3D workspace wasn't added to Photoshop until CS4. Also, versions that do offer to switch you into the 3D workspace can be told to remember the choice, so it may just switch the workspace without asking.
Strictly speaking, this doesn't give you the UV map you asked for, but direct model painting is what you really want in most cases. If you really need a separate UV map file, you need to export Photoshop's 3D model to another application, as described above.
Texture painting works differently in Photoshop CS3 Extended. CS4 added the ability to paint directly on the model, whereas in CS3, you have to open and edit each texture separately. For this technique, the difference really doesn't matter.
The Multiply blend mode can also work well for this sort of combination. Other textures and base photos may require another blend mode entirely.
This is probably because COLLADA isn't backed by one of the major 3D software producers, and thus lacks the market clout to define what the standard means in the real world. It's an open standard, so every company that implements it has their own incompatible take on it.