Getting the coordinates of an overlayed rectangle or point
I have drawn a rectangle or point on an image using the Tools and I now want to get the coordinates of the rectangle or point I have just drawn. How do I do this?
bep -
To do this, use the Regions property on the CWIMAQViewer object, and assign it into a variable of the type of the ROI (in this case, a rectangle). Here's an example:
Dim rect As CWIMAQRectangle
Set rect = CWIMAQViewer1.Regions(1)
The rect variable should now contain the dimensions of the rectangle drawn.
Let me know if you have problems with this. Thanks!
Greg Stoll
IMAQ R & D
National Instruments
Greg Stoll
LabVIEW R&D
Similar Messages
-
PhotoShop Automation PlugIn: How do I get the coordinates of a polygonal selection?
Hi.
I try to get the coordinates out of a selection, but I can't find out how to do that.
I tried to convert the selection into a path and get the coordinates from the path. That doesn't work either.
Can somebody give me a list of parameters inside the action descriptor of keyPathContent in classPath? I assume that the point infos are located there...
Thanx in advance,
Christianfound the answer myself. It might be helpfull to others.
btn.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e) {
Rectangle ret = btn.getBounds();
double y = ret.y + ret.getHeight();
pop.show((Component) e.getSource(), ret.x, (int)y);
} -
How to get the coordinate of a cell in the jtable?
How to get the coordinate of a cell in the jtable?
How to get the point of a cell in the jtable?
Thanks for help!getCellRect(...);
-
When I try to start iTunes I get the following error message: Itunes.exe – Entry Point Not Found - The procedure entry point kCMByteStreamNotification_AvailableLengthChanged could not be located in the dynamic link library CoreMedia.dll.
Any answers how to fix it? All Im getting is error for the past 3 days!
-
Getting the coordinates of 1 bufferedimage inside another buffered image
hi, i'm kinda new to this.
is there a way to get the starting x and y coordinates of 1 bufferedimage inside another bufferedimage
let's say this is bufferedimage 1
http://img293.imageshack.us/i/oracle.png/
and this is bufferedimage2
http://img38.imageshack.us/i/buffered2.png/
i would like a method to return the x and y coordinates of image1 inside image2
is there anyway to approach this?
or was there a prewritten method?
thanksbep -
The problem is that the two rectangles have points in common. When the CWIMAQVision.RegionsToMask is done, it sets any point that is in any region to a non-zero value, and all other points to 0. So, when the CWIMAQVision.Label is done, it sees one big rectangle of non-zero values, and labels that (and so the CWIMAQVision.Quantify sees the one rectangle as well).
The easiest way around this problem (if the rectangles must have points in common) is to only make one region active at a time, so CWIMAQVision.RegionsToMask will only use that region to create the mask image, and then call CWIMAQVision.Quantify twice. So, the code would look like this:
Set pMaskImage = New CWIMAQImage
pMaskImage.Type = cwimaqImageTypeU8
Me.CWIMAQViewer1.R
egions(1).Active = True
Me.CWIMAQViewer1.Regions(2).Active = False
Me.CWIMAQVision1.RegionsToMask pMaskImage, Me.CWIMAQViewer1.Regions
Me.CWIMAQVision1.Label pMaskImage, pMaskImage, avgPixelVal
Me.CWIMAQVision1.Quantify Me.CWIMAQViewer1.Image, globalReport, regionsReport, pMaskImage
dblROImean = regionsReport.Item(1).Mean
Me.CWIMAQViewer1.Regions(1).Active = False
Me.CWIMAQViewer1.Regions(2).Active = True
Me.CWIMAQVision1.RegionsToMask pMaskImage, Me.CWIMAQViewer1.Regions
Me.CWIMAQVision1.Label pMaskImage, pMaskImage, avgPixelVal
Me.CWIMAQVision1.Quantify Me.CWIMAQViewer1.Image, globalReport, regionsReport, pMaskImage
dblSurrROImean = regionsReport.Item(1).Mean
Let me know if this gives you problems.
Greg Stoll
IMAQ R & D
National Instruments
Greg Stoll
LabVIEW R&D -
How to get the area of a selected rectangle?
Hi:
I want to use the selected area in a automation plugin. In my case, the area is rectangle. i can't get the top,left,bottom and right position.
Is there anyone can help me?I'm petty you sure can extract the details you want using a script. I think the method is called Selection Bounds, and it return an array of the unitValue of the rectangle.
If you look at the scriptlistener code for creating a rectangle, it does record the data you want. So you should be able to extract it using Javascript, Apple Script or VB
This is what the scriptlistener code looks like,
// =======================================================
var id5 = charIDToTypeID( "setd" );
var desc3 = new ActionDescriptor();
var id6 = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var id7 = charIDToTypeID( "Chnl" );
var id8 = charIDToTypeID( "fsel" );
ref1.putProperty( id7, id8 );
desc3.putReference( id6, ref1 );
var id9 = charIDToTypeID( "T " );
var desc4 = new ActionDescriptor();
var id10 = charIDToTypeID( "Top " );
var id11 = charIDToTypeID( "#Pxl" );
desc4.putUnitDouble( id10, id11, 210.000000 );
var id12 = charIDToTypeID( "Left" );
var id13 = charIDToTypeID( "#Pxl" );
desc4.putUnitDouble( id12, id13, 276.000000 );
var id14 = charIDToTypeID( "Btom" );
var id15 = charIDToTypeID( "#Pxl" );
desc4.putUnitDouble( id14, id15, 455.000000 );
var id16 = charIDToTypeID( "Rght" );
var id17 = charIDToTypeID( "#Pxl" );
desc4.putUnitDouble( id16, id17, 613.000000 );
var id18 = charIDToTypeID( "Rctn" );
desc3.putObject( id9, id18, desc4 );
executeAction( id5, desc3, DialogModes.NO ); -
How can I get the coordinate in the layer coordinate system while doing the iterate?
I found that the position(x,y) the iterate function tell me is not right sometimes.
Actually,it happens when the top of the layer is negative. The "y"is in the comp coordinate system(maybe?) but not the layer.In another word, the position with y=0 is not the top.
More specifically, I have got the color map of a layer. I am able to get the color of any pixel in the layer. But I can't set the color one for one when I use "iterate",because there is an offset.
Am I supposed to get the offset? Is there any way to access the whole layer directly if I use iterate function?so indeed it's the offset at play.
AE will diminish the buffer at 20% increments, and not for each pixel that
goes out of sight. it's not really in relation to the upper left corner,
it's all about what part of your layer buffer is out of sight.
there's also an "iterate offset function". check it out. perhaps it will
save you some trouble.
On Fri, Dec 19, 2014 at 2:45 PM, Hinanawi Tenshi <[email protected]> -
SDO_ORDINATES how to get the coordinates?
Hello,
how can i get the individual x1,y1 and z1 coordinates of a box? when i use in an sql statement sdo_ordinates i just get an object sdo_ordinate_array. But how can i filter out the coordinates? To explain what i want to do here a pseudocode sql-statement:
select min(v.shape.sdo_ordinates.x1),min(v.shape.sdo_ordinates.y1),min(v.shape.sdo_ordinates.z1),max(v.shape.sdo_ordinates.x1),max(v.shape.sdo_ordinates.y1),max(v.shape.sdo_ordinates.z1) from veith.voxel v
Is there a way to get an sql-statement that gives me the min and max x1,y1 and z1 from a table and also a statement where i get the x1,y1 and z1 value from all tableentries? For any help thanks in advance.
Greetings,
Markus VeithMarkus,
If you are using 9i there are two functions: sdo_geom.max_mbr_ordinate and sdo_geom.min_mbr_ordinate which will return either the min or max ordinate values in a layer.
If you are using 8i, you will have to write a sql block or procedure to compare the x ordinates or y ordinates and retrieve the min or max values.
Hope that helps.
Dave
David R. Miller
Michael Baker Jr., Inc.
3601 Eisenhower Avenue
Alexanria, VA 22304
[email protected]
www.mbakercorp.com -
Get the Coordinates of a Character in a TextArea
Is there a way to determine what the coordinates of a given
character are in a TextArea control? One project I'm working on
presents a chunk of text cut off at some number of characters,
followed by a LinkButton control (e.g., to view "more"), and I'm
having trouble figuring where to place the LinkButton control
without knowing the coordinates of the last visible character of
the TextArea. Anyone dealt with this one before?
Thanks in advance...
ChrisHm, thanks, but that just places the LinkButton next to the
TextArea control, beside and outside of it, not "inside" (or really
over) it, as my example should've implied.
I think I've found a workable solution -- see below, where
myCanvas is some Canvas control already defined in MXML somewhere,
and myText is a Text control already defined (and populated) as
well:
var numberOfLines:int =
myText.mx_internal::getTextField().numLines;
var lineMetrics:TextLineMetrics =
myText.getLineMetrics(numberOfLines - 1);
var targetX:int = lineMetrics.width + 10;
var targetY:int = (numLines - 1) * lineMetrics.height;
var myLinkButton:LinkButton = new LinkButton();
myLinkButton.label = "More...";
myCanvas.addChild(myLinkButton);
Still testing, but TextLineMetrics seems to have done the
trick.
If anyone has a better approach, let me know! Thanks much. -
How to get the coordinate of any character in just a single text frame?
I am using Illustrator CS5. Better solutions in c# language.
Hi,
According to your description, my understanding is that you want to get the groups name of a specific user using Client Object Model PowerShell in SharePoint 2010.
We can loop the site group collection and the users in each group and then check if the user exists in the user collection.
ClientContext clientContext = new ClientContext("http://sp/sites/mysite");
GroupCollection collGroup = clientContext.Web.SiteGroups;
clientContext.Load(collGroup);
clientContext.ExecuteQuery();
User usr = clientContext.Web.EnsureUser(@"contoso\administrator");
clientContext.Load(usr);
clientContext.ExecuteQuery();
foreach (Group group in collGroup)
UserCollection collUser = group.Users;
clientContext.Load(collUser);
clientContext.ExecuteQuery();
foreach (User user in collUser)
if (user.LoginName==usr.LoginName)
Console.WriteLine(group.Title);
Console.ReadKey();
For PoweShell command, you can convert the code above to PowerShell Command.
Here is a detailed article for your reference:
https://msdn.microsoft.com/en-us/library/ee538244%28v=office.14%29.aspx?f=255&MSPPError=-2147217396
Thanks
Best Regards
Jerry Guo
TechNet Community Support -
How do I get the coordinates of the text block (TextFrame) help me please!
Dim myApp As New Illustrator.Application
Dim myDoc As Illustrator.Document
myDoc = myApp.ActiveDocument
Dim textRef = myDoc.TextFrames.Add
For Each ArtPageItems In myDoc.PageItems
If TypeName(ArtPageItems) = "TextFrame" Then
'========It is necessary to obtain the coordinates of the text block and move closer to the object (ie the text)============
Else
End If
NextHi Todd, you're welcome, please explain better, I don't understand the question.
are you trying to "move" a textframe (Dim textRef = myDoc.TextFrames.Add) closer to other text frames? or do you want to "zoom" to this textframe? -
I recently upgraded the o/s to 4.3.5 but now get the following error message, what do I do?
AppleSyncNotifier.exe - Entry Point Not Found
The procedure entry point sqlite3_wal_checkpoint could not be located in the dynamic link library SQLite3.dll.Hi Molly - I can tell you're frustrated and I will do my best
Can you tell me whether you have a 32bit or 64bit system. You can find out in the following way
Windows Vista or Windows 7
If you have Windows Vista or Windows 7, there are two methods to determine whether you are running a 32-bit or a 64-bit version. If one does not work, try the other.
Method 1: View System window in Control Panel
Click Start, type system in the Start Search box, and then click system in the Programs list.
The operating system is displayed as follows:
For a 64-bit version operating system: 64-bit Operating System appears for the System typeunder System.
For a 32-bit version operating system: 32-bit Operating System appears for the System typeunder System.
Method 2: View System Information window
Click Start, type system in the Start Search box, and then click System Information in thePrograms list.
When System Summary is selected in the navigation pane, the operating system is displayed as follows:
For a 64-bit version operating system: x64-based PC appears for the System type under Item.
For a 32-bit version operating system: x86-based PC appears for the System type under Item.
If you have a different OS (operating system) let me know which one and I'll tell you how to find that out.
Once I know I should be able to give you the fix.
Cheers -
How can I get the part image from a rectangle region?
hi,
I'm trying to draw a rectagle region on a picture with mouse and crop it. but the rectangle is not vertical along x-axis.that is to say, there is a angle between x-axis and the base of the rectangle. I don't know , how can I do it. Can someone give me some tip or some java-code. Thank you very much in advance.I completely misunderstood your question. As I read it again it seems clear and straight-forward. I'm sorry. Let's see if this is closer.
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.event.MouseInputAdapter;
public class CropImage
BufferedImage original;
CropPanel cropPanel;
CropSelector selector;
public CropImage()
original = getImage();
cropPanel = new CropPanel(original);
selector = new CropSelector(cropPanel);
cropPanel.addMouseListener(selector);
cropPanel.addMouseMotionListener(selector);
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(getUIPanel(), "North");
f.getContentPane().add(new JScrollPane(cropPanel));
f.setSize(400,400);
f.setLocation(200,200);
f.setVisible(true);
private BufferedImage getImage()
String fileName = "images/coyote.jpg";
BufferedImage image = null;
try
URL url = getClass().getResource(fileName);
image = ImageIO.read(url);
catch(MalformedURLException mue)
System.err.println("url: " + mue.getMessage());
catch(IOException ioe)
System.err.println("read: " + ioe.getMessage());
return image;
private JPanel getUIPanel()
final JButton
mask = new JButton("mask"),
crop = new JButton("crop"),
restore = new JButton("restore");
ActionListener l = new ActionListener()
public void actionPerformed(ActionEvent e)
JButton button = (JButton)e.getSource();
if(button == mask)
selector.mask();
if(button == crop)
selector.crop();
if(button == restore)
cropPanel.restore(original);
mask.addActionListener(l);
crop.addActionListener(l);
restore.addActionListener(l);
JPanel panel = new JPanel();
panel.add(mask);
panel.add(crop);
panel.add(restore);
return panel;
public static void main(String[] args)
new CropImage();
class CropPanel extends JPanel
BufferedImage image;
Dimension size;
GeneralPath clip;
Point[] corners;
Area mask;
boolean showMask;
Color bgColor;
public CropPanel(BufferedImage bi)
image = bi;
setSize();
clip = new GeneralPath();
showMask = false;
bgColor = getBackground();
protected void paintComponent(Graphics g)
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
int w = getWidth();
int h = getHeight();
int x = (w - size.width)/2;
int y = (h - size.height)/2;
g2.drawImage(image, x, y, this);
if(showMask)
g2.setPaint(getBackground());
g2.fill(mask);
else
g2.setPaint(Color.red);
g2.draw(clip);
public Dimension getPreferredSize()
return size;
public void setClip(Point[] p)
corners = p;
clip.reset();
clip.moveTo(p[0].x, p[0].y);
clip.lineTo(p[1].x, p[1].y);
clip.lineTo(p[2].x, p[2].y);
clip.lineTo(p[3].x, p[3].y);
clip.closePath();
repaint();
public void clearClip()
clip.reset();
repaint();
public void setMask(Area area)
mask = area;
showMask = true;
repaint();
public void setImage(BufferedImage image)
this.image = image;
setSize();
showMask = false;
clip.reset();
repaint();
revalidate();
public void restore(BufferedImage image)
setBackground(bgColor);
setImage(image);
private void setSize()
size = new Dimension(image.getWidth(), image.getHeight());
class CropSelector extends MouseInputAdapter
CropPanel cropPanel;
Point start, end;
public CropSelector(CropPanel cp)
cropPanel = cp;
public void mask()
Dimension d = cropPanel.getSize();
Rectangle r = new Rectangle(0, 0, d.width, d.height);
Area mask = new Area(r);
Area port = new Area(cropPanel.clip);
mask.subtract(port);
cropPanel.setMask(mask);
public void crop()
Point[] p = cropPanel.corners;
int w = p[2].x - p[0].x;
int h = p[1].y - p[3].y;
BufferedImage cropped = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = cropped.createGraphics();
g2.translate(-p[0].x, -p[3].y);
cropPanel.paint(g2);
g2.dispose();
cropPanel.setBackground(Color.pink);
cropPanel.setImage(cropped);
public void mousePressed(MouseEvent e)
if(e.getClickCount() == 2)
cropPanel.clearClip();
start = e.getPoint();
public void mouseDragged(MouseEvent e)
end = e.getPoint();
// locate high and low points of rectangle from start
int dy = end.y - start.y;
int dx = end.x - start.x;
double theta = Math.atan2(dy, dx);
double spoke = start.distance(end)/2;
double side = Math.sqrt(spoke*spoke + spoke*spoke);
Point[] corners = new Point[4]; // counter-clockwise
corners[0] = start; // left
int x = (int)(start.x + side * Math.cos(theta + Math.PI/4));
int y = (int)(start.y + side * Math.sin(theta + Math.PI/4));
corners[1] = new Point(x, y); // bottom
corners[2] = end; // right
x = (int)(start.x + side * Math.cos(theta - Math.PI/4));
y = (int)(start.y + side * Math.sin(theta - Math.PI/4));
corners[3] = new Point(x, y); // top
cropPanel.setClip(corners);
} -
How can I get the coordinates to draw a line?
Hi,
I want to draw a line. Here is a part of my Quell-code.
public class Map extends JFrame {
public Map() {
super("Map");
setSize(340, 340);
MapPane map = new MapPane();
getContentPane().add(map);
class MapPane extends JPanel {
public void paintComponent(Graphics comp) {
Graphics2D comp2D = (Graphics2D)comp;
comp2D.drawLine(0,0,340,340);
Now, the line begins exactly top left in the edge, but ends not exactly down right in the edge of my Frame. Is there any possibility to determine the exact coordinates of the frame. I thought, if the size of the window is set by the setSize-Method to (340,340), the line ends exact
in the edge (down right). See: comp2D.drawLine(0,0,340,340).
Can somebody give me a piece of advice, please?
Thanks, joletaxiHave you tried the getWidth() and getHeoght() methods to determine how long the line should be?
-
Getting the coordinates of dynamically created objects
i have created 3 movie clips via actionscript and given them
instance names of cS_1, cS_2, and cS_3. however, i can't manage to
trace their x coordinates. i know i gotta do something with
getChildByName but i'm really stuck and can't figure it out. Could
someone please explain to me what i have to do like explaining to
an 8 year old. Thank you!
Here's the code:To use the getChildByName method you want to cast a MovieClip
variable to capture a reference to it, as in:
var cs1:MovieClip = this.getChildByName(cs_1);
trace(cs1.x);
Maybe you are looking for
-
Battery Consumption Up Win 8.1 Update 1 W530
Fan is running at low audible level constantly with low program load, battery appears to be draining much faster than before 8.1 or 8.1 Update 1. Running Win 8.1 Update 1 Pro 64 bit, all latest lenovo updates and bios and latest windows updates. B
-
FCP Not Working after Migration to New Mac
OK this is really making me mad. i bought a new mac, and used the cool now migration assistant to bring all my stuff over. apps, docs, all that stuff. and when i try everything works great except Final Cut Express. I open it and it asks for the the s
-
Hi folks!! Can anyone let me know the table names of warehouse, or any link for that. Best regards,
-
Does metadata show jpeg white balance info?
This whole metadata thing has me confused. I can't see the WB info in metadata unless i save the RAW file as a jpeg. If i take the pic AS a jpeg, all the WB metadata ever says is AUTO, even though i set it to deifferent light sources. Am I doing some
-
After updating iPhone to 7.0.2 Personal Hotspot USB can't connect, whats the fix?