Flip Video in openCV [closed]

asked 2014-10-28 09:09:35 -0600

updated 2014-10-28 09:16:36 -0600

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);
edit retag flag offensive reopen merge delete

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 ( 2014-10-28 09:19:28 -0600 )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 ( 2014-10-28 09:42:22 -0600 )edit

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

jordanphstein gravatar imagejordanphstein ( 2014-10-28 10:13:37 -0600 )edit

What is sing processing? Sounds interesting...

thdrksdfthmn gravatar imagethdrksdfthmn ( 2014-10-28 10:32:35 -0600 )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 ( 2014-10-29 02:51:01 -0600 )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 ( 2017-12-13 10:13:14 -0600 )edit

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

berak gravatar imageberak ( 2017-12-13 10:54:34 -0600 )edit