Ask Your Question

Getting the marker texture

asked 2017-08-01 18:08:48 -0500

Ahmed gravatar image

I would like to do implementation like that video I would like to use opencv, c++, or pure mathematical stuff. I don't know how really is that app working, would someone give me hints on how to proceed technically on that problem ?

edit retag flag offensive close merge delete


Closed down for obvious reasons. (edit) only reopened because @Raki was so nice to give you some pointers. Keep in mind that we expect more from a question :).

StevenPuttemans gravatar imageStevenPuttemans ( 2017-08-02 06:52:30 -0500 )edit

3 answers

Sort by ยป oldest newest most voted

answered 2017-08-02 11:06:20 -0500

dpizzle gravatar image

I've done an implementation of this in Unity with Vuforia and Region Capture (search github). But here would be the steps in opencv.

  1. Detect the marker which is the B/W coloring page (something like sturkmen's answer might work)
  2. From detecting the marker you know the coordinates of where in the camera stream the page is
  3. Using the four corners, cutout and unwarp the colored page from the camera stream so it fills a square
  4. Use this square image as a the texture for your UV map on your 3d model
  5. Display 3d model on marker

The key is the UV map of the model has to somewhat match the actual coloring page. You'll have to do some tricks to get the backside of the model, like doubling up with the front side of the UV map in that area. Search UV map on google images to get an idea of what they are if you don't know. Good luck.

edit flag offensive delete link more


can you point me to github code ?

Ahmed gravatar imageAhmed ( 2017-08-02 11:11:40 -0500 )edit

The region capture plugin is gonna be specific to Unity and Vuforia, won't be useful at all to opencv. But this is how a lot of the commercial apps do AR coloring books.

dpizzle gravatar imagedpizzle ( 2017-08-02 16:22:28 -0500 )edit

answered 2017-08-02 06:53:54 -0500

Raki gravatar image

updated 2017-08-02 07:46:54 -0500

I cannot comment on the augmented reality part, as this is entirely a different universe but your first aim should be

  1. Detecting the paper (where the textures are drawn on) is quite easy, given the fact that you have a static background that does not change. In that case you can use something to this example, where he detects the paper by using contours.

  2. After you detect the paper, you can grabcut it and get rid of the background. See this for more information.

  3. Once you are left with only the paper, now you can get rid of the white part (paper background) and finally have only the textures. That of course, implies that your textures have no white color in them :) If they have white color as well, then this won't work.

edit flag offensive delete link more


does this work for little bit inclinde paper as shown in the picture ? Thanks for the answer

Ahmed gravatar imageAhmed ( 2017-08-02 07:41:02 -0500 )edit

Sorry what picture and what paper are you referring to?

Raki gravatar imageRaki ( 2017-08-02 07:48:41 -0500 )edit

I mean an inclined drawing, like the picture that is captured to be drawn on the mesh

Ahmed gravatar imageAhmed ( 2017-08-02 08:08:31 -0500 )edit

The inclination of the paper has nothing to do with the methods I suggested. It can be inclined with a certain degree of angle that is fine.

Raki gravatar imageRaki ( 2017-08-02 08:53:54 -0500 )edit

That's what I have done so far :)

Ahmed gravatar imageAhmed ( 2017-08-02 10:36:40 -0500 )edit

answered 2017-08-02 08:13:14 -0500

updated 2017-08-02 08:23:44 -0500

you can find sources of an example marker less augmented reality application developed using OpenCV here

i think trying to understand OpenCV methods which used in this example will be correct starting point.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-08-01 18:08:48 -0500

Seen: 2,495 times

Last updated: Aug 02 '17