I now have a much better idea on what you are trying to do. I
have a simple example attached that demonstrates how to extract a
specific color out of an image, and locate all the instances where that
color is found in the image. I produced this example using Vision
Assistant. If you have the Vision Development Module installed on
your machine, you should also have this program. You can find it
by going to Start >> Programs >> National Instruments
>> Vision Assistant. I would highly recommend that you try
this program since it offers a simpler interface to perform tasks, and
it generates LabVIEW code once a sample script is complete.
In the event that you do not have this program available, you can build
your program off of the example that I have attached. The program
will prompt for two files: One is the yellow.png file that I have
attached that is an extraction of the yellow color that you have in the
image that you sent me, and the other is the image that you wish to
search through for that color. In this case I selected the actual
image of the glove that you sent me. The results of the program
will locate all of the objects in the image that contain the specific
yellow color that is defined in the template .png file. It will
then return the coordinates of those instances. Use this example
to identify the colors in your image.
Also notice how the code is arranged on the block diagram of the
example. A very good tip that I would suggest would be to try and
arrange your code in a similar fashion as what is demonstrated in the
example to improve visual clarity and ease of debugging. The
appearance of the code can go a long way as you further develop your
hi .. i tried it out with vision assistant ,.. i got the coordinates
... but when i tried the VI file .. it doesn't work .. the read image
and vision info had an error.. it says.. it's not the latest version of
IMAQ.. i'm using v7.1 .. and how do i convert programs from vision
assistant to LV ? from the program, it shows the coordinates of the
matched sections, and the matched section is only a small part of the
whole yellow region, how do i extract the whole region based on the
coordinates? and how do i actually extract the desired section of
the images.. now i understand the matching part and getting the
coordinates, but i dont have a clear idea on how to use that info to
extract the images?? thanx very much for ur help .. Torba..
Since it sounds like you have Vision Assistant 7.1, lets continue
working with it. I attached a new script that was provided
graciously by our Vision development team. This code will extract
the entire regions of each color on the glove. Check it out.
The errors that you were getting when you attempted to run the previous
example raise a question. What version of IMAQ do you have
installed? You can find out by opening Measurement and Automation
from your desktop, and expanding the Software tree on the left side
once it is opened. You should see a listing for NI-IMAQ under the
Software category. Click on the NI-IMAQ listing once, and the
right-hand window should display the version of the software. If
you have a version of IMAQ that is older than 3.5.1, you can obtain the
latest version of this driver by going to the following website to
NI-IMAQ Version 3.5.1 for Windows 2000/XP
When this page opens, click on the "Vision Acquisition Software" link
to navigate to the installer that contains the IMAQ driver. You
will have to be logged into our website to download it. Once you
have the VisionAcquisitionSoftware800.zip downloaded, uninstall the
current version of the IMAQ driver that is on your PC by going to the
Control Panel >> Add/Remove Programs >> National
Instruments Software. Click "Change" and a list of all your NI
software will appear. Locate the NI-IMAQ driver here, and select
uninstall. Restart your machine, and then extract and install the
Vision Acquisition Software package that you have downloaded.
To answer your other question about converting a script to code, you
can convert a script to LabVIEW code from the Vision Assistant by going
to Tools >> Create LabVIEW VI in the top bar of the Vision
Assistant. Follow the steps, and a VI should be created that you
can open in LabVIEW.
I hope all of this information helps. Please let me know if you have any questions about the script.
hi Torba, thanx alot for ur help, i've been stuck for quite some time,
but since u started helping me, my progress has been quite good,
i've got problem with thresholding, from the program u made, it seems
like u can easily set the threshold range accurately, my understanding
is quite poor tho i've gone thru a few books, i dont know when to use
RGB, HSL, HSV or HSI. can u please explain to me? rite now i'm still
working on the thresholding part based on ur program.
my IMAQ is quite old, im downloading the latest one.
from the program u wrote, the masking only works for that particular
image and can't be used for any other random images, but from ur idea ,
i managed to creat one for ramdom images. can u please help me check ?
i've attached my program
does vision assistant have all the functions i need? i find it very
useful, but there are quite a lot of settings which i dont know how to
also from the program, which i converted to .vi, i only get the results
for the last procedure, i can't view the other thresholded images, the
thresholding was done for different colrs, how do i combine them to be
processed? how do i do color matching , since the images are in gray
i think at the moment my biggest problem is the thresholding part. i
hope u wont mind helping me out, ur explanation has very very detail,
makes it easy for me to learn LV, i'm new , but i've learn alot frm u
.. thanks very much.
I have a few good resources to go to that describe what all of these color modes mean. Here is the link:
Color Image Representations
You will also find a few more links at the bottom of that page that discuss how thresholding works that should help.
In general, if you are curious to know more about how a function works,
you can usually find some help on that item by opening the context help
in LabVIEW (ctrl-H) and putting your cursor over the VI in
question. The context help will display a summary of what the
function does, and what all the inputs and outputs are. You can
obtain detailed help by clicking on the "Detailed Help" link in the
Context Help window. Occasionally, this detailed help window will
also contain references to examples that demonstrate how to use that
particular function. I do know that the Color Thresholding VI has
a link to an example in its detailed help. The location for the
example was claimed to be: C:\Program Files\National
Another awesome resource for help on Vision theory is already at your
fingertips. If you navigate to www.ni.com/vision, it will take
you to a page that focuses on everything about vision. To find
specific help on anything (i.e. color thresholding) simply type the
keywords in the searchbar in the upper right corner of the page, and
perform the search. The search should return with material in
different categories throughout our website. You can focus in on
example material, issues that previous customers have had specific to
your keywords, or even theory documents on our Developer Zone
site. I actually found the Color Image Representations page by
searching for "RGB HSL" in the searchbar, and selecting Developer Zone
for the Search Within dropdown list. Try this. You would be
surprised of the results.
Your one statement about the script only working with a specific image
is correct mainly because I specified an image to load at the beginning
of the script. If you want the script to process whatever image
you tell it, simply convert the script to code with no specific image
loaded. You will notice in the block diagram that there will be a
File Dialog VI placed in the beginning to prompt the user to load any
image for processing.
To summarize, don't hesistate to give our website a shot for searching
information on all of the functionality and terms that are being used
for Vision. We try to provide our users with as much supporting
information as possible to make them successful as efficiently as
possible. We typically use the discussion forums as a means for
users to ask very specific questions that they haven't been able to
find answers to elsewhere. This utility in conjunction with all
the documentation on our website and the user manuals hopefully covers
all the bases for support.
hi .. i've done thresholding for the different colors, so i get three
results, but how do i combine all the results to be further processed?
and how do i do color matching since the images are grayscale??