PDA

View Full Version : ImagingControl Threads Priority settings



odissey1
November 10, 2006, 01:28:32
Hi,

My application does both imaging (1 frame per second) and data collection and is CPU load-critical. To save data I use command:

ImagingControl.SaveAsJpeg(Filename, quality);

with if quality >= 20 it hangs-up after approximately of 10 sec of operation. No problem with saving as plain Bitmap. I feel that CPU consumption is significant for JPEG compression and this causes conflicts with data acquisition.

I know that ImagingControl (AX) is multithreaded so I wander if it is possible to change (lower) priority for the thread which does JPEG compression?

Sincerely,
Boris

Sascha Schmidt
November 10, 2006, 14:04:35
Hi Boris,

To snap an image as jpeg, you should write:



Dim CurrentBuffer As Integer
ICImagingControl1.MemorySnapImage
CurrentBuffer = ICImagingControl1.ImageBuffers.CurrentIndex
ICImagingControl1.ImageBuffers.Item(CurrentBuffer) .SaveAsJpeg "image.jpg", 70


I tested it and it works fine, without problems on each compress-quality.

odissey1
November 12, 2006, 21:54:57
Hi Sascha,
Thank you for reply. I still want to give more CPU yield for data acquisition, rather than for JPEG compression. I would prefer if compression proceeds at a lower priority thread. Is there any way to reduce AX priority setting?

Regards,
Boris

Stefan Geissler
November 13, 2006, 09:36:03
Hello Boris,

If the jpeg compression on you computer needs so much CPU load and execution time, then there is something wrong with your computer. The JPEG compression runs usually very fast at any quality.

To answer your question: Your application calls the snapimage and then the save to jpeg. This means that these functionallity runs in your main thread. In general Visual Basic 6 is not multithreading capable. This means all things you do in your application run in the thread of the your application. If you call LiveStart, then IC Imaging Control starts an own thread for the video capture. But if you call MemorySnapImage and SaveImage etc, then this runs the thread of your application. Thus there is no way to change the thread priority.