Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debayer filter fails for vertically flipped images #46

Open
bakercp opened this issue Dec 13, 2017 · 1 comment
Open

debayer filter fails for vertically flipped images #46

bakercp opened this issue Dec 13, 2017 · 1 comment

Comments

@bakercp
Copy link

bakercp commented Dec 13, 2017

// horz, vert
_cam->setFlip(false, false);

blank_skitch_document

// horz, vert
_cam->setFlip(false, true);

blank_skitch_document

The filter works correctly for horizontally flipped images.

This is likely because the pattern looks different upside-down.

 G R G R G R
 B G B G B G
 G R G R G R
 B G B G B G

@rovarma Thanks for your work on this! I'm updating https://github.com/bakercp/ofxPS3EyeGrabber/

@bakercp
Copy link
Author

bakercp commented Dec 14, 2017

Just a small followup for reference. Since opencv is a default included addon for openFrameworks I'm just using cv::demosaicing to do my conversions as it is hardware optimized, etc. For pixels with no vertical flip I use

        if (_pixelFormat == OF_PIXELS_GRAY)
        {
            code = vFlip ? cv::COLOR_BayerRG2GRAY : cv::COLOR_BayerGB2GRAY;
        }
        else
        {

The difference is just RG vs GB (the default debayering function in this library is hard-coded to GB). After choosing the right conversion type, I pass my pixels like this:

        cv::demosaicing(ofxCv::toCv(_rawCameraPixels),
                        ofxCv::toCv(_pixels),
                        code);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant