Representing a pixel's color vector in 3D RGB space and transforming into 2D space
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Aiswarya C B
el 10 de Feb. de 2020
Comentada: Aiswarya C B
el 12 de Feb. de 2020
I have been trying to implement the paper "Wang, Yinglong & Liu, Shuaicheng & Zeng, Bing. (2018). Removing rain streaks by a linear model. " I am not able to implement the following portion of the paper.
The color characteristics of rain can be used to identify the mis-detected rain pixels. For a given pixel , use to represent its color vector in RGB space. Then, transform this 3-D RGB space into a 2-D space as follows:
where
After transformation, any pixels having a neutral color will be clustered among (0,0) in the u-v space. For each rain pixel detected above, transform their RGB values into the u-v space to form a 2-D vector(i.e., the Euclidean distance to the origin of the u-v space) is larger than a pre-set value 0.08, is detected as a mis-detected rain pixel.
I have written the following code to represent the image in 3-D RGB space.
I=imread('inputRain.png');
R = I(:,:,1);
G = I(:,:,2);
B = I(:,:,3);
But, I cant convert this to the 2D vector space. I dont know how to implement these equations. Can anybody help me ?
2 comentarios
Adam
el 10 de Feb. de 2020
What do you mean by not getting 'the output'?
What data type is your image? Is it uint8 or floating point? I don't know if it matters for that equation, but since you are doing a division I would imagine they need to be floating point. If so the range of each colour channel should be 0-1.
Respuesta aceptada
Image Analyst
el 10 de Feb. de 2020
Did you try
R = double(I(:,:,1));
G = double(I(:,:,2));
B = double(I(:,:,3));
C = (R + G + B) / 3;
u = (2*C - G - B) ./ C;
term1 = (C - G) ./ C;
term2 = (C - B) ./ C;
v = max(cat(3, term1, term2), [], 3)
I don't know what " is detected as a mis-detected rain pixel." means. But you can do thresholding, like
binaryImageu = u > 0.08;
binaryImagev = v > 0.08;
7 comentarios
Image Analyst
el 12 de Feb. de 2020
"I want the RGB values for each pixel in an image" <=== You have that. That's what those variables are. If you want them in a CSV file, see attached demo.
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!