I wanted to know how exacts IMAQ TransformROI works, I have no doubts when the base and new reference axis is same ( when both are direct or indirect), when the axis of transformation is not same, then it is confusing for me.
When Base Reference is (100,100), direct axis
and New Reference is (100,100), indirect axis and I give the same point to transform (100,100). I expect the output to be (0,0).
But it is not. How does the VI work? I couldn't find enough information in NI help.
I have attached a sample VI for your understanding.
Solved! Go to Solution.
You have chosen a very complex transformation involving a change of origin + a change in Axis Reference, which changes the "handed-ness" of the coordinate system (the sign of Y is reversed). I'm pretty sure that you should not change Axis Reference in the middle of your compuration (I'm not even sure why it is there ...). It's also not clear to me why you create a one-point ROI ...
Thanks Bob for your reply.
I want to basically do a 2D transformation of a point. During 2D transformation, the axis reference of base and new coordinate system can change, we are not going to change in the middle of the computation. It is just a axis transformation. I am trying to use IMAQ TranformROI.vi to transform one point from one coordinate system to another. I want to communicate the x,y coordinates to a robot and the robot base calibration is in direct axis. NI help doesn't mention anything about change in axis reference.
The VI is either not working if the axis references are different or I don't know in what logic it is working.
Pick a single Axis Reference (I suggest "Direct", with X and Y increasing as you go Right and Up) for both Reference and Measurement systems. Then it all makes sense. A Point at 150, 50 with a Reference System at 100, 100 means that it is 150 - 100 = 50 to the Right of the Reference Origin and 50 - 100 = -50 or 50 Down from the Reference Origin. So if you move the Measurement Origin to 0, 0, the coordinates become 50, -50 when both systems use Direct Axis Reference.
Thanks for your reply. I cannot change my reference axis, because the angle of reference is not always zero. So computing coordinates is not easy. Moreover I found that VI works weird only when both the angles are zero. It is definitely a bug and I have reported to NI. Changing the angle to 360 (or anyother angle for this case) works fine. So as a workaround I will go with 360.
While I don't understand what is going on here, I believe that "Axis Reference" refers, in essense, to the (non-displayed) Z Axis (but I could be wrong -- documentation is very sparse here). In "Direct", the orientation of the X and Y axes are such that if one used the Right-Hand Rule, the Z axis would point up, out of the page, while with the "Indirect" setting, Z points down into the page. The Reference component "Angle" expresses the rotation of the X-Y-Z axes around the +Z axis -- this is the normal way to transform ROI's, and one that I've used when I needed to do this.
For example, I wanted to create a square at the end of a rectangular ROI. If the ROI is "untwisted", i.e. has a Rotation of 0, then the new ROI is simply the old one with the left edge changed to be (right - (top - bottom)). Otherwise, you "untwist" the ROI by doing a Transformation of Rotation Angle about 0, 0 using Direct coordinates, transform as above, then "Retwist" the revised ROI to the original angle of the ROI. Everything stays in Direct coordinates.