Click here to Skip to main content
15,908,931 members
Home / Discussions / C#
   

C#

 
GeneralRe: help is need Pin
Luc Pattyn24-Sep-09 17:00
sitebuilderLuc Pattyn24-Sep-09 17:00 
GeneralRe: help is need Pin
PIEBALDconsult24-Sep-09 18:14
mvePIEBALDconsult24-Sep-09 18:14 
GeneralRe: help is need Pin
PIEBALDconsult24-Sep-09 12:59
mvePIEBALDconsult24-Sep-09 12:59 
GeneralRe: help is need Pin
Luc Pattyn24-Sep-09 14:03
sitebuilderLuc Pattyn24-Sep-09 14:03 
GeneralRe: help is need Pin
PIEBALDconsult24-Sep-09 14:23
mvePIEBALDconsult24-Sep-09 14:23 
GeneralRe: help is need Pin
Luc Pattyn24-Sep-09 14:26
sitebuilderLuc Pattyn24-Sep-09 14:26 
AnswerRe: help is need Pin
PIEBALDconsult24-Sep-09 20:19
mvePIEBALDconsult24-Sep-09 20:19 
QuestionDISPLAYING 16 BIT IMAGES Pin
Rosana200924-Sep-09 9:57
Rosana200924-Sep-09 9:57 
Hi i'm using C# in visual estudio 2005, i need to open 16 bits png images, not raw images. i have a code in which one i can open a 8 bit image and i can get a pixel from that image. the code works, but what i need is to open a 16 bit images. i need your help. thankyou. some of the code i have is the next:

-------------------------------------------------------------------------------------------------------------------------
private void pictureBox_Click(object sender, System.EventArgs e)
{
int[] pos = new int[2];
pos = m_Coord.GetXY();

if (this.pictureBox.Image != null)
if ((pos[0]<this.pictureBox.Image.Width) && (pos[1]<this.pictureBox.Image.Height))
{
m_Coord.AgregarPunto(pos);
// para obtener color
Bitmap b = (Bitmap)this.pictureBox.Image;
int[] color = new int[3] ;
unsafe
{
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;
byte * p = (byte *)(void *)Scan0;
p += pos[1]*stride + pos[0]*3;

color[0] = (int)p[2];
color[1] = (int)p[1];
color[2] = (int)p[0];
b.UnlockBits(bmData);
}

FormPadre f = (FormPadre)this.ParentForm;
f.statusBar.Panels[1].Text = "Click=(" + System.Convert.ToString(pos[0]) + "," + System.Convert.ToString(pos[1]) + ")";
f.statusBar.Panels[2].Text = "RGB =" + System.Convert.ToString(color[0])+ "," +System.Convert.ToString(color[1])+ "," + System.Convert.ToString(color[2]);
g = this.pictureBox.CreateGraphics();
g.DrawEllipse(pen, pos[0] - 3, pos[1] - 3, 6, 6);
}
else
{
MessageBox.Show("El punto está fuera de los límites de la imagen", "Important", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}

----------------------------------------------------------------------------------------------------------------------------------------


above, there are some functions that i have in other clases. what i need is to open 16 bit png images.


i have tried doing the next: but the intensity pixel values are not corrects


---------------------------------------------------------------------------------------------------------------------------------------

private void pictureBox_Click(object sender, System.EventArgs e)
{
int[] pos = new int[2];
pos = m_Coord.GetXY();

if (this.pictureBox.Image != null)
if ((pos[0]<this.pictureBox.Image.Width) && (pos[1]<this.pictureBox.Image.Height))
{
m_Coord.AgregarPunto(pos);
// para obtener color
Bitmap b = (Bitmap)this.pictureBox.Image;
int[] color = new int[3];
unsafe
{
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, b.PixelFormat);

int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;
byte* p = (byte*)(void*)Scan0;
p += pos[1]*stride + pos[0]*6;

color[0] =(int)p[2];
color[1] =(int)p[1];
color[2] =(int)p[0];




b.UnlockBits(bmData);
}

FormPadre f = (FormPadre)this.ParentForm;
f.statusBar.Panels[1].Text = "Click=(" + System.Convert.ToString(pos[0]) + "," + System.Convert.ToString(pos[1]) + ")";
f.statusBar.Panels[2].Text = "RGB =" + System.Convert.ToString(color[0])+ "," +System.Convert.ToString(color[1])+ "," + System.Convert.ToString(color[2]);
g = this.pictureBox.CreateGraphics();
g.DrawEllipse(pen, pos[0] - 3, pos[1] - 3, 6, 6);
}
else
{
MessageBox.Show("El punto está fuera de los límites de la imagen", "Important", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}

------------------------------------------------------------------------------------------------------------------------------------
please help me
AnswerRe: DISPLAYING 16 BIT IMAGES Pin
Christian Graus24-Sep-09 13:37
protectorChristian Graus24-Sep-09 13:37 
GeneralRe: DISPLAYING 16 BIT IMAGES Pin
Rosana200924-Sep-09 17:45
Rosana200924-Sep-09 17:45 
QuestionHow to create a WCF web service from existing WSDL Pin
Niiiissssshhhhhuuuuu24-Sep-09 9:41
Niiiissssshhhhhuuuuu24-Sep-09 9:41 
QuestionAdmin Rights Pin
Dunk310124-Sep-09 9:34
Dunk310124-Sep-09 9:34 
AnswerRe: Admin Rights Pin
Ennis Ray Lynch, Jr.24-Sep-09 12:56
Ennis Ray Lynch, Jr.24-Sep-09 12:56 
GeneralRe: Admin Rights Pin
Dunk310124-Sep-09 13:15
Dunk310124-Sep-09 13:15 
GeneralRe: Admin Rights Pin
Dave Kreskowiak24-Sep-09 13:28
mveDave Kreskowiak24-Sep-09 13:28 
GeneralRe: Admin Rights Pin
Ennis Ray Lynch, Jr.24-Sep-09 13:40
Ennis Ray Lynch, Jr.24-Sep-09 13:40 
QuestionDisplayIndex like System.Componentmodel.DisplayName? Pin
Member 621528424-Sep-09 9:01
Member 621528424-Sep-09 9:01 
AnswerRe: DisplayIndex like System.Componentmodel.DisplayName? Pin
Henry Minute24-Sep-09 12:05
Henry Minute24-Sep-09 12:05 
GeneralRe: DisplayIndex like System.Componentmodel.DisplayName? Pin
Member 621528424-Sep-09 23:43
Member 621528424-Sep-09 23:43 
GeneralRe: DisplayIndex like System.Componentmodel.DisplayName? Pin
Henry Minute25-Sep-09 3:05
Henry Minute25-Sep-09 3:05 
GeneralRe: DisplayIndex like System.Componentmodel.DisplayName? Pin
Member 621528430-Sep-09 2:47
Member 621528430-Sep-09 2:47 
Questiondelete Pin
nhqlbaislwfiikqraqnm24-Sep-09 8:28
nhqlbaislwfiikqraqnm24-Sep-09 8:28 
AnswerRe: All in one exe? Pin
Manas Bhardwaj24-Sep-09 8:36
professionalManas Bhardwaj24-Sep-09 8:36 
GeneralRe: All in one exe? Pin
nhqlbaislwfiikqraqnm24-Sep-09 8:57
nhqlbaislwfiikqraqnm24-Sep-09 8:57 
GeneralRe: All in one exe? Pin
DaveyM6924-Sep-09 9:18
professionalDaveyM6924-Sep-09 9:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.