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

get_darknet_image() flips RGB to BGR but darknet expects RGB #67

Closed
series8217 opened this issue Mar 5, 2019 · 2 comments
Closed

get_darknet_image() flips RGB to BGR but darknet expects RGB #67

series8217 opened this issue Mar 5, 2019 · 2 comments
Assignees

Comments

@series8217
Copy link

If I'm following the code correctly, it looks like there is an erroneous reordering of color channels in get_darknet_image():

image get_darknet_image(const Mat &input){
    // Darknet requires BGR order
    Mat flipped;
    cvtColor(input, flipped, CV_RGB2BGR);

The comment "Darknet requires BGR order" is not correct -- In fact, darknet expects RGB-ordered images. This can be seen in the BGR->RGB conversion darknet performs when loading openCV images. Refer to image_opencv.load_image_cv(), which calls mat_to_image() and rgbgr_image(im).

@madhawav
Copy link
Owner

madhawav commented Mar 9, 2019

@series8217 Thank you for bringing attention to this.
Let me go through the code in depth and get back to you. This could be a fact I have overlooked.

@Arcitec
Copy link

Arcitec commented Oct 1, 2019

@madhawav There's even more proof that Darknet is RGB based here: pjreddie/darknet#427

:-)

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

3 participants