I am a new programmer in C++ with the EDSDK 2.14. I am using a Canon EOS 5D Mark II and i have some questions to do (i'm starting the api, camera session, handlers, set capacity,my program take photos, set the correct parameters to the camera and i'm using windows message to treat some events) :
1) I need to save the photos in the host pc, i am doing this correct, but the camera only permits like 8 photos in the internal buffer and i need to test some combinations of parameters (AV,TV and ISO SPEED). I make a loop to take 10 photos when i press 's' (with windows message, callback), and only 8 photos was taken, the others have busy error, so i guess that is the internal buffer. How can i take more than 8 photos, changing the parameters correct with one windows event?
ps: I tried to reopensession (close and open session with camera again) but was not a good idea, because the event handle of transfer (download image) was only set with the release of the object.
2) I tried to get one photo and download, but was not possible, when i press 's', the program wait to take the 8 photos, and after that the camera send the event callback to the handle for download all images. I want to press 's', and the program take one photo, download and take the others, if it is possible, how could i do this?
3) If i make a method to set the AV, TV , ISO Speed parameters, this will be sent to the camera in time to take the photo, or i need to wait something like a callback of the camera. If i need something like that, what event i need to use?
ps: my program is all asynchronous, i am not using threads, only callbacks and windows event.
4) I search in internet about to put the correct focus, but some people said that is only possible in live view, and i can't use this in my application. It is possible to change focus without live view?
ps: Because i need a good photo and the autofocus of the camera with my program, is not doing the same quality of images like the EOS Utility, and i am thinking if they have a pos-processing in the image taken or not
If i have more questions or i resolved the questions i will answer to all the community, because this too many guys are using this API and it's not too trivial. Sorry about my english, i am not native in this language, but i am trying to do my best.
ad 1) you need to download the image before the camera's internal buffer overflow, like you try in 2
ad 2) make sure your program, after sending the first shot commands, somehow comes back in the 'global' event loop. This should give the EDSDK a chance to process camera events and send "download available" events to your callbacks. Take it from there
ad 3) no guarantees whether these events are applied, you'd rather attach to a property change event (kEdsPropertyEvent_PropertyChanged) or poll some time after
ad 4) you can use liveview and lens-based AF. For the latter, explore kEdsCameraCommand_ShutterButton_Halfway
Care to share the goal of your project?
Related
I have started to develop a simple MUD (text based multiplayer dungeon) where client uses only terminal to connect and play.
However i approached it the different way, i want the player to be able to move around the rooms (x,y) and see the map of a room like in the screenshot below
The whole screen as it is seen is being sent out by the server to the client on updates like:
somebody moved, something has changed in the current location, somebody dropped something, etc ...
At the bottom of the screen, there is a place where clients can put commands like:
look, east, west, pick up, drop, inventory, ...
Problem
The problem with the design however is, that when user is in the middle of putting a command and in meantime server has updated it's screen (somebody moved, or some event was generated ) he will loose the command he was typing because the whole screen got refreshed.
How do i send the screen to the player?
I build the view on the server side, and when sending to the client i use ANSI characters to:
Clear the screen (\u001b[H\u001b[2J)
Locate the cursor in specific areas of the window (\033[....) to draw specific areas of the view
Question
Is it possible, that clients don't loose their input when i send a view to them?
In other words, is it possible (maybe some ANSI code required?) that when i type something in the terminal and meantime if i receive something, my input is not broken by the newly received message?
To visualize the problem:
Good:
from server: aaa
from server: bbb
> input
Current:
from server: aaa
> in
from server: bbb
put
Alternative Solution
It's probably a better idea to construct the view on the Client side - then the server only needs to send the "raw information" and the client can display it. In this case, you've said the server sends a new view on events like someone moving - so just send a message to the client saying "Bob has moved", rather than an entirely new rendered screen, and let the client handle the update.
This has multiple advantages - to solve your problem, you can just buffer any server input until the user's finished typing, or redraw any bits of the screen that the client user's not actively changing.
It also allows for more customisation on the client side - if the server sends the view over, how does the client display it on a terminal that's a different resolution to the server's view? With client-side rendering, you can deal with this sort of issue on a per-client basis. You can also open up the door to massively more customisation by letting client users customise their personal views.
Workaround with your existing strategy
If you are fixed on having the server construct the views, then on the client you might be able to read single-character inputs at a time (on windows _getch, on linux ncurses provides this functionality), then if a server update occurs just render the new view and then re-render what the user's entered beforehand.
Another Suggestion
ANSI codes are... messy. Using a library like curses can make console-based-guis much nicer and more maintainable. On linux there's ncurses, and on windows there's an open-source variant called pdcurses (apparently has the same API, just exposed in an independent library. You'd need to change linker settings when compiling on Windows, but hopefully not any code). Thanks to Bartek for mentioning this.
Lets say we've got a Gaming MMO-mouse that has 12 keys at the side.
I researched a bit and found out that Windows doesnt really support so many keys so you'd have to use the mouse driver to access the keys. What I didnt find is, how do you access the keys with the driver?
All these mice have their respective software that lets you rebind them but whats interesting to me is how that looks like on a lower level without the software.
How do I poll for the pressed macro keys in my own c++ program?
How do we exchange information with the driver?
Suggest, write a small program that polls the USB port where the mouse is connected,
each time it receives data from the mouse, display that data.
Keep track of the correlation between which mouse action you made and the resulting input from the mouse.
I need to do some basic video processing from the Webcam in Windows Phone 8.1.
I cannot find any examples of how to access the webcam preview buffer. The Microsoft examples (very few) all have a video preview frame activate, I can find none that show how to subscribe to a 'new frame ready' event, or where the buffer is.
The MediaCapture, and CaptureDevice appear to be the main ways of reaching the camera in this api.
Can anyone point to a specific example? For instance, a QR code reader, or maybe a program that adds video effects, like greyscale, would need to attach an event to every frame.
Thanks.
It sounds like you need to access the buffer from the preview stream of the phone cameras. If you absolutely need to target 8 and 8.1, then you should look into GetPreviewBufferArgb(out int[] pixels). See here: https://msdn.microsoft.com/en-us/library/windows.phone.media.capture.cameracaptureframe.getpreviewbufferargb.aspx
But if you can instead target Windows 10, you get the benefit of fully universal APIs, and you don't take a dependency on the likely soon to be deprecated (if not already) Windows.Phone.Media.Capture namespace. I would strongly recommend doing this instead, as the APIs will be easier to work with, and any 8.1 device can upgrade to 10 for free.
Here is a fully working Windows 10 sample: http://aka.ms/2015buildgetpreviewframesample, which was shown off at the last Build conference (video here: http://channel9.msdn.com/Events/Build/2015/2-730).
i have my application skeleton working as expected - it might be that somebody has a good solution to what i am trying to achieve within Windows Mobile 6.5 enviroment.
Here's what i am actually trying to do:
Application running in background ( it sends periodically network packets to office server, packets are loaded with statistics data and pushed onto the server via Winsock2 and custom made protocol ).
What 'background' means here - is an application that creates a window of 0,0 size and is minimized - i am thinking about going into the services with this, but the next thing that i require stops me today from doing this.
I need this application to be 'visible' somewhere as an icon - i already know i can't do this in the 'tray' area as stated in this post:
Windows Mobile C++ Tray Icon
Now i was trying to utilize the: SHNotificationAdd - but this is ok for a 'notification' as the name says type of thing. So it popsup and you can click to hide it - this is bad.
What i need to achieve is an icon that is visible during the application run cycle, so it flashes when there is no synchronization possible, it changes the icon when synchronization is done.
I am a bit worried it can't be done - i even tried to go and code the "Home" plug-in for this purpose, but was told that some people have themes installed and it might be that my application won't be even visible to those guys.
Now as we're going to deploy it to few places around ( 3 data centers spread across the country - around 130 people smart phones only ) - i need to be sure this application is visible even when there is a theme applied or customization done.
Any chance this can be done ?
I was kinda sure it can be done with a classic 'tray icon approach' until i found that 'tray icons' are not supported for normal applications.
If there is something i can do - i would really appreciate if somebody could shed a bit of light on this for us all please.
You'll have to move to a Windows Mobile paradigm for your app, as what you're trying to do isn't possible (as you're finding). A home screen plug in has problems if the user customizes it, and you are correct that there is no "tray". The icons in the corner (battery, signal strength, etc) are reserved for OEM use only.
My recommendation would be to actually create a visible Form for your application. Maybe it shows just some simple status info like last upload time, amount of data transferred, etc.
You then use the notifications to place a user notification during "events" such as the inability to connect (replacing your "flashing icon" idea) or when synchronization is complete (replacing your "changed icon" idea).
I have to get images from scanner with TWAIN 1.x interface
Some old scanners scan too long time so I guess how to notify user about scanning progress.
There is built-in popup window with progress bar and "cancel" button but it's something I want to override.
Instead of TWAIN WIA API sends me pieces of scan with progress percent so I can solve this task with WIA, but what about TWAIN ?
I tried this nice TWAIN demo http://www.codeproject.com/KB/audio-video/twaintest.aspx.
It uses message loop for scanning. I guess that scan progress should be represented as set of messages sent to message loop but I was wrong. There are only some initial and finalization messages.
Is there a way to be notified about scan progress with TWAIN 1.x API?
Thank you in advance!
For future reference...
There is no way to get scan progress through the TWAIN API, and no standard way to get it by 'cheating' either. TWAIN does give you a way to ask the TWAIN driver to display (or not) a progress dialog, as mentioned by the OP, but the dialog box is designed and operated by the individual TWAIN driver.
If you don't like a given driver's progress box, you have few choices:
Hack the driver's progress box at run-time (low-level Win32 programming, hook procedures, etc.)
Use TWAIN's Memory Transfer Mode (see the TWAIN Spec) - which delivers each image as a sequence of buffers. You can display progress by comparing the total pixels or rows transferred versus the expected total. However, be aware that either the scanner or the driver may scan, post-process the image, and only then transfer the data, putting your progress display pretty seriously out-of-sync.
My advice is to spend your effort on some other aspect of the system, where you have control.
You can get image scan progress if you acquire image from scanner using Memory transfer mode. Native and File transfer modes do not allow to get image scan progress. Progress step depends from TWAIN driver.