|
How do I use grayscale values to determine the color of pixels read from an image
tony-yeyo
|
|
|
|
|
I don't understand your question. When you read a pixel, you get a Color value, what do you want to do with that?
---
single minded; short sighted; long gone;
|
|
|
|
|
well I plan to draw a graph of the pixels against the grayscale so I wanted a way to group the pixels corresponding to the grayscale values. Like 0-255 is black-white respectively on the grayscale.
So how do I determine that this pixel is of a particular color according to the grayscale?
tony-yeyo
|
|
|
|
|
Just take the average of the red, green and blue color components.
---
single minded; short sighted; long gone;
|
|
|
|
|
Grayscale images contain 1/3 of the data in a color image. As such, you could write an algorithm that makes guesses as to the colors in a greyscale image, but you're never going to get back to the right colors, and it would be hard to even come close enough for the resultant image to look vaguely similar.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
What I am trying to do is create a new picturebox everytime you left click on the screen and delete the one you are on when you left click on one.
This is the code I have.
if (c == panel1)
{
if (e.Button == MouseButtons.Left)
{
//Get picturebox from unUsedBoxes to Create a new box
int position = unUsedBoxes.Count - 1;
if (position >= 0)
{
System.Windows.Forms.PictureBox p = (PictureBox)unUsedBoxes[position];
unUsedBoxes.RemoveAt(position);
usedBoxes.Add(p);
p.Location = new System.Drawing.Point(e.X, e.Y);
p.Size = new System.Drawing.Size(100, 50);
p.Show();
p.MouseDown += new MouseEventHandler(mouseDown);
p.MouseUp += new MouseEventHandler(mouseUp);
p.MouseMove += new MouseEventHandler(mouseMove);
}
else
{
MessageBox.Show("You have exceeded the maximum number of selections", "Selection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
else
{
if (e.Button == MouseButtons.Right)
{
//Delete box
usedBoxes.Remove(c);
unUsedBoxes.Add(c);
panel1.Dispose();
}
}
}
the code compiles but the picturebox is never created.
|
|
|
|
|
A control is most useful when you add it to some container...
|
|
|
|
|
I already have this code in the Designer
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(100, 50);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
And this code in the On Load
usedBoxes = new ArrayList();
unUsedBoxes = new ArrayList();
unUsedBoxes.Add(pictureBox1);
do I need to specify more than that a parent?
|
|
|
|
|
a control only "works" in a UI when added to the form's hierarchy of controls,
as in myForm.Controls.Add(myControl)
check this in the documentation, and in the code generated by Visual Studio's Designer !
|
|
|
|
|
i can't find the way to use thread with method have some param?
plz, help me out! thanks
|
|
|
|
|
Create struct or class to contain the parameters and use it.
only two letters away from being an asset
|
|
|
|
|
Hey all !
First of all let me start by saying I'm new to C# and programming what so ever..
I have a Excel sheet that I read lines from. Each line has 15 cells with numbers between 1-70 of random combinations.
My purpose is to hash every single line to a single result. The result is stored in an array.
I'm doing so by performing XOR between the cells' content (casting them to bytes).
This also gives me the luxery of not having to deal with the order of the numbers.
However, here's the problem. I'm getting the same XOR result for different types of numbers (how obvious).
For Example:
13^17^21^22^23^25^26^27^29^31^46^53^55^60^63 = 61
5^9^14^20^27^28^32^35^38^41^43^50^58^61^62 = 61
Is there any better solution for doing what I want ?
Be very appretiative if someone could help me out ...
Thanks !
|
|
|
|
|
|
Hi guys! How can i count size of structure?
|
|
|
|
|
count size of each field and sum
|
|
|
|
|
Yes but if it possible to count it by one command?
For ex sizeof( structure_Name )
|
|
|
|
|
Have a look at Marshal.SizeOf().
|
|
|
|
|
How do I compare the colors of the individual pixels contained in an image to the grayscale values in order to sort the pixels from 0-255.
I need help men
tony-yeyo
|
|
|
|
|
My image processing algorithms articles include the code to convert an image to greyscale. they are on Code Project, just search the articles for my surname - graus.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi
Please find which Cause the problem
Response.Redirect("PrintQuote.aspx?Print=" + grdVwAgentQuote.SelectedRow.Cells[7].Text+" & Quote="+TextBox1.Text);
dataPrinting = adapterprinting.GetData(int.Parse(Request.QueryString["Print"].ToString()), int.Parse(Request.QueryString["Quote"].ToString()));
When i just call one querystring. Its Working Fine. But if i call both the QueryString Then the Null Exception is showing on the Print. But if i pass only Print as queryString its working Fine.Please advice to solve the issue.
Regards,
A Jabeer Ali
|
|
|
|
|
When you try to read the value using the name "Quote", you will not find it as the name is " Quote".
Remove the extra spaces around &.
Also, you should use Server.UrlEncode to encode the values before you put them in the query string.
---
single minded; short sighted; long gone;
|
|
|
|
|
Can you send some Sample Code for Server.URLEncode. Because it gives error to me
Regards,
A Jabeer Ali
|
|
|
|
|
Example:
Response.Redirect("Page.aspx?something=" + Server.UrlEncode(someValue) + "&other=" + Server.UrlEncode(otherValue));
---
single minded; short sighted; long gone;
|
|
|
|
|
|
diddy34 wrote: I need help men
I'm wondering if a female read your question and knew the answer, but because of that exclusionary comment decided not to help you.
|
|
|
|