Retrieve real wood fiber structure from image

I am going to write a program to process an image with very fine wood fibers in it. Please have a look at this for a quick idea - http://alturl.com/7jnuh

What I want to do is keep only the fiber lines in a black and white image and discard other features and colors. How can I use OpenCV to it? Thanks.

Not sure. I would get the pixels and then figure out if they are dark or light and then go from there I guess. Maybe compare them to thier neighbours?

boofCV has a line detector. You can install it via the Contributor manager in the PDE and try its examples.

Kf

If all you need is an image, you can use the built in filters: https://processing.org/reference/filter_.html

If you need more control, I can recommend using shaders like this one: https://github.com/SableRaf/Filters4Processing/tree/master/sketches/ContrastSaturationBrightness

This is an example result:

And the modified code for the PDE


PShader myFilter;
PImage  myImage;

void setup() {

  size( 474, 474, P2D );
  
  myImage  = loadImage( "th.jpg" );
  myFilter = loadShader( "shader.glsl" );

}


void draw() {

  background(0);

  // Draw the image on the scene
  image( myImage, 0, 0 );
  
  // For all settings: 1.0 = 100% 0.5=50% 1.5 = 150%
  float c = 2.6;
  float s = 0.0;
  float b = 2.2;

  // Pass the parameters to the shader
  myFilter.set( "contrast",   c );
  myFilter.set( "saturation", s );
  myFilter.set( "brightness", b );

  // Applies the shader to everything that has already been drawn
  filter( myFilter );

}

Download the whole thing here: https://we.tl/44hfxifLXC (link will expire in 7 days)

Thank you all for your replies.