Saving Images JavaScript

Saving Images JavaScript

Portrait de mariyah87

Hello,

I have written a javascript page that starts the camera andcaptures a picture. I then want to save the photo to some location.

I thought it would be something along the lines of ...

camera.captureFrame();
frame = camera.frames(0);
frame.Image.Save ("mariyahs.bmp");

That doesn't work though, the error msg says frame.image is null or not an Object.

I'm guessing its not null, its probably that it's not accessible in that way. Am I going terribly wrong?What is the default location that it saves to? Can that be changed? For now I just want to save it to disk.

Any help would be much appreciated :)

Thanks,

Mariyah :)

14 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Hello mariyah87,

the class camera does not contain a method called "frames(int)"

so I think the when you call

camera.frames(0);

you should recieve an error. Instead you should do this:

Frames captFrames = oCam.getFrames();
Frame captFrame = captFrames.get(captFrames.size() - 1);


Now there are different things you can do, you can convert the Frame to an image

Image image = captFrame.getImageEx();



Or you convert it into a byte[]

byte imagebuff[];
imagebuff = captFrame.getImage();


I hope this will help you

Markster

Portrait de mariyah87

Hey thanks for your help.I tried that and it comes up with same error as before. (Object doesnt support this property or method)I also tried accessing accessing any of the frame methods/propertiesbut it keeps saying 'object Expected'.The only time it identifies that there is actually an object is when I use the frame.CopyToClipboard.I can then paste it into another application. Unfortunately thats of no use to me! I need to be able to save it by pressing a button.So its getting the individual frame from the frames and saving it to my frame object. But then not letting me use it.Any suggestions? :(Here is oneof my efforts:

function capturePhoto()

{

var frame=new ActiveXObject("IntelHealthcare.Frame");

try

{

camera.captureFrame();

frame=camera.Frames(0);

// throws no errors uptil this point

var image = new image();

image = frame.RawImage();

}

catch(e)

{

alert(e.description)

}

}

& heres what it looks like when I did it your way.

function

capturePhoto()

{

var frame=new ActiveXObject("IntelHealthcare.Frame");

var captframes = new ActiveXObject("IntelHealthcare.Frames");

try

{

camera.captureFrame();

captframes = camera.getFrames();

frame = captframes.

get(captFrames.size() - 1);

var image = new image();

image = captFrame.getImageEx();

}

catch(e)

{

alert(e.description)

}

}

Throws same error either way :(Any more suggestions would be much appreciated. Thanks everyone :)

Hello mariyah87,

Maybe you can try this workaround:

oCam.captureFrame();
Frames captFrames = oCam.getFrames();
Frame captFrame = captFrames.get(captFrames.size() - 1);
imagebuff = captFrame.getImage();
try {
	BufferedImage buffimage = ImageIO.read(new
                      ByteArrayInputStream(imagebuff));
        ImageIO.write(buffimage, "JPEG", new File("C:/pic1.jpg"));
} 
catch (IOException e) {}

I hope this will help

Greetings Markster

Portrait de mariyah87

Hey markster thanks for your help again. However, I am writing javascript and the methods are different, Ihave got as far as getting the image in this way,
frame.RawImage;
Im not quite sure what I can do with it after that? Any ideass on what format that is in?
I need to save it after that point.
Thanks in advance for any suggestions
Mariyah

Portrait de Steven Murray (Intel)

Quoting - mariyah87

Hi Steve,

I'm still unable toregister the dll file. I'm now takinga different approach but am still keen to hear from you if the source code will be available for me to use.

Regards

Mariyah

Hi mariyah87,

I have attached the sample source code to this post that you can test with to save the captured image in JavaScript.

Steps for saving Image:

1. Build the project in release mode on your system using the provided source.

2. Register the Built DLL (In the command prompt type "regsvr32 FileSave.dll") for registering the COM DLL.

3. System will display message for successful registration.

4. Use below provide sample piece of code to save the captured image:

//Activex object to save the image in the disk

var filesv = new ActiveXObject("FileSave.FileSaveInterface");

..

//save the image in the disk

filesv.SaveImage("c:\temp\testsave.bmp"

, frame.RawImage, frame.RawImageSize);

Please note this source code is not officially validated or supported. It is provided as a sample as one possible way to implement a solution.

Thanks,

Steve

Fichiers joints: 

Fichier attachéTaille
Télécharger file_save.zip2.66 Mo
Portrait de mariyah87

Hi Steve,
Hoping you can shed some light, I've now written a windowsapplication as opposed to my previous web application.
It works fine on my development pc but throws the following error when I try to run it on the c5-
'Unable to find an entrypoint named HC_GetLibraryVersion in DLL 'IntelHealthcareSDK.dll'.
Hope to hear from somebody soon
Warm Regards
Mariyah

Portrait de Steven Murray (Intel)

Hi mariyah87,

Can you post the portion of your codeaffected so we can understad the context of where you are making the call from ?

Thanks,
Steve

Portrait de Steven Murray (Intel)

Hi mariyah87,

Is the MCA SDK you have installed on your development PC the same version as the MCA platform driver installed on the Motion C5? It may be that you are using MCA SDK v2.x on your development PC and have MCA platform driver v1.x on the Motion C5.

Can you tell me what the version of each is?

Thanks,
Steve

Portrait de mariyah87

Hey I just checked and it's version 1 of the driver and version 2 of the SDK.
Is there a newer, compatible version of the driver? If not, what are the differences between the older, compatible version of the SDK and this current version?
Is there any way I can work around this or should I not take it any further?
Thanks
Mariyah

Portrait de Steven Murray (Intel)

Hi mariyah87,

You should use the same versions of MCA SDK and MCA Platform Driver when developing if possible. You can download the MCA Platform Driver from Motion Computing at the URL below. They call it the Medical Clinical Assistant software on their web site. It looks like the latest version they have on their web site is v1.11. However, I believe if you contact Motion Computing they can provide you v2.0 of the MCA Platform Driver as it has been available to other developers who have requested it.

http://www.motioncomputing.com/support/driver_download.asp

If you are not able to get v2.0 MCA Platform Driver from Motion, then you should consider uninstalling MCA SDK v2.0 from your development system and installing MCA SDK v1.11 on it for your development. Both v1.11 and v2.0of the MCA SDK are available here:

http://downloadcenter.intel.com/Filter_Results.aspx?strOSs=All&strTypes=All&ProductID=2854&OSFullName=All%20Operating%20Systems&lang=eng

Thanks,

Steve

Portrait de mariyah87

Hi Steve,

I contacted Motion Computing and was unable to get version 2.0 of the platform driver and therefore downloaded version 1.1 of the development kit and again, tried to run the application on the MCA. It gives me the exact same error, therefore i presume its caused by something else. Any other ideas of what it might be?
Thanks
Mariyah

Portrait de Steven Murray (Intel)

Quoting - mariyah87

Hi Steve,

I contacted Motion Computing and was unable to get version 2.0 of the platform driver and therefore downloaded version 1.1 of the development kit and again, tried to run the application on the MCA. It gives me the exact same error, therefore i presume its caused by something else. Any other ideas of what it might be?
Thanks
Mariyah

Do you now see the same error on the Motion C5 running v1.1 and on your development system running MCA SDK v1.1? Or, does it work fine on your development workstation but still fails on the Motion C5?

If it work fine on your develop system running MCA SDK v1,1, but fails on the Motion C5 running MCA v1.1, then pleas try to reinstall the MCA Platform Driver. You will need to uninstall the MCA software from the C5, reboot, and then reinstall the software from Motion at this URL:

http://www.motioncomputing.com/support/driver_download.asp

If it is failing to run on both your develop system and the C5 which are both running v1.1, then it likely a programming error in your code.

Thanks,

Steve

Portrait de mariyah87

Quoting - Steven Murray (Intel)

Do you now see the same error on the Motion C5 running v1.1 and on your development system running MCA SDK v1.1? Or, does it work fine on your development workstation but still fails on the Motion C5?

If it work fine on your develop system running MCA SDK v1,1, but fails on the Motion C5 running MCA v1.1, then pleas try to reinstall the MCA Platform Driver. You will need to uninstall the MCA software from the C5, reboot, and then reinstall the software from Motion at this URL:

http://www.motioncomputing.com/support/driver_download.asp

If it is failing to run on both your develop system and the C5 which are both running v1.1, then it likely a programming error in your code.

Thanks,

Steve

Hi Steve,

Thanks for your help, it is working fine now as I am using the newest driver and older development kit.

Mariyah :)

Connectez-vous pour laisser un commentaire.