11-17-2008 02:01 PM - edited 11-17-2008 02:03 PM
Hey timmkish,
You should just need the Vision Acquisition Software to save an image. You're just using the functionality of the IMAQ API, which is supported by Vision Acquisition. VDM is just mainly for image inspections and processing.
I would check your NI licnese manager to make sure that everything you need is activated/installed. You can find that in Start>>All Programs>>National Instruments>>NI License Manager.
11-17-2008 02:05 PM
OK, I was just told the complete opposite by your tech support over the phone.
Can you please verify? The VDM is $3600....
11-17-2008 02:07 PM
License Manager says
Vision Acquisition Software v8.6
Status: Activated for this computer.
Inludes the following features:
NI-IMAQ
NI-IMAQdx
NI-IMAQ I/O
11-17-2008 02:10 PM
11-17-2008 02:18 PM
Sorry, I closed out the tab that had the service # on it.
Here's what I'm doing:
1) I take the 'low level snap' example code I found in
F:\Documents and Settings\All Users\Documents\National Instruments\NI-IMAQdx\Examples\MSVB.NET\Low-Level Snap
2) Opened the VB project file, compiled and ran it fine (it runs more like a low level grab, but whatever)
3) So the example code works fine.
4) In the Form designer, I add the CWIMAQvision control to the form
5) Change the name from 'AxCWIMAQVision1' to 'CWIMAQVision1'
6) Add
CWIMAQVision1.WritePNGFile(myImage, "F:\myimage.png")
right after the section of code that says
' Get and display the image
status = CWIMAQdx.GetImage(session, myImage, CWIMAQdx.BufferNumberMode.BufferNumber, 0, BufferNumber)
If (status <> CWIMAQdx.Error.Success) Then
GoTo ErrorHandler
End If
7) Compile and run the program again. When I click the 'Start' button, I get an error message on the line of code:
CWIMAQViewer1.Attach(myImage)
And the error message says 'Unlicensed copy of NI Vision'
11-17-2008 02:27 PM
I just looked into the documentation a little more, and unfortunately, it looks like the CWIMAQVision call is actually in the VDM. So, I'm assuming this worked for you once, meaning you had the evaluation copy, correct?
It looks like the only other method would be the SaveImageToDisk method, which does not use VDM calls. I will paste the readme for that function call, and you can look over and try it.
SaveImageToDisk Method
Syntax
CWIMAQ.SaveImageToDisk Filename, SourceImage
Return Type
Long
This method returns 0 on success, a negative number on an error, and a positive number on a warning.
Purpose
Saves an image to disk. This method saves border and padding information with the image data. To write an image to file without the border and padding information use the WriteImage method.
Remarks
Call this method to save an image to disk in a native operating system-specific format, such as bitmap (BMP) or tagged image file format (TIFF). The image must be the same size and have the same bits per pixel as images in the image collection of the CWIMAQ control. Save 10-bit, 12-bit, 14-bit, or 16-bit monochrome images as portable network graphics (PNG) files.
Parameters
Filename As String
The filename of the image to save to disk.
SourceImage As CWIMAQImage
The image to save to disk.
Example
Private Sub Run_Click()
CWIMAQ1.AcquisitionType = cwimaqAcquisitionOneShot
CWIMAQ1.AcquireImage
CWIMAQ1.SaveImageToDisk "c:\images\image1.bmp", CWIMAQ1.Images(1)
End Sub
11-17-2008 04:02 PM
When I add the 'CWIMAQ' object onto my form, add the lines of code that you specified, run the program, I get:
COM exception was unhandled
Saving IMAQ operation No interface found
11-17-2008 04:09 PM
11-17-2008 04:32 PM
11-17-2008 05:03 PM
Imports NationalInstruments.CWIMAQControls
Public Class Form1
Dim error_code As CWIMAQdx.Error
Dim SID As CWIMAQdx.Session
Dim myimage As New NationalInstruments.CWIMAQControls.CWIMAQImage
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
error_code = CWIMAQdx.OpenCamera(CameraName.Text, CWIMAQdx.CameraControlMode.Controller, SID)
error_code = CWIMAQdx.Snap(SID, myimage)
error_code = CWIMAQ1.SaveImageToDisk("f:\myimage.tif", myimage)
End Sub
End Class
This is the code I have that doesn't work