Here's a simple process:
- Assign texture measurements to each region in the image.
- Use a region labeling / connectivity algorithm (or region growing algorithm) to join adjacent regions having the same texture measure.
- Implement a simple edge-following algorithm to trace the contour of each region.
Law's Texture Measures are an older but still useful technique for determining the texture in an image, and they may be sufficient for you to distinguish texture A from texture B throughout the image. See the section "Laws Texture Energy Measures" in the Wikipedia article:
As a first step, calculate all texture measures and determine which particular measure (e.g. Edge or Spot) allows you to distinguish one texture from the other most easily. (If you post some pictures I could help you identify a texture measure.)
If you have only two textures, A and B, then you can treat them as foreground and background, and a standard region labeling algorithm will work. To make it easier to see what's happening in the processing, you could generate a new image by assigning A texels (texture elements, little chunks of texture) to the color white, and B texels to the color black. Region labeling and/or contour-following algorithms would then find the connected white and black regions. The findContours() function in OpenCV will work well.
The same Wikipedia article includes both the traditional multipass algorithm as well as a single-pass algorithm. I haven't implemented the single-pass algorithm described there, but I have worked with the single-pass algorithm described in the paper "A Component-Labeling Algorithm Using Contour Tracing Technique" by Chen and Chang. The paper by Chen and Chang also describes a standard contour-following algorithm that can be implemented quickly.
If you have more than two textures, then you might use a watershed or mean shift algorithm to cluster regions together after you've remapped textures to colors. Although this remapping from texture to color isn't necessary, it does make the process easier to debug and understand.