PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework Image Processing PPC

Reply

Image Processing PPC

 
Thread Tools Rate Thread
Old 08-09-2006, 06:11 PM   #1
=?Utf-8?B?ZGlnaXdpemFyZA==?=
Guest
 
Posts: n/a
Default Image Processing PPC


I have an C# PPC app and am experiencing extream lag time when manipulating
pixel values in an Image object. Is there a way to make the GetPixel /
SetPixel operation faster ?

my image is 144x256 pixel and takes about 3 minutes to simply invert the
colors using the following code:

**********************************************************
if (chkInvert.Checked)
{
Color tmpclr, newClr;
int r, g, b;
Bitmap img2Invert = new Bitmap(pictureBox1.Image);

//loop through the image and invert each pixel
for (int iy = 0; iy < img2Invert.Height; iy++)
for (int ix = 0; ix < img2Invert.Width; ix++)
{
tmpclr = img2Invert.GetPixel(ix, iy);
r = 255 - tmpclr.R;
g = 255 - tmpclr.G;
b = 255 - tmpclr.B;
newClr = Color.FromArgb(r, g, b);
img2Invert.SetPixel(ix, iy, newClr);

}

pictureBox1.Image = img2Invert;
}

************************************************************

Help with this would be much appreciated.





  Reply With Quote
Old 08-09-2006, 07:14 PM   #2
Ilya Tumanov [MS]
Guest
 
Posts: n/a
Default Re: Image Processing PPC

No, there's no way to make Get/SetPixel faster. Please use LockBits and
access bitmap data directly instead (NETCF V2 only).


--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group...framework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

"digiwizard" <digiwizard@discussions.microsoft.com> wrote in message
news:028334F0-0D62-4EB1-8FAB-A2208A408387@microsoft.com...
>I have an C# PPC app and am experiencing extream lag time when
>manipulating
> pixel values in an Image object. Is there a way to make the GetPixel /
> SetPixel operation faster ?
>
> my image is 144x256 pixel and takes about 3 minutes to simply invert the
> colors using the following code:
>
> **********************************************************
> if (chkInvert.Checked)
> {
> Color tmpclr, newClr;
> int r, g, b;
> Bitmap img2Invert = new Bitmap(pictureBox1.Image);
>
> //loop through the image and invert each pixel
> for (int iy = 0; iy < img2Invert.Height; iy++)
> for (int ix = 0; ix < img2Invert.Width; ix++)
> {
> tmpclr = img2Invert.GetPixel(ix, iy);
> r = 255 - tmpclr.R;
> g = 255 - tmpclr.G;
> b = 255 - tmpclr.B;
> newClr = Color.FromArgb(r, g, b);
> img2Invert.SetPixel(ix, iy, newClr);
>
> }
>
> pictureBox1.Image = img2Invert;
> }
>
> ************************************************************
>
> Help with this would be much appreciated.
>
>
>
>
>



  Reply With Quote
Old 09-09-2006, 04:01 AM   #3
=?Utf-8?B?ZGlnaXdpemFyZA==?=
Guest
 
Posts: n/a
Default Re: Image Processing PPC

Thanks! I appriciate the help...^_^

If you could provide an example of LockBits it would be great -- meanwhile
I'll query msdn for it. :]

~Digiwizard~

"Ilya Tumanov [MS]" wrote:

> No, there's no way to make Get/SetPixel faster. Please use LockBits and
> access bitmap data directly instead (NETCF V2 only).
>
>
> --
> Best regards,
>
> Ilya
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> *** Want to find answers instantly? Here's how... ***
>
> 1. Go to
> http://groups-beta.google.com/group...framework?hl=en
> 2. Type your question in the text box near "Search this group" button.
> 3. Hit "Search this group" button.
> 4. Read answer(s).
>
> "digiwizard" <digiwizard@discussions.microsoft.com> wrote in message
> news:028334F0-0D62-4EB1-8FAB-A2208A408387@microsoft.com...
> >I have an C# PPC app and am experiencing extream lag time when
> >manipulating
> > pixel values in an Image object. Is there a way to make the GetPixel /
> > SetPixel operation faster ?
> >
> > my image is 144x256 pixel and takes about 3 minutes to simply invert the
> > colors using the following code:
> >
> > **********************************************************
> > if (chkInvert.Checked)
> > {
> > Color tmpclr, newClr;
> > int r, g, b;
> > Bitmap img2Invert = new Bitmap(pictureBox1.Image);
> >
> > //loop through the image and invert each pixel
> > for (int iy = 0; iy < img2Invert.Height; iy++)
> > for (int ix = 0; ix < img2Invert.Width; ix++)
> > {
> > tmpclr = img2Invert.GetPixel(ix, iy);
> > r = 255 - tmpclr.R;
> > g = 255 - tmpclr.G;
> > b = 255 - tmpclr.B;
> > newClr = Color.FromArgb(r, g, b);
> > img2Invert.SetPixel(ix, iy, newClr);
> >
> > }
> >
> > pictureBox1.Image = img2Invert;
> > }
> >
> > ************************************************************
> >
> > Help with this would be much appreciated.
> >
> >
> >
> >
> >

>
>
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off