From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-28-2007 04:08 AM
*************************************************************************************************
Public Sub New()
MyBase.New()
myImage = New NationalInstruments.CWIMAQControls.CWIMAQImage
t1 = New System.Timers.Timer(250)
myImage.Type = NationalInstruments.CWIMAQControls.CWIMAQImageTypes.cwimaqImageTypeRGB32
errorCode = CWIMAQ1394.CameraOpen2("cam0", CWIMAQ1394.CameraMode.IMG1394_CAMERA_MODE_CONTROLLER, sid)
If (errorCode <> CWIMAQ1394.ErrorCodes.IMG1394_ERR_GOOD) Then
GoTo ErrorHandler End Ift1.Enabled =
TrueerrorCode = CWIMAQ1394.SetupGrabCW(sid)
If (errorCode <> CWIMAQ1394.ErrorCodes.IMG1394_ERR_GOOD) ThenGoTo ErrorHandler
End If
ErrorHandler:
If (errorCode <> CWIMAQ1394.ErrorCodes.IMG1394_ERR_GOOD) Then End If End Sub*************************************************************************************************
Public Function GetLedColor() As Integer 'Dim objTest As VisionTool = New VisionTool Dim roi As New CWIMAQRegions Dim roiRect As New CWIMAQRectangle roiRect.Initialize(111, 54, 7, 15)ViewRect.AddRectangle(roiRect)
IMAQVision.LearnColor(myImage, ColInfo, ViewRect)
IMAQVision.MatchColor(myImage, ColInfo, Scores, ViewRect)
Return 2 End Function*******************************************************************************************************
Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles t1.ElapsederrorCode = CWIMAQ1394.Grab2CW(sid, 1, BufferNumber, myImage)
If (errorCode <> CWIMAQ1394.ErrorCodes.IMG1394_ERR_GOOD) Thent1.Enabled =
False End If End SubEnd
Classall i can figure out is,there is some control that a console application cannot handle.but the only control in this code is the CWIMAQControl. (i removed the viewer, and the windows timer control)without it i cant access any of the vision functions.is there any way around this?
05-29-2007 10:24 PM
05-30-2007 08:18 PM
06-06-2007 10:04 AM - edited 06-06-2007 10:04 AM
Message Edited by Luke H on 06-06-2007 10:05 AM
06-06-2007 07:04 PM
06-21-2010 11:03 AM
Another thing that can be said about IMAQ ActiveX, multi-threading and forms
IMAQ 8.0 is an ActiveX wrapped for dotNet 2.0
The requirements for activeX is that they method must be called from the STA thread that has created them.
For instance if you want to do multithreading with IMAQ, create multiple thread, each thread hosting the message loop of a form that contains IMAQ processing.
Example:
class Main
private shared sub m_fThreadProc
Application.Run(new Form_Ni_Processing)
end sub
public sub New()
InitializeComponent()
for i as integer=0 to 3
dim t as new thread(addressOf fThreadProc)
t.SetApartmentState(ApartmentState.STA)
t.Start()
next
end
06-21-2010 11:08 AM
Oups , I forgot one thing:
after each thread start, do a sleep for 1 second:
threading.thread.currentThread.Sleep(1000)
when using multi threading occurences of IMAQ, it avoids the occurence of Reflection.TargetException ....
don't ask me why, but it is the way I solved this NI issue.
Otherwise you can step back to good old C++
06-28-2011 07:29 AM - edited 06-28-2011 07:31 AM
Hi,
I'm developing one application using NI Vision 8.2.1 and VB6.
I'm facing an error "31913 - Invalid Template Descriptor" for my pattern matching function.
I'm very new to VB. I'm working on an already developed code which is functioning fine and I want to modify this code for my application.
The patterns currently available are working fine with the application. But I want to create new patterns for my new application.
I have gone through the following link, and it gives a LabVIEW based example for creating Templates.
http://digital.ni.com/public.nsf/websearch/F05924D50AD6472B86256F320075CDBF?OpenDocument
Can anyone please provide me an example code in VB6 which can create Templates?
Thanks in advance...
06-28-2011 02:42 PM
Hi Maverick,
I am not any more fluent with VB6.
My best advice will be to ask you if you know .Net technologies ? There are a lot of good example on on how to use templates .... however not on how to create them.
Here my best advice is to tell you to read the concept manual AND to look carefully at the function description (in the help file).
In Vision Assistant there is also a tool that allows to create C code; so you can create a script and then export it in C .... and see what functions are called and from which DLL.
One last thing to know about template: template information associated with an image can be saved with the image (under the NI PNG format) using a function whose name might be like WriteFileAndVisionInformation() .
It means that ONE PNG file can contain the image, the pattern matching definition, the geometric template and the goldent template AT ONCE !!!
If you need more info you can write me directly at areymondier@aureus-ingenierie.fr
regards
I am
01-20-2013 07:38 PM
Hi everybody!
I am trying to do a mirror image of the video that i grabbed using ez grabber devices.
However, the program seems unstable.
Sometimes it shows the image correctly, other times it just stop the program with a warning "The image is not large enough for the operation"
I'm not sure what is wrong.
Attached below is the program