Drawing outlines using sequence point settings?

I am working with OpenCV to find the area of ​​an image outline using cvFindContours (). Then, I would like to draw this outline with different coordinates (and different pixels) ...

So, I get all the points of the contour elements using cvGetSeqElem () and convert the pixel match and create a custom cvSeq and load each element into a custom cvSeq. However, when I try to draw an outline with cvSeq configured, there are no answers in the image.

For this work, I would like to use an outline to mask the image.

The code is as follows:

<!-- language: c++ --> CvMemStorage *memStorage = cvCreateMemStorage(0); CvSeq* seq = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvPoint), memStorage); void SetMaskingPoints(CvPoint point) { cvSeqPush(seq, &regionPoint); } void DrawMaskingPoints() { cvDrawContours(maskingImage, seq, cvScalar(255,255,255), cvScalar(0,0,0), 0, 1, 8); } 

My code starts by getting the outline element and loading into SetMaskingPoints () as sequentially, then Draw the outline DrawMasingPoints ().

I also tried to print and found that cvSeq is made up of dot values ​​but cannot be drawn.

+4
source share
1 answer

Try replacing 0 with cvCreateSeq as follows: (CV_SEQ_KIND_CURVE|CV_SEQ_ELTYPE_POINT|CV_SEQ_FLAG_CLOSED) .

+1
source

Source: https://habr.com/ru/post/1433339/


All Articles