I'm in a hurry. Help. This is an OPEN CV 'contour' question

I’m in a hurry. Help. This is the OPEN CV’contour’ question.

I want to get the x,y coordinate values for’contour’.

Please tell me a way to get the x,y coordinates. Please.

int x =?
int y =?

import gab.opencv.;
import processing.video.
;

Movie video;
OpenCV opencv;

void setup() {

size(1920, 1080);
// size(720, 480);
video = new Movie(this, “test_video_2.mp4”);

opencv = new OpenCV(this, 720, 480);

opencv.startBackgroundSubtraction(5, 3, 0.5);

video.loop();
video.play();
while (video.height==0) delay(2);

}

void draw() {

image(video, 0, 0); image(video, 720, 0);

opencv.loadImage(video);
opencv.updateBackground();
opencv.dilate();
opencv.erode();
noFill();
stroke(255, 0, 0);
strokeWeight(3);

for (Contour contour : opencv.findContours()) {
contour.draw();
int num = contour.numPoints();
float sizes = contour.area();
print(contour.getPoints());
}

}
void movieEvent(Movie m) {
m.read();
}

I know you are busy but that’s not how you format code - not Button but please use </>.

Also this is not a customer support so I don’t think it’s good to emphasize “I’m in a hurry” :frowning:

3 Likes

I want to get the x,y coordinate values for’contour’.

int x =?
int y =?

Is there any way?

I would delve into the references and examples that come with the library.
The repository for this is on GitHub.

:)

1 Like

Again, please format your code first :slight_smile:

For contour, I guess this gives you some information:
http://atduskgreg.github.io/opencv-processing/reference/gab/opencv/Contour.html#getBoundingBox()