Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: how to apply a texture to an area of image which has been marked already?

  1. #1
    Newbie Newbie
    Join Date
    Oct 2017
    Posts
    1

    how to apply a texture to an area of image which has been marked already?

    The first thing to say is that I only have coded OpenGL in a course 4-5 years ago at university, so my knowledge of OpenGL is very limited and what I'm asking is for a bigger project which needs some image processing and showing the output.
    So I would be very thankful if anyone kindly and generously helps me to solve my problem.
    Let's say I have an image of a sofa and a region of interest marked red like below:
    Click image for larger version. 

Name:	poshti.jpg 
Views:	15 
Size:	9.8 KB 
ID:	2497
    And let's say I have fabric image like below:
    Click image for larger version. 

Name:	5.jpg 
Views:	15 
Size:	30.6 KB 
ID:	2498

    The purpose is to cover the fabric image over the region of interest in the sofa image.
    How can I accomplish this?

    Thanks in advance

  2. #2
    Member Regular Contributor
    Join Date
    Jul 2012
    Posts
    429
    You'll basically have to split the mesh of the sofa into different meshes. You'll have to have a mesh for your marked region.
    If your model (the sofa) does not have multiple meshes, modelers will generally help you to cut your model into different meshes.
    One you have that, then use the texture only for this mesh.
    You can consider a mesh to be a set of vertices, normals, colors, texture coordinates which share the same material properties (here your texture).

    Another approach, which is more for artists, is to copy/paste your image portion at the UV positions where you want this texture to apply.

  3. #3
    Member Regular Contributor
    Join Date
    May 2016
    Posts
    445
    in terms of "image processing", the marked region could also be determimed by its color (red for example). render full-screen quad: if fragment color's red component > threshhold, use texture. or blend both images, using the source image's red component as blending weight.

  4. #4
    Member Regular Contributor
    Join Date
    Jul 2012
    Posts
    429
    Quote Originally Posted by john_connor View Post
    in terms of "image processing", the marked region could also be determimed by its color (red for example). render full-screen quad: if fragment color's red component > threshhold, use texture. or blend both images, using the source image's red component as blending weight.
    Nice solution !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •