LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modify or shift a coordinate system in NI Vision

Solved!
Go to solution

I want to get 2D real world positions [mm] of a certain marker (which is a small round black object) placed on the fingertip. Therefore, I have a Vision Assistant script which does a few steps (see image 'VA script'):

- convert to greyscale

- calibrate image (distortion model grid)

- correct the image (according to calibration of previous step)

- search for the round black marker to get the positions

 

Now, this works fine. However, the origin and orientation are set in the 'image calibration' step and the origin is chosen in the center of the upper-left dot of the used calibration grid.

The perspective and distortion parameters are fine but not the origin. Not every measurement trial has the same origin. I want the user select the origin by means of a simple step. For example, placing the mouse cursor on some location, which has to be set as the origin.

 

To conclude, how can the user switch or shift the location (and possibly also the orientation) of the coordinate center, and at the same time preserving the distortion parameters of the camera, i.e. the calibration step does not have to be completely performed again.

 

Can anyone help me out with this? I could not find the answer here on the forum or elsewhere.

0 Kudos
Message 1 of 8
(3,190 Views)

Having some of your code would be very helpful.  I'm not sure what the JPG Image is supposed to tell me ...

 

Bob Schor

0 Kudos
Message 2 of 8
(3,166 Views)

Sure, I will attach the code (together with the Vision Assistant script).

 

However, I thought this would not be necessary for answering this kind of question. It is merely a question where I can find material to shift/modify/translate and/or rotate a coordinate system after teh calibration step is performed. How to do this. The JPG image is a screenshot of the Vision Assistant script, in order to see the different processing steps (which I mentioned in the post) and to check the origin and orientation of the coordinate sustem after calibration. As you can see this origin is not in the upper left corner of the camera image, or elsewhere where the user wants it.

 

If anything is still unclear in helping me out with this, please let me know.

Download All
0 Kudos
Message 3 of 8
(3,152 Views)

I tend to not use the "all-in-one" tools like Express VIs and Assistants.  There are Coordinate Transformations built into IMAQ that can do rotations and translations (and "stretches") (IMAQ Rotate, IMAQ Shift), that can operate on Regions of Interest (ROI) (IMAQ Transform ROI), and other operations common with Image Processing.  What is somewhat lacking, however, and might require a little "experimentation" (create a simple Image, write a simple routine that you hope does something simple, try it out, and if it fails to "do the right thing", post your Simple Example to the Forums and we'll try to help).

 

There is a book that I have packed in a box, somewhere (I recently relocated and am still unpacking) that had some discussions of IMAQ routines, "Practical Guide to Machine Vision Software: An Introduction with LabVIEW " [Kye-Si Kwon, Steven Ready].  You can also try the Web, looking for "Machine Vision LabVIEW", which returns this book and other possibly useful sites.

 

Bob Schor

0 Kudos
Message 4 of 8
(3,146 Views)

I think you are incorrect about IMAQ Rotate, IMAQ Shift, etc. as I am not intending to translate or rotate the entire image but merely the coordinate system. However, you are correct about two other things. First, it takes a little time extra, but it is indeed better to do experimemtation and create a simple example, thus extract things from the whole. Also, I think you are right that what I am trying to do, is NOT possible within Vision Assistant (Express vi). You can set a coordinate system there in Vision Assistant, but only with outcomes of other processing steps like 'Find Edges'. I think I have to do all things with lower level IMAQ routines on the pallette 'Vision and Motion > Vision Utilities > Calibration'. Also the NI example 'Simple Calibration' provide some help. Hope I can solve things with those sources.

 

Thanks for the feedback and confirmation to go with lower level Image Processing!

 

0 Kudos
Message 5 of 8
(3,143 Views)
Solution
Accepted by topic author DvdM

It's been a while since I played around with this and I am a few versions behind but I believe this could be done with IMAQ Set Calibration Axis Info. IMAQ Get Calibration Info will show the current calibration axis and origin.

 

snip.png

0 Kudos
Message 6 of 8
(3,139 Views)

Hi RamonG,

 

Sorry for my late respons, as I was trying a lot of things. First, you were right! That was exactly what I was looking for. Btw, too bad that documentation in the vision part of Labview is sometimes poor and/or wrong, and good examples are lacking.

 

Still I have an unresolved issue. I use the following consequetive steps:

  1. IMAQ Set Calibration Info
  2. IMAQ Correction Learn Setup
  3. IMAQ Correct Calibrated Image

 First, the perspective and distortion error are corrected in the third step but also the image was rotated. Now, I found out that there is an input node of IMAQ Correction Learn Setup called 'Apply calibration axis'. I set this to False and that's okay. However, in later calculations (actually in IMAQ Find Pattern 4), I DO want to use the calibration axis info. How do I accomplish that?

I thought the attached approach would do the trick, but sadly not...the correct calibration axis info goes indeed into IMAQ Find Pattern 4, but the matches (pixels as well as the calibrated real world units) are not updated to the new coordinate system. Also the input Coordinate system of IMAQ Find Pattern 4 is not the solution, as it is the coordinate system to which the rectangle (ROI I suppose) is linked to, according to the context help.

 

Do you (or anyone else) know how to solve this?

0 Kudos
Message 7 of 8
(3,110 Views)

Sorry, solved it already!

0 Kudos
Message 8 of 8
(3,106 Views)