user2799508
user2799508

Reputation: 848

OpenCVs LineIterator's equivalent in MATLAB

I used this function in OpenCV for extracting pixel values along a line in an image:

//Iterate through the line along which Intensity profile is required 
LineIterator it(img, Point(1,1), Point(20,20), 8);

vector<Vec3b> buf;   

for(int i=0; i<it.count; i++)
{
    buf.push_back( Vec3b(*it) );
    it++;
}

cerr << Mat(buf) << endl;

This will print all the values stored along the line.

For verifying my algorithm using MATLAB I am looking for a similar function in MATLAB.

Can someone explain how to achieve this using in MATLAB?

Upvotes: 0

Views: 175

Answers (1)

Shai
Shai

Reputation: 114786

I think you are looking for improfile command:

buf = improfile( img, [1 20], [1 20] );

Upvotes: 1

Related Questions