Get Mouse Position pixel coordinates relative to JFrame



```
PointerInfo a = MouseInfo.getPointerInfo();
Point b = a.getLocation();
int x = (int) b.getX();
int y = (int) b.getY();
System.out.print("Y: "+y);
System.out.print("X: "+x+"\n");
```

Right now I'm using this, but it gives me the coordinates relative to the entire monitor. Since you can move the program frame anywhere on the monitor, this doesn't help me. How can I get the mouse's coordinates relative to the program window? For instance, the top left corner would be (0, 0) and the bottom right would be (400, 420)
Point#getLocationOnScreen(); returns correct Container Point
hi,

unfortunately, this information is not available.

but you can calculate the motion via matched bbox in adjacency frame directly.

thanks. Go to the control panel and check the mouse settings and click on defaults to reset the settings if ever someone changed it! double click in the figure to bring up the property inspector. make sure the units property is "pixels". then in the position property (expand it to see width and height), type in 900 for the width, and 100 for the height. if that still doesn't work, make sure the resize property is set to "on". okay, i think i see what you’re trying to do. so, it’s similar to the previous answer, but i just added one more line of code from their edit:

@zoom on 188 221 to 243% in 0

&jacob walks to spot 0.506 152 270 in 2 and jacob faces left and jacob starts dance\_lift\_receive\_start then jacob is idle\_lay… hi [@banati.bodo](/u/banati.bodo)

the key here is to find which points are on the symmetry plane and keep them there with an onplane goal, then for the points ‘above’ the symmetry plane, use a transform goal to lock them to their mirror image below the symmetry plane.

[symmetry\_planarhex.gh](/uploads/short-url/wlxtpug6o3kghsxsd43l0qwa6jy.gh) (17.3 kb)

[symmetry] After 5 hours of learning I have compiled these:


Mindset



1. **Make sure the placed image ratio is good** to make it more realistic. This can be attained by checking with the other object in the output picture, like trees, or other peoples' height. You are not going to place human with the size much smaller than the other human at the same picture. Similarly, you also must not place a person with the height higher than a tree.
2. **Get the right perspective**. Sometimes, when an object is placed in an odd perspective, image is going to look very bold that it has been photoshopped or copy pasted.
3. **Lighting**. It is important to pay attention to light source, like the sun, and make sure our object is appropriate with output background light source. This can be done by adjusting the lighting of object and adding shadow with referencing other shadow in output image.


Tools (to make edges more realistic)



1. **Layer masking.** If moving people, hair can look awful if just plainly moved. Masking allows us to further tweak our selection.
2. **Refine edge.** *This tool allows you to control many aspect of the edge of your selection* (desired object to move), like Edge Detection (brushing the edges of object and let photoshop do its job, usually around dog fur), Feather (Soften the area of selection), Smooth (reduce pointiness of your selection), Contrast (somewhat opposite of smooth), and Shift Edge (moving feather far or nearer the selection, usually to remove excess background color near the edges). *REFERENCE: <https://www.youtube.com/watch?v=5lDr2Nd8Yl4>*
3. **Layer Matting**. Inside we have many sub-tools to work on, like Color Decontamination (spread out soft mask around the edge, usually for hair to catch other hair that accidentally masked or can be used similarly to Shift Edge), Remove Matte (soften edge of sharp graphic or pixalated, raster look). *REFERENCE: <https://www.youtube.com/watch?v=N6K_htNQPPA>*
4. **Image Calculation**. By playing with the blending, we can make the background darker; thus, helping us making mask. *REFERENCE: <https://www.youtube.com/watch?v=0zf-H9RoCNk>* the straight distance between two place on a map can be measured by a strip of paper and divider.use a ruler to measure the distance between the two places. if the line is quite curved, use a string to determine the distance, and then measure the string. find the scale for the map you're going to use. it might be a ruler bar scale or a written scale, in words or numbers. you should save the last pressed coordinate and use it as released. or do not set the coordinates when the tp is released. for example:

/*save the pressed coordinates and the state*/

if(\_tft->gettouch(&t\_x, &t\_y)) {

data->state = lv\_indev\_state\_pr;

/*set the last pressed coo… Have a look at this video that explains how to get the raw data from an F200, and convert the images into an OpenCV Mat object:


<https://www.youtube.com/watch?v=wIkIdjN6Oyw>


And here is the conversion shown in the video:



```
cv::Mat PXCImage2CVMat(PXCImage *pxcImage, PXCImage::PixelFormat format)
{
    PXCImage::ImageData data;
    pxcImage->AcquireAccess(PXCImage::ACCESS\_READ, format, &data);

    int width = pxcImage->QueryInfo().width;
    int height = pxcImage->QueryInfo().height;

    if(!format)
        format = pxcImage->QueryInfo().format;

    int type;
    if(format == PXCImage::PIXEL\_FORMAT\_Y8)
        type = CV\_8UC1;
    else if(format == PXCImage::PIXEL\_FORMAT\_RGB24)
        type = CV\_8UC3;
    else if(format == PXCImage::PIXEL\_FORMAT\_DEPTH\_F32)
        type = CV\_32FC1;

    cv::Mat ocvImage = cv::Mat(cv::Size(width, height), type, data.planes[0]);

    pxcImage->ReleaseAccess(&data);
    return ocvImage;
}
```

 




[View solution in original post](/t5/Software-Archive/converting-PXCImage-to-Mat-format/m-p/1090766#M65212) How you do this will depend on a number of factors: since you haven't tried to explain in any detail, I'll assume you know nothing, and just give you the basics.  

  

The easiest way to do this is to read the text file into a single string, and then use the .NET framework to find the match:  


```
Dim text As String = File.ReadAllText("D:\Temp\MyFile.txt")
Dim index As Integer = text.IndexOf("hello")
If index >= 0 Then
   ' String is in file, starting at character "index"
End If
```
  

There are other ways, but that is pretty much the simplest.