problem in ycbcr color space
이전 댓글 표시
I am facing some problems in using the ycbcr color space. For a certain purpose this model is the most suitable. But conversion from RGB to ycbcr yields me some negatives values too... Please help. Why does this happen? Are there any ways to solve this?
댓글 수: 1
Star Strider
2015년 6월 27일
It will help if you posted (or attached) your code, and attached your image.
채택된 답변
추가 답변 (2개)
Image Analyst
2015년 6월 28일
0 개 추천
I'm not that familiar with that particular color space. What conversion are you using? I see from https://en.wikipedia.org/wiki/YCbCr that there is a minus sign in the formulas so perhaps they can go negative. I assume you're using rgb2ycbcr(). What colors are you getting negative values for?
댓글 수: 2
Ashmil Mohammed
2015년 6월 28일
Image Analyst
2015년 6월 28일
If you answer my questions, maybe I can answer yours . OK, if you won't tell me the colors, then maybe you could upload the image. Uploading your m-file, or at least a snippet, would make me more likely to try it, and sooner, than if I had to write it myself.
Thorsten
2015년 6월 28일
0 개 추천
You have some error in your formula. RGB values in the range 0, 255 or R'G'B' values in the range 0..1 map to non-negative YCbCr values. See https://en.wikipedia.org/wiki/YCbCr
댓글 수: 5
Image Analyst
2015년 6월 29일
But in his comment to me he said he didn't use any formula -- he said he used the built-in rgb2ycbcr() function.
Ashmil Mohammed
2015년 6월 29일
Walter Roberson
2015년 6월 29일
Try
RGB = cat(3, uint8([0 0 0 0 255 255 255 255]), uint8([0 0 255 255 0 0 255 255]), uint8([0 255 0 255 0 255 0 255]));
image(RGB);
y = rgb2ycbcr(RGB);
min(y(:))
I cannot test this on my system as I do not have the toolbox for it.
This arrangement tests all the combination of minimum and maximum RGB codes. If something is going to come out negative then it should show up here.
Image Analyst
2015년 6월 29일
Walter, the answer is 16. Ashmil, it's probably best you switched to HSV color space, though I was wondering what situation you had that made you original think "For a certain purpose this model is the most suitable". I think for most situations that I know of, conversion to HSV is fine. The only time I switch to LAB is if I need to compute a color difference because the Delta E formula in LAB space is much, much simpler than it is in HSV color space.
Walter Roberson
2015년 6월 29일
16 is the answer to be expected from the description of YCbCr in Wikipedia.
카테고리
도움말 센터 및 File Exchange에서 Images에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!