Flip Video in openCV [closed]

asked Oct 28 '14

updated Oct 28 '14

unxnut gravatar image

I am having a problem when using the OpenCV facial recognition. My webcam is mounted upside down, so I have flipped the video with pushMatrix, however the video is still coming in upside down in OpenCV I believe, therefore it is not recognizing anything. How can I flip "video"?

void draw() {
    scale(2);
    pushMatrix();
    scale(1,-1);
    translate(0, -video.height);
    image(video, 0, 0); 
    popMatrix();

    opencv.loadImage(video);

    noFill();
    stroke(0, 255, 0);
    strokeWeight(3);
    Rectangle[] faces = opencv.detect();
    println(faces.length);

    for (int i = 0; i < faces.length; i++) {
        println(faces[i].x + "," + faces[i].y);
    rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
Preview: (hide)

Closed for the following reason question is off-topic or not relevant by berak
close date 2017-12-13 12:09:16.997932

Comments

is that processing or something similar ?

berak gravatar imageberak (Oct 28 '14)edit
1

OpenCV has a working function for that called flip. But just like berad I have no idea if this will help you, since you are using no standard OpenCV interface as it seems.

StevenPuttemans gravatar imageStevenPuttemans (Oct 28 '14)edit

Thank you, I figured it out. Yes, I am sing processing. It just required that I use flip(0);

jordanphstein gravatar imagejordanphstein (Oct 28 '14)edit

What is sing processing? Sounds interesting...

thdrksdfthmn gravatar imagethdrksdfthmn (Oct 28 '14)edit

@thdrksdfthmn he forgot to type an extra 'u' so the actual name of the language is 'Processing'. More info on the package can be found here. It wraps OpenCV functionality for their purpose.

StevenPuttemans gravatar imageStevenPuttemans (Oct 29 '14)edit

Could you please tell me what you did to flip the video? I understand the flip function requires and input and output array but I am unable to give the VideoCapture array as an input to this function. Could you tell me how to go about this? Thank you.

SVijayan gravatar imageSVijayan (Dec 13 '17)edit

@SVijayan, please do not post answer here, if you have a question or comment, thank you !

berak gravatar imageberak (Dec 13 '17)edit