Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Using ofPolyline or vector within ofxCv

$
0
0

@aceslowman wrote:

I can't tell if this is an openCv question or an ofxCv question, but I can't figure out how to use a ofPolyline or a vector within ofxCv for a distance transform. I have a feeling that this is more because it's giving me a collection of points, not necessarily a full image (totally might be wrong in this assumption). This works fine using an actual image or while using ofPixels, but I don't know how to utilize a collection of points in this same way. Here is what I need to achieve:

    Mat dist;
    Mat src(contourFinder.getContour(0));
    src.convertTo(src,CV_8UC1);

    distanceTransform(src,dist,CV_DIST_L2,3);
    normalize(dist,dist,0.0,1.0,NORM_MINMAX);
    imshow("dist",dist);

Which returns:

OpenCV Error: Unsupported format or combination of formats (source image must be 8uC1 and the distance map must be 32fC1 (or 8uC1 in case of simple L1 distance transform))

Any advice?

EDIT: I have found a method to create polylines within openCV, but it doesn't appear to be working. This is what I tried, which came out badly broken :

    Mat dist;
    Mat src(kinect.height,kinect.width, CV_8UC3);
    polylines(src, contourFinder.getContour(0), true, Scalar(255));

    imshow("src",src);

ANOTHER EDIT: Okay I really don't need to be doing this for the distance transform, and what's more, I don't need the distance transform for what I want to do. Regardless, I'm curious if there is a way to use polylines within opencv in general.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles