Skip to content

Conversation

@chammoru
Copy link

In the current rgb2luv() function, rgb[0], rgb[1], and rgb[2] are used as B,G, and R channel, respectively. This is not right. For the RGB to LUV color space conversion in the code, rgb[0], rgb[2] is should be R, B, respectively. This change simply fixes the problem by exchanging the position of R and B (recall that OpenCV's RGB channel order is BGR).

@alalek
Copy link
Member

alalek commented Jun 28, 2016

This change simply fixes the problem by exchanging the position of R and B (recall that OpenCV's RGB channel order is BGR).

If you call function called "rgb" then you should pass "rgb" data. Don't try to pass "bgr" images, which were received from "imread()" calls.

@chammoru
Copy link
Author

Thanks for the valuable comments, Alekhin.

From the following tutorial:
http://docs.opencv.org/3.1.0/d0/da5/tutorial_ximgproc_prediction.html
we can see the current code has the similar problem that you mentioned
(It is passing "bgr" images to the "rgb2luv()").

What would be a better choice?

  1. Change the function name from 'rgb2luv' to 'bgr2luv' and apply my
    previous patch,
  2. Change the the tutorial so that it can call 'cvtColor(...,
    CV_BGR2RGB)' before the detectEdges() function.

On Tue, Jun 28, 2016 at 8:06 PM, Alexander Alekhin
[email protected] wrote:

This change simply fixes the problem by exchanging the position of R and B
(recall that OpenCV's RGB channel order is BGR).

If you call function called "rgb" then you should pass "rgb" data. Don't try
to pass "bgr" images, which were received from "imread()" calls.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@alalek
Copy link
Member

alalek commented Jun 28, 2016

This functionality with tutorial is introduced in this PR: #49 by @Bellaktris

Documentation says that src is "source image (RGB, float, in [0;1]) to detect edges".
Also there is some pre-trained model (random forest), so it is not easy to add fixes if it has been created on BGR image data (but test passes with your changes for some reason).

@chammoru
Copy link
Author

It seems that my changes get more similar edge detection results with the
Matlab code outputs of Structured Forests for Fast Edge Detection
https://www.microsoft.com/en-us/research/publication/structured-forests-for-fast-edge-detection/
.
But I agree with you that this issue cannot be easily fixed by me, but can
be best handled by @Bellaktris https://github.com/Bellaktris (maybe with
his training code).

On Wed, Jun 29, 2016 at 12:52 AM, Alexander Alekhin <
[email protected]> wrote:

This functionality with tutorial is introduced in this PR: #49
#49 by @Bellaktris
https://github.com/Bellaktris

Documentation
http://docs.opencv.org/3.1.0/d8/d54/classcv_1_1ximgproc_1_1StructuredEdgeDetection.html#a6582e80f4790e4f321dc1404a4adfb60
says that src is "source image (RGB, float, in [0;1]) to detect edges".
Also there is some pre-trained model (random forest)
https://github.com/Itseez/opencv_extra/blob/master/testdata/cv/ximgproc/model.yml.gz,
so it is not easy to add fixes if it has been created on BGR image data
(but test passes with your changes for some reason).


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#716 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AA7z-cCh6JjMInQhJeE_CqHfutsP-Rg3ks5qQUM9gaJpZM4I9zr7
.

allnes pushed a commit to allnes/opencv_contrib that referenced this pull request Jun 9, 2024
* [NVIDIA] Enable clang format

* [NVIDIA] Format 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

Successfully merging this pull request may close these issues.

2 participants