View Full Version : Viewfinder mode questions
mattmattbobatt
30th of April 2003 (Wed), 11:55
I'm investigating cameras to use in a kiosk application. I'd like to be able to get a live feed from the camera in low res format to display on a monitor. When the user has everything set then I want to switch modes and take a real, high res image and send it to the computer for processing. We are looking to develope applications for Windows and/or MacOS X.
It looks like the EOS-1d is a good choice for this application. I haven't had any luck finding a contact person at Canon to get an answer to my questions so I'm hoping one of you might know.
From the SDK documentation I see that I can set the camera (actually a lot of Canon cameras) to Viewfinder mode and have it constantly send the viewfinder image to the computer. My three-part question is: 1) what is the size of the image 2) what is the format of the image 3) how fast can it send these images to the computer ?
If anyone has a contact at Canon software support I'd appreciate that.
SDK_Monkey
9th of May 2003 (Fri), 14:05
The size of the image is 320 X 240. It is a bit map image and you get get it every .001 second. Hope it helps.
BTW Have you been working with the SDK? I need to now how to rotate the image that comes back. I need to know if it is some setting in the camera that will do it for me or if I have to do it manually. If you don't know no big deal.
Cheers
mattmattbobatt
9th of May 2003 (Fri), 14:51
No, I haven't worked with the SDK. We are still analyzing the available cameras & SDKs. This is very encouraging information although the cost of the camera could be a deal breaker.
As for rotating the image I thought I saw a call to set the orientation of the images. Rotating it manually isn't hard to do but it does eat CPU cycles. If you plan support other cameras you might want to do it manually anyway.
Matt
SDK_Monkey
9th of May 2003 (Fri), 17:20
All attempts to do it manually result in tons of cpu cycles and a VERY jerky result. It takes to long to do the x,y translation.
Oh well,
Thx
mattmattbobatt
12th of May 2003 (Mon), 09:39
sdk_monkey wrote:
All attempts to do it manually result in tons of cpu cycles and a VERY jerky result. It takes to long to do the x,y translation.
Oh well,
Thx
Since I don't know how you're doing the rotation I'll offer some unsolicited advice and hope I don's insult anyone's intellegence and look like a doof. I also have to preface by admitting that I haven't used the Canon SDK so all advice is based on other platforms & SDKs.
When I'm going for all out speed (well, I always go for all out speed in imaging) I get a raw image into a locked buffer, process it into another buffer and then stuff it into an image buffer just before displaying. You don't want to have to access one pixel at a time. I once fixed a good algorithm for a photoshop filter that picked at each pixel in an offscreen buffer one at a time by getting a pointer to a row at a time and then working on each pixel. The resulting image was the same but the time to do it went from two minutes to 4 seconds on a huge image just because it took a lot of time to calculate the offeset to the pixel and lock it and then unlock it. (results on MacOS were very dramatic while Windows was only a few times faster)
You want to take advanage of what the CPU and memory subsystem can do for you. Never copy pixels one at a time; use memcpy for a row or a whole buffer. Most memcpy instructions lock the memory bus and do a direct copy much, much faster than the CPU can. For rotating the image use AltiVec (MacOS) or MMX (Windows) extensions to rotate with a matrix multiply. You should get at least a 4X speed boost. Some operations are 8X faster than simple looping.
If you are rotating by swapping each red, each blue and each green component you more than triple the time to do the rotation. Modern CPUs are optimized to do 32 bit integer math and memory access. You can cast each pixel as a long to copy the read, green, blue and spare unsigned bytes all at one time -- don't forget to divide the row width by 4. Do this with vector ops and you should pick up a 12X-24X boost in speed.
Hope this helps.
vBulletin® v3.6.12, Copyright ©2000-2012, Jelsoft Enterprises Ltd.