Argb value from rgb value - silverlight-3.0

I have rgb value 0, 69, 255. What would be it's argb value in silverlight. Is there any online converter that we can use.
Thanks in anticipation!

ARGB or RGBA works just like RGB except you need an extra value for alpha or transparency. Now, 0 alpha means fully transparent, while 255 alpha is totally opaque. So you probably want use the same RBG values with 255 for the alpha. You may also want to check out the documentation for Color.FromARGB.

Related

TBitmap.LoadFromFile for a PNG changes the RGB values - can I stop it?

I need to access a .png image file's RGBA data. I found that reading a .png image using Firemonkey's TBitmap.LoadFromFile changes the RGB values. They get premultiplied by the alpha value, thus losing the original RGB values whenever alpha is not 255.
In Windows I traced it to TBitmapCodecWIC.DecodeFrame in FMX.Canvas.D2D where it uses the GUID_WICPixelFormat32bppPBGRA pixel format, which according to WIC docs implies D2D1_ALPHA_MODE_PREMULTIPLIED.
Investigating further, I understand I can approximately recover the lost RGB values by doing an "UnPreMultiplyAlpha" which effectively divides the RGB values by the alpha value again. This works, visually, but as you can imagine is pretty lossy especially for pixels with low alpha and/or low RGB values.
Is there a way to tell TBitmap.LoadFromFile to retain the original RGBA values?

The Result Of Function "cvtColor" of OpenCV

I try to convert a RGB image to HSV color space, and get the HSV value of a pixel.
But the result is a little strange, as far as I know, the range of H is between 0 and 360, S and V is between 0 to 255, but the result that I have got is 0~255 for any of HSV value. I doubt that OpenCV have done the transform, is that right? Please help me.
If you're acquaint with the RGB-HSV conversion, OpenCV uses the following formulas to convert B,G,R values, (0~255) to H,S,V:
V=Max(B,G,R)
S=255*[1-min(B,G,R)/Max(B,G,R)]
let d=Max(B,G,R)-min(B,G,R)
H=30*[((G-B)/d)%6] if V=R
=30*[((B-R)/d)+2] if V=G
=30*[((R-G)/d)+4] if V=B

OpenCV Pixel with "no value"

Is it possible in OpenCV to have pixels with no colour? Like a transparent layer or in gimp if you delete all colours or elements on a layer.
Yes you can using BGRA system by making the alpha value equal to 0.
Example:
cv::Mat img(ROW, COLS, CV_8UC4, cv::Scalar(B_VALUE,G_VALUE,R_VALUE,0 /* This is the alpha*/));
Now all the this cv::Mat pixels are 100% transparent. You can change the alpha value to 255 so it is fully opaque or any value in the range [0,255] for a degree of transparent.

Know a pixel is transparent

I know how to get each pixel from a image and its RGBA value. My question is how to determine a pixel is transparent or not. Please help
Check if alpha part of rgba value is equal to 0, if it is that means the pixel is fully transparent. ANd if it's equal to 255 isn't transparent at all.

how to set hue value of some pixel with opencv

I need to change the hue of some pixels of my image, but i don't know how to set them!
I converted the image in HSV with CV_BGR2HSV and now i'm cycling with a for by rows and cols...
how can I access each pixel's hue?
for setting RGB i'm using this code...
CvScalar s;
s=cvGet2D(imgRGB,i,j); // get the (i,j) pixel value
printf("B=%f, G=%f, R=%f\n",s.val[0],s.val[1],s.val[2]);
s.val[0]=240;
s.val[1]=100;
s.val[2]=100;
cvSet2D(imgRGB,i,j,s); // set the (i,j) pixel value
You already converted your image to HSV, so the 3 layers of the image now correspond to Hue, Saturation and Value:
s.val[0] is the hue.
s.val[1] is the saturation.
s.val[2] is the value.
So go ahead and use exactly the same method as for your RGB images to get and set the pixel values.
Yes, openCV uses 180° i.e., (0°-179°) cylinder of HSV; while normally its (0°-240°) in MS paint and ideally (0°-360°). So, openCV gives you result of hue from (0°-179°).

Resources