|
about 2 or 3 images can be processed each second if you have files with Dimensions 2331 x 3240 how long to read them?
|
|
|
|
|
My file is 720x480, grayscale uncompressed image( .pgm), size is about 330kB each. So it does not take much time to read.
I turned off the process step, just read in and display the images, but the display still freezes after about 100 frames(the freezing happens after about 20-50 fames when the process step is there).
|
|
|
|
|
And after freeze what happen for your program it returns to normal state or no and one thing
did you trace your program line to line (I know Its hard) if yes what happen in this case its working or no
|
|
|
|
|
The calculation looks fine, since all the processed frames are written out as expected. After all the frames are done, the display is refreshed to show the last processed image.
So of all the steps for each frame: read in, process, display, write out, only display has problem: it freezes after some processed frames(maybe 20, maybe 50) are displayed.
|
|
|
|
|
And what happen for PF usage on TaskManager? it increase or no
|
|
|
|
|
The PF usage is normal when the display freeze, no difference compared to when the display is ok.
I am thinking of DC resource leak. I wrote another simple program that just read in and display the images one by one, the display freeze after some images are read.
|
|
|
|
|
If you have this problem in new program how to read images?
|
|
|
|
|
In the programs mentioned in my previous posts under this topic, I use a CBitmap member variable to contain the images read in or processed. And I use the OnPaint of the display dialog(a separate dialog window) to display it. Every time a new image was read in or processed, the CBitmap variable was updated and Invalidate() and Redrawindow() were called to refresh the display.
Today, I discarded Invalidate() and RedrawWindow(), instead I used CClientDC and DrawImage() directly to the display dialog, and it seems the problem has been solved. But I can not move the display window and it seems the thread was too busy to response.
This is a snippet of the code:
CClientDC dc(&m_dlgDisplay);
Graphics graphics(dc.m_hDC);
for(int i =0; i<700; i++)
{
strMiddle.Format(_T("%04d"), i);
fn=strPrefix+strMiddle+_T(".jpg");
if(m_image)
delete m_image;
m_image=Image::FromFile(fn);
graphics.DrawImage(m_image, 0, 0);
}
-- modified at 21:48 Saturday 21st October, 2006
|
|
|
|
|
Your code doesnt problem and thats right that you disable Sleep and also delete image if it was exist but about for wheres this loop is it possible for you to use of a thread or is it possible to use a timer instead use of for in timer you use of this code but with a difference you need to check if i=700 then killtimer and for this problem I think you have two problems first busy and second(I think)Mem usage of your program that if you move external windows on your program then if you see Mem usage of your program what happens? I research about this problem previous because I had been this problem and I know your problem you can also useof CImage class for read files and for darw their use of BitBlt that is a member of this class
I hope it helpfuls for you but if you have any problem you can aks.
|
|
|
|
|
I've got about 200 structures which have to be byte aligned for the communication with the target over the serial port.
Currently I'm using #pragma pack and memcpy because that was the easiest solution and works well on the x86.
But the downside is that this results in misalignment and is not portable.
Writing a reader and writer for each structure would result in a lot of code and I would like port it to an ARM microcontroller where resources are limited. I also would like to avoid to use C++ and stick with C for this.
The structures contain only 8 and 16-bit members, so each members size could be represented with 1-bit.
|
|
|
|
|
Andre Buenger wrote: But the downside is that this results in misalignment
Where, when?
Andre Buenger wrote: I would like port it to an ARM microcontroller
Byte alignment restrictions are processor dependent. Compilers pad based on the target processors restrictions. Byte alignment is not portable by definition. However reading/writing the same structure to/from the same processor should not be an issue.
led mike
|
|
|
|
|
For the following example the sizeof(TestStruct) == 4, because there is a padding byte between the first and second member.
struct TestStruct<br />
{<br />
char first;<br />
short second;<br />
};<br />
If you now use a #pragma pack (1) the structure size is reduced to 3, but the second member is misaligned.
That's not a problem with a x86 processor, but the ARM processor doesn't like that.
But I've to communicate with a 16-bit NEC controller who expects the received packets to be byte-aligned. Therefore I've just pack 'ed the about 200 structures so I can easily send and request them, but that is not portable.
If I now write 200 read and write functions that takes care of the alignment I end with 5000 unmaintainable error prone lines of code
|
|
|
|
|
Andre Buenger wrote: If you now use a #pragma pack (1) the structure size is reduced to 3, but the second member is misaligned.
How is it misaligned when you told it to align on single byte? 3 would be correct. If every compiler and processor understands single byte alignment then there is no padding and therefore no "misaligned" data, right?
led mike
|
|
|
|
|
|
Andre Buenger wrote: You should read this article.
Yeah, that's what I said in my first post. Alignment is not portable by definition.
Andre Buenger wrote: If I now write 200 read and write functions that takes care of the alignment I end with 5000 unmaintainable error prone lines of code
Yeah that does not sound fun. It seems parallel to "data transformation". Rather than write 200 functions you could use a mapping mechanism that would allow you to have a generalized routine to perform the serialization given an address and a "map". You would have a "map" instance for each structure defining the structure layout. The address of the structure instance and the associated map is used to perform serialization.
led mike
|
|
|
|
|
The most elegant solution would be to use a custom compiler, which is used to generate reader+writer functions for each of your structures.
i.e. you define your structures in a separate file:
/* core_types.h */
struct TestStruct
{
char first;
short second;
};
your project has a separate build-step which compiles core_types.h and results in:
void write_struct_TestStruct(struct TestStruct *tptr)
{
write(serial_device, tptr->first);
write(serial_device, tptr->second);
}
...and similar routines for all other types you define. Its sorta like an IDL compiler (i.e. MIDL.EXE for Windows) but designed to target your serial device instead of RPC. The idea is, all of the code to write structures is created automatically from your structure definitions so you don't have to write+maintain it by hand. Your structures stay as 'pure C' for portability.
Lots of tools are available to help you build compilers like this, google for 'lexx', 'antlr' etc. All you need is to parse a subset of 'C' - just C declarations. Maybe even the UNIX 'cdecl' program would be a good starting point.
James
|
|
|
|
|
I'm trying to better visualise my class in the Debugger. I noticed that in VS2005 a new/great feature was introduced to help visualise containers (STL and ATL) in debugger. By this it is easy/fast to display important data from complex classes.
Unfortunately, I can't visualise one stuff. I have a class B with a member variable A* m_ptr. If I edit the autoexp.dat file \ [AutoExpand] section "B=ptr=< m_ptr, t >" then the magic "t" make sure that if the m_ptr is an instance of class C which is derived from class A the debugger displays it as ptr=[C]. This is great so far.
However I would like to do similar thing in [Visualizer] section:
A{<br />
preview<br />
(<br />
#( $e.m_ptr )<br />
)<br />
)
Since there are no official documentation for the syntax I don't know how to put the magic "t" to the preview section so the debugger will display the real instnace of the member pointer. Currently it just displays the pointer address
Any idea how to do this? Or any documentation?
Many thanx,
Abyss
-- modified at 13:52 Friday 6th October, 2006
|
|
|
|
|
Hi all, thank in advance for your help.
I have a modeless dialog box in my form view and i'd like to color the border (the default color i black and thin), i'd like to have more thick and different color. Anyone know how to do this?
Thanks Teo
|
|
|
|
|
Did you search on codeproject I think I saw examples on codeproject?
|
|
|
|
|
Is it possible to uninstall SV2003 SP1? I'm getting an internal compiler error now on some of my projects causing the build to fail.
Todd Smith
|
|
|
|
|
Todd Smith wrote: Is it possible to uninstall SV2003 SP1?
Only if it's listed as a separate product in the Add/Remove Programs applet. Otherwise, you'll need to uninstall all of VS, which would include the SP, and then install VS from scratch.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I've looked and don't see a specific item in Add/Remove so I was checking here before I went through the horrible task of reinstalling VS2003. Maybe, hopefully, I missed it in add/remove.
Todd Smith
|
|
|
|
|
Hello everyone!
I have developed an SDI application with MFC, not supporting doc/view, then i made some modification to convert it to MDI, and everything works fine.
Now the weird:
My boss asked to make some trick so that someone could decide in RUNTIME to run the SDI or the MDI version. My first idea was to create 2 classes, CMainFrameSDI->CFrameWnd and CMainFrameMDI->CMDIFrameWnd and instantiate them into the global CApp, taking care to avoid the inizialisations not needed by the MDI and vice versa.
One other thing i did was creating a pure abstract class, CMainFrame, with only methods and only public functions, and deriving both CMainFrameSDI and CMainFrameMDI EVEN from it.
Inside the application the class used is then a pointer to CMainFrame and in case of specific functions it becomes its SDI or MDI version, depending on a flag present in all the three classes.
Everything explode suddenly....
I tried to build a sample with all this stuff but everything explode apparently without any cause into the LoadFrame. The only thing that i can notice is at a certain point unexpectedly the m_hWnd member of the SDI/MDI (depending on what started) become null...
I know i am doing bad things... but someone every did something like this just to take some advice on how to do such thing?
If u need i can provide my sample to give it a check
Best regards &cheers to everyone
A bleeding programmer with a big headache!!!
-Yes, i don't write a good english-
Unlukily it's not a Joke...
Hope you'll understand!!
|
|
|
|
|
It sounds like you have a "production" application. If so I suggest you start a new research project that you use to solve this "new requirement" in isolation from your working application. Once you have an understanding of the problem and the potential solution(s), you can attempt to modify the existing application to implement the solution.
led mike
|
|
|
|
|