Search code examples
imageimage-processingopencvcomputer-visionemgucv

How to extract a linear slice from an image in OpenCV / EMGU


I have an image and two points,
and I want to read the pixels between these two points,
and resample them into a small 1x40 array.
I'm using EMGU which is a C# wrapper for OpenCV.
thanks,
SW

Sample image


Solution

  • Emgu CV includes method in the Image class for sampling color along a line called Sample.

    Refer to the manual for the definition. Here's the link to Image.Sample in version 2.3.0.

    You will still have to re-sample/interpolate the points in array returned from Sample to end up with a 40 element array. Since there are a number of ways to re-sample, I'll suggest you look to other questions for that.