Click here to Skip to main content
15,890,512 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Array handling Pin
sarabjs26-May-05 11:32
sarabjs26-May-05 11:32 
GeneralRe: Array handling Pin
Scott Page27-May-05 4:06
professionalScott Page27-May-05 4:06 
GeneralRe: Array handling Pin
DavidNohejl26-May-05 12:02
DavidNohejl26-May-05 12:02 
GeneralRe: Array handling Pin
sarabjs27-May-05 8:44
sarabjs27-May-05 8:44 
GeneralRe: Array handling Pin
DavidNohejl28-May-05 6:32
DavidNohejl28-May-05 6:32 
GeneralRe: Array handling Pin
sarabjs30-May-05 7:54
sarabjs30-May-05 7:54 
GeneralRe: Array handling Pin
Robert Rohde27-May-05 5:41
Robert Rohde27-May-05 5:41 
GeneralRe: Array handling Pin
sarabjs27-May-05 9:26
sarabjs27-May-05 9:26 
I've tried my best to make my algorithm as optimal as I can...

1.
Here's what I'm trying to do - the two dimensional matrix I had mentioned is a pixel map of an image. I need to process the image, updating the value of each pixel depending upon the characteristics of a 10x10 pixel window with the pixel I wish to update at its center.. A typical loop for example goes like:

/*
iht - height of array
iwd - width of array
iPix - two dimensional array
n1, n2, n3 - integers
iWindowSize - size of processing window
*/

for (int y=0;y<iht;y++) {
for (int x=0;x<iwd;x++) {
// get margins of the processing window
xl=(x<iWindowSize)?0:x-iWindowSize;
xr=(x>iwd-iWindowSize-1)?iwd:x+iWindowSize+1;
yt=(y<iWindowSize)?0:y-iFilterSize;
yb=(y>iht-iWindowSize-1)?iht:y+iWindowSize+1;

// get mean value
n1=0; n2=0;
for (int i=yt;i<yb;i++)
{
for (int j=xl;j<xr;j++)
{
n1+=iPix[i,j];
n2++;
}
}
n3=n1/n2; // n3 is the mean

// get variance
n1=0;
for (int i=yt;i<yb;i++) {
for (int j=xl;j<xr;j++) {
n1+=((n3-iPix[i,j])*(n3-iPix[i,j]));
}
}
n2=n1/n2; // n2 is the variance

// update pixel
if (n2<(n3*n3)/4) iPix[y,x] = n3;
// this is an example of the kind of processing I am using
}
}

2.
Haven't tried in release mode sofar.. Guess I'll try that option...

3. Can't change the processor!
GeneralRe: Array handling Pin
sarabjs27-May-05 9:48
sarabjs27-May-05 9:48 
GeneralRe: Array handling Pin
Robert Rohde28-May-05 0:40
Robert Rohde28-May-05 0:40 
GeneralRe: Array handling Pin
sarabjs30-May-05 7:44
sarabjs30-May-05 7:44 
GeneralRe: Array handling Pin
Robert Rohde30-May-05 8:31
Robert Rohde30-May-05 8:31 
GeneralRe: Array handling Pin
sarabjs30-May-05 10:18
sarabjs30-May-05 10:18 
GeneralRe: Array handling Pin
Robert Rohde30-May-05 18:53
Robert Rohde30-May-05 18:53 
GeneralRe: Array handling Pin
sarabjs31-May-05 5:12
sarabjs31-May-05 5:12 
GeneralRe: Array handling Pin
Robert Rohde31-May-05 8:07
Robert Rohde31-May-05 8:07 
GeneralRe: Array handling Pin
sarabjs31-May-05 9:55
sarabjs31-May-05 9:55 
GeneralRe: Array handling Pin
DavidNohejl28-May-05 6:21
DavidNohejl28-May-05 6:21 
GeneralRe: Array handling Pin
Robert Rohde28-May-05 6:37
Robert Rohde28-May-05 6:37 
GeneralRe: Array handling Pin
DavidNohejl28-May-05 6:57
DavidNohejl28-May-05 6:57 
GeneralRe: Array handling Pin
Robert Rohde28-May-05 9:46
Robert Rohde28-May-05 9:46 
GeneralRe: Array handling Pin
DavidNohejl28-May-05 9:51
DavidNohejl28-May-05 9:51 
GeneralRe: Array handling Pin
sarabjs30-May-05 7:57
sarabjs30-May-05 7:57 
GeneralWhen to use sockets and when to use remoting Pin
G.Ringbom25-May-05 0:58
G.Ringbom25-May-05 0:58 
GeneralRe: When to use sockets and when to use remoting Pin
Nish Nishant25-May-05 1:31
sitebuilderNish Nishant25-May-05 1:31 

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.