EdsCreateImageRef fails when using MemoryStream - canon-sdk

I want to capture RAW images from a Canon Camera (EOS 550D and EOS 1300D) and convert them to RGB without saving them on disk. I was assuming that this should be possible, given the fact that EdsCreateImageRef accepts a StreamRef, which can be either a FileStream or a MemoryStream. However, whenever I use a MemoryStream instead of a FileStream, EdsGetImageRef will return EDS_ERR_FILE_FORMAT_UNRECOGNIZED. I tried several variants:
downloading into a MemoryStream and calling EdsGetImageRef directly on this
same as above with a seek to the begin of the stream in between
downloading into a MemoryStream, extracting data into my own databuffer and
filling a new MemoryStream with this data
Loading data from disk (from a known-valid CR2 file) manually and filling a MemoryStream with it
The only thing that works is to dump the data to disk, then open this file with EdsCreateFileStream and passing this to EdsGetImageRef. Has anyone ever been able to create a ImageRef for a MemoryStream and if so, can you give pointers as to what needs to be done for this to succeed?

I guess it's the same issue as Canon Digital SDK (EDSDK) EdsCreateImageRef error
I just started using EDSDK v 3.8.0. I had the same issue, but I was able to find out what caused it for me: Version 1.x searches for the dlls in the working path, while 2.x and 3.x search at the location of the exe using the dlls. So copying the files in the debug and release directories of my Visual Studio project fixed it for.

I had same issue.
EDSDK.EdsCreateImageRef returns EDS_ERR_FILE_FORMAT_UNRECOGNIZED
I found a solution.
In my project EDSDK.dll placed in filder EDSDK\Dll. And DllImport looks like [DllImport("EDSDK\Dll\EDSDK.dll")]
It works with JPEG files, but not with CR2.
Then I place all dll from EDSDK\Dll to root project folder and change DllImport.
It works for me.
And after than I have found extremely useful text in EDSDK manual
1.4.3 Executing the EDSDK Client Application
Windows:
All DLLs are required in order to execute an EDSDK client application.
All of the modules in the DLL folder must be copied into the same folder where the EDSDK client application is in.
Need it helps

Related

custom file open with custom application only

I am working on vb.net application where I wanted to create and read a file. File will have specific extension for ex. .abcb the way I want my application to work is:
can create a file with .abcd extension
should read .abcd files only(and also application created files only so altered extension shouldn't be working)
.abcd files should show some garbage data when open in any other application(ex. word, notepad any image viewer etc.)
Now my application does 1,2(partly) step, i.e. it creates a file and load data also, it reads .abcd files only(not the altered files)
but created file can be read by other software's also.I tried searching a lot but have not found anything and don't know where to start.
Any help is appreciated!
if you don't want other programs to be able to read the content of your file then your going to have to mask it in some way, which is usually done with encryption.
assuming your not too worried about the key being compromised, the easiest way to accomplish this would be to generate a key with something like System.Security.Cryptography and use that key to encyrpt everything you send to the file and everything you read from it.
as for making your own file extension, you can make the extension of a file whatever you want when you make it:
Dim fs As FileStream = File.Create("/path/to/file/filename" & ".abcd")
the only thing that the extension does is tell the OS what progam to use when opening a file by default, which will probably be notepad since your making your own extension

How do I unzip a file from memory (not a disk file) in Meteor?

The sequence of events that I'm trying to make happen in Meteor is:
On the client browser, upload a zip file and send it to the server
On the server, receive the zip file and hold it in a memory object
Unzip the memory object into individual objects representing the contents
Process the individual files one at a time
Return success/failure status to the client
I have steps 1 and 2 working, using EJSON to stringify the contents of the zip file on the client and again to convert it back to its original form on the server. The problem I'm encountering is when I try to unzip the object on the server. It seems that every unzip library available wants to operate directly on a file or stream, not on a memory object.
I suppose I could write the object to disk and read it back again, but that seems like an unnecessary step. Is there a library available to unzip a memory object? Alternatively, is there a way to create a stream directly from the object that I can then feed to the unzip routine?
Any advice would be greatly appreciated.
You could use the unzip module from npm. It accepts streaming input and allows you to process output without saving to disk.
It will take some work to wrap it to work with meteor. Your two options are the meteorhacks:npm package or upgrading to the Meteor 1.3 beta.

How do I release an external drive after it's been accessed by my program?

The VB.Net program in question creates several files, adds them into a zip file (using DotNetZip), and saves the zip file into a given directory (which the user chooses). This comes out just fine. But when I use it to save directly to my USB flash drive, I can't eject the drive without shutting down the program first.
I've tried disposing the zip object (from the DotNetZip library), doesn't work. I also tried setting FileIO.FileSystem.CurrentDirectory to somewhere else on the machine, still no.
In your last comment you've said that calling the 'Close' outside of the Try Catch sorted your problem, I'd recomend using a "Using" stament insted. This will close/dispose of your StreamWriter 100% of the time no matter what happens.
http://msdn.microsoft.com/en-us/library/htd05whh.aspx

Write files to S3 through Java

I have a program which takes input from S3, generates a text file, and then sends it to the mapper class. I am unable to write the file to S3, from where the mapper can read it later. Now, I realize that we cannot write files to S3 directly, so I am trying to upload the text file created to S3 using copyFromLocalFile(). However, I get a null pointer exception in the following line:
fs.copyFromLocalFile(true, new Path(tgiPath), mapIP);
I am creating the text file in main function, so I am not sure where exactly it's being created. The only reason behind the null pointer exception, that I can think of is that the text file is not being written on the local disk. So my question is: How do I write files on the local disk? If I just specify the name of the file while creating it, where is it created and how do I access it?
Have a look at Jets3t
This seems to be exactly what you need.
Jets3t is awesome, but I am using Google's App Engine, and it doesn't work on there because of threading limitations.
I banged my head against the wall until I came up with a solution that worked on App Engine by combining a bunch of existing libraries: http://socialappdev.com/using-amazon-s3-with-google-app-engine-02-2011

vb.net PDF integration

We have a database that has decompiled data versions of PDF files stored as blobs.
The old method to retrieve the information was to grab the blob, compile the file on the local disk, and then use process.start to launch the new .pdf file that was created.
I guess I am looking for a class that can accept the decompile PDF data, turn it into a compiled PDF and show the end results without having to save the file to the local disk.
Anyone have any suggestions?
thanks.
You could just create the stream and send that into a Document Viewer control for PDF. There are tons of PDF Viewer controls, as long as they support a DataStream you should be fine. I'd let the process compile the PDF File into memory as a File Stream and send it to the PDF viewer. I have done the same thing but to a Microsoft format like xps, and doc but as long as the viewer supports a file stream you should have no problem.
This pdf viewer has a cost, but it might help: http://www.gnostice.com/nl_article.asp?id=109 the example they show goes by filename but its possible it might support the data stream method. Most views do.
Run through all the compiled .pdfs with your old method and store them somewhere.