|
Hi All,Please reply me If anyone is having any hint about the solution
Hoping for the solution
Thanks
Akash From India
Akash Agarwal
|
|
|
|
|
Please try and explain what you are trying to do. From your first post it seems that the label text is not changing, then you seem to want something different in the next one - following a perfectly good answer to your original question.
Clarity helps!
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hello,
I am writing a C# program which performs some basic computer vision on an AVI video.
The first step is to extract a Bitmap object from the AVI file for each frame - and this code works perfectly on its own.
In order to process each bitmap, I then go into unsafe mode, and use a pointer to cycle through the bitmap data. I then store the RGB values of each pixel into a Color[,] array, so that I can then read the RGB values at any location in the bitmap [x, y]. Here is that function that returns this array:
public static Color[,] GetRGBArray(Bitmap b)
{
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;
Color[,] array = new Color[b.Width, b.Height];
unsafe
{
byte* p = (byte*)(void*)Scan0;
int nOffset = stride - b.Width * 3;
int nWidth = b.Width * 3;
for (int y = 0; y < b.Height; ++y)
{
for (int x = 0; x < b.Width; ++x)
{
array[x, y] = Color.FromArgb(p[2], p[1], p[0]) ;
p = p + 3;
}
p += nOffset;
}
}
return array;
}
This function works perfectly well too, on its own at least.
Next, I add time as a dimension. I have another array, called data, which is an array of an array (jagged arrray). It is of type Color[i][x,y], where i is the frame number, and [x, y] are the coordinates on the bitmap. As the program grabs bitmaps from the AVI, I call the GetRGBArray() function for each bitmap, and the result is stored in the data array:
data[i] = GetRGBArray(b);
where i is the number of the current frame, and b is the bitmap object for the current frame, that I have grabbed from the AVI file.
From this, I can access the Color data for every pixel for every frame.
This all works fine functionally. Here is the problem. The AVI video has 1000 frames in it, however, after the program has been running for about 300 frames, it starts to slow down, and at about 400 frames, it just completely stops, and I don't know why.
There must be some trash of some sort that is piling up as I run the program, and once it gets to a certain point it starts slowing the program down. It doesn't matter where abouts in the video file I start from, after 300 frames it starts to be affected.
Any ideas? It is driving me mad!
Thank you for any help on this
Ed.
|
|
|
|
|
Why don't you watch what is happening to the memory while the frames are being created.
Watch the process in Task manager can give you an idea.
RM
Learn to write self marginalizing code!
Call 1-888-BAD-CODE
------------------
Silver member by constant and unflinching longevity.
|
|
|
|
|
Hi,
Thanks for the advice Richard.
Yes I think it probably is something to do with memory now you mention it.
But I don't know how I can monitor the memory usage in Task manager - how can I do this?
Thank you!
|
|
|
|
|
Bring up Task Manager,switch to the "Processes" tab.
Put the list in "Image Name" order, and watch the "Mem" column number.
Think about your problem: do you really need all 300 frames in memory at once,or would you be better off cycling through the last 20 or 50 frames.
What are you trying to accomplish that requires that history to be immediately available?
Learn to write self marginalizing code!
Call 1-888-BAD-CODE
------------------
Silver member by constant and unflinching longevity.
|
|
|
|
|
Hi every body.
I saw Normalize method in some classes. but I don't know what it is.
Can you describe it clearly ?
Thanks in advanced.
Sorry for my English. I'm a freshman .
|
|
|
|
|
|
Thanks. My mean was String Normalize .
Sorry for my English. I'm a freshman .
|
|
|
|
|
Well if your talking about Graphics, if something is normal to something it's at a 90 degree(perpendicular) angle to a reference slope.
It returns a new string whose textual value is the same as this string, but whose binary representation is in Unicode normalization form C.
http://msdn.microsoft.com/en-us/library/8eaxk1x2(VS.85).aspx
Cheers,
|
|
|
|
|
Hello everyone,
Are there any API to change the value of key directly in an Dictionary? Currently I am removing an old element, and then insert a new one.
thanks in advance,
George
|
|
|
|
|
That is the correct method. By definition the key values in a dictionary cannot change. Thus the two formal steps required.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Thanks Ennis Ray Lynch, Jr.,
Question answered.
regards,
George
|
|
|
|
|
Bit of a bitch sometimes, hey! Hey, I smell an extension method. I've only ever used one; I should get out more.
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Hi,
I have a C++ dll that actually does the console output (either cout or printf). I am just wondering, how to capture this output so I could display it on my text box in C#.
Thanks
|
|
|
|
|
Redirect standard input and standard output for the process. Being a Dll makes it more interesting because a dll shouldn't be outputting to standard streams.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Hi Ennis,
How to redirect the standard output? I have been trying to redirect the standard output using Console.SetOut() but it doesn't do much. I am just wondering, what is the standard output in C#? And how to get it?
Thanks
|
|
|
|
|
It is done from the Process class which is used to execute executables. Which is why I mentioned my comment about it being odd for a DLL to directly write to STD out.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Hi Ennis,
I did further testing. When I build my application as console C#, the DLL cout writes the output to the console window. But I can't capture it when I build my C# application as form application
|
|
|
|
|
In the Project properties, change the <b>Output Type:</b> to <b>Console Application</b> You'll get an additional console window in a Winform application. Ugly for sure but it works.
Jer 29:11
|
|
|
|
|
im using visual c# 2008 express along with xna development studio, and im trying to buld and deploy games to a 2nd generation zune. the zune connects properly, and the game builds fine, but when it attempts to deploy it immediately goes to the error message 'the path format is not supported' but ive seen lots of people do this with the same zune i have, any insight on this would be great
Listen.Love.Tell.Repeat
|
|
|
|
|
Hi everybody!
I've got a problem which I've been working on for a few hours now, I've been googling and reading, but I just can't get it right.
Well, let's talk about the main problem; I've got a textfile which contains only one line, like: Nicky:1200
What I want to do is to replace this line with a new one.
Here's what I've got atm:
FileStream file1 = new FileStream(@"1.txt", FileMode.Open, FileAccess.ReadWrite);
StreamWriter writer = new StreamWriter(file1);
writer.Write("Kim:1355");
writer.Close();
But what happens is that the program only appends to the file so when this code has been run the file looks like: Nicky:1200Kim:1355
I appreciate all help I can get on this one!
/Joplinazz
|
|
|
|
|
The easiest way is File.WriteAllText. However, there's file modes you can use to specify if you are appending or creating. I just suspect that FileStream does not offer them.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks a lot!
I used File.WriteAllText though, works fine. Now I'll just have to adjust my application for it.
/Joplinazz
|
|
|
|
|
Any there any free (or < $100) obfuscators that will obfuscate mixed mode assemblies?
Dotfuscator free edition will not. Skater Lite will not and I don't think that the Skater Pro version will either.
|
|
|
|