Page 1 of 2 12 LastLast
Results 1 to 12 of 15

Thread: webcam edge finder?

  1. #1
    Registered
    Join Date
    Nov 2006
    Location
    edmonton
    Posts
    104
    Downloads
    0
    Uploads
    0

    webcam edge finder?

    Anyone know of any software for EMC that can use a webcam as a edge finder? I have seen it with mach3 but havent found anything for EMC yet.


  2. #2
    Registered
    Join Date
    Jun 2010
    Location
    U.S.A.
    Posts
    2
    Downloads
    0
    Uploads
    0

    Talking Webcam center finder for emc2 Ubuntu Hardy Heron

    Hi, this is Mechstew! I love the EMC2 interface, and am new to milling,
    and cnc control. I saw an article referring to a webcam center finder and figured it was worth a try. "After" making it, I could find no program to utilize it with EMC2 2.3.5, all of the blogs and posts i could find were also fruitless.
    Having spent forty bucks on this round thing that I just finished butchering, Wal-Mart would not take it back now! I spent 2 weeks for trial and error to finally have a working 960 X 720 (pixel) window with a crosshair. I am neither a programmer nor a computer guru, I just want to make little pieces out for big pieces and this helps me to do it reliably. If you or anyone else is interested let me know and I will try to relay that information through this portal.
    I am using a Logitek c300 with Ubuntu Hardy Heron, and lauch a .py file outside of EMC2 2.3.5.

    P.S. I do not check my web accounts often (once/week), now its time for me to build!


  3. #3
    Registered
    Join Date
    Sep 2004
    Location
    USA
    Posts
    149
    Downloads
    0
    Uploads
    0
    Hi Mechstew,
    I am interested in what you did with the python program.

    Thanks,
    Dan


  4. #4
    Registered
    Join Date
    Mar 2008
    Location
    uk
    Posts
    22
    Downloads
    0
    Uploads
    0
    Hi Mechstew,

    I have been down the same path: got working webcam but no software to make use of it!
    It would be great if you could share your solution!

    regards
    Alex


  • #5
    Registered
    Join Date
    Jun 2010
    Location
    U.S.A.
    Posts
    2
    Downloads
    0
    Uploads
    0

    Talking Webcam center finder emc2 2.3.5

    Hi All, I will put together the information that I have, and try to post it on Monday.

    Until then, a few things to test first, with the usb webcam plugged in.

    1: Open a "terminal" window, and enter the following:
    xawtv -hwscan
    if this package is not installed, then using a "terminal" window enter:
    sudo apt-get install xawtv
    , enter your login password, then follow
    on screen prompts.

    The xawtv -hwscan the xawtv is only used to find out the type of output
    from the webcamera and if it is connected to the dev/video0 port.

    2: Next, enter the following in a terminal window:
    gst-launch videotestsrc ! xvideosink

    A small window displaying a test pattern should be playing on the screen.
    If nothing happes then the terminal window will probably tell you how to
    install gstreamer.
    I have read that the gts-launch command is for "testing" gstreamer
    applications, which is great, since I only want to test where the location
    of a hole center is in relation to the spindles center.

    If the computer does not have access to the internet I will have to figure
    out how to install the packages needed to run the webcamera.
    You can install a windows .ini driver for a wifi connection by using the synapic package manager (SPM), listed under system, administration. Launch the SPM and search for "ndisgtk", mark the package for install, insert the Ubuntu live cd, and then apply changes in SPM. The package name is "ndisgtk", it is an interface for "ndiswrapper", ndisgtk will create a new icon(link) listed under system, administration for wireless drivers.

    You will find some attached files below, the output size of the video window should match the size of the .png overlay. when first testing do not have other audio or visual elements playing, as is might be using resources you need to use for testing. I pasted the one line command series into a file named center.py, you can use any name but be sure to end it with a .py inorder to assign it a file type. Having done this, you will be able to right click the top Ubuntu panel bar in the grey area and create a new quick launch icon(button for the .py file) you may need to look at the properties of your new .py file and check the "treat as executible" so the execute option shows.
    Hopefuly all is still well. You can make you own icon image for the quicklauch by using the applications/accessories/screencapture with your webcam playing.

    Side Notes:
    My video window can be dragged to any size and the crosshairs remain "centered", if on AV type programs are running.
    My window only works at frame rates =< 10/1 fps.
    I made the .png picture using Gimp, drawing the cross first, using guidelines,
    then colored the remaining back ground to alpha, as the command lines I used project the webcams stream onto this alpha color region.
    When all is hunky-dory, I open EMC2, then quick-launch my.py file, then right click the un-named video window seen in the lower browser-bar to select always on top, then using the lower browser-bar again, select the EMC2, to finaly use the keyboard short cuts to calibrate, then position the part.

    I would not run an EMC g-code unless the video window is closed since the gst launch is "only for testing", and it could effect latency stuff.
    If you run the webcam window through the terminal you will likely see a clock error iterating to infinity, but the window is still reliable and repeatable and does not lug the computer down, unlike (webcamstudio). Anyway as for myself I just want to position parts and pull splinters.

    Remember to try the smaller parts then work up to the whole.



    Sources:
    This source started the mess.
    http://noraisin.net/~jan/diary/?p=40

    This source, once inverted, help finish the mess.
    http://www.opensource-archive.org/sh...d.php?t=181657


    Goodluck!
    Mechstew
    Attached Thumbnails Attached Thumbnails webcam edge finder?-cross640480.png   webcam edge finder?-cross960720.png  
    Attached Files Attached Files
    Last edited by Mechstew; 06-21-2010 at 07:56 PM. Reason: Updated 6/21/2010


  • #6
    Registered
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    487
    Downloads
    0
    Uploads
    0
    Check this out for something similar:
    EMC Documentation Wiki: Axis Embed Video


  • #7
    Registered
    Join Date
    May 2006
    Location
    United States
    Posts
    121
    Downloads
    0
    Uploads
    0
    That is really slick. Thanks Chester.


  • #8
    Registered
    Join Date
    May 2005
    Location
    canada
    Posts
    1,164
    Downloads
    0
    Uploads
    0
    That is slick.

    Now where's the Linux version of Tormach's Scan/Cad ? I'm convinced there's an existing combination of open source tools that could turn emc into a scanner, just need to find those tools.

    Well...... that, plus buy a usb microscope
    Anyone who says "It only goes together one way" has no imagination.


  • #9
    Registered
    Join Date
    Aug 2010
    Location
    USA
    Posts
    1
    Downloads
    0
    Uploads
    0

    Patch link dead

    Chester88,

    I'm 95% there... the link for the patch is busted (site gone extinct, I think).

    [2] http://psha.org.ru/p/0001-Added-reparent.patch


    Do you know where I might grab that patch or could you drop a copy on me?

    Thanks,

    John Adam in Libertyville


  • #10
    Registered
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    487
    Downloads
    0
    Uploads
    0
    It seems to be back . Maybe it should be added to wiki as a file rather then a link.


  • #11
    Registered
    Join Date
    May 2006
    Location
    United States
    Posts
    121
    Downloads
    0
    Uploads
    0
    the link is dead for me too.


  • #12
    Registered kanton's Avatar
    Join Date
    Jun 2003
    Location
    USA
    Posts
    232
    Downloads
    0
    Uploads
    0
    I get this on the link but I don't understand what it is or how to use it:

    From 63942679046c9d5a2942c257651270090d6b30d5 Mon Sep 17 00:00:00 2001
    From: Pavel Shramov
    Date: Mon, 4 Oct 2010 00:15:06 +0400
    Subject: [PATCH] Added reparent

    Added ability to embed into other X-window when called with -w/--window
    parametere.

    Signed-off-by: Pavel Shramov
    ---
    camview/camview.c | 28 ++++++++++++++++++++++++++--
    1 files changed, 26 insertions(+), 2 deletions(-)

    diff --git a/camview/camview.c b/camview/camview.c
    index e479512..228dd53 100644
    --- a/camview/camview.c
    +++ b/camview/camview.c
    @@ -7,6 +7,8 @@
    #include

    #include
    +#include
    +#include

    #include
    #include
    @@ -25,6 +27,7 @@ typedef struct _state_t {
    char *xml_fname;
    char *extra_plugin_path;
    int use_gui;
    + int window_id;

    GtkWindow *window;
    GtkWidget *manager_frame;
    @@ -194,7 +197,10 @@ on_save_menu_item_activate (GtkWidget *widget, void * user)
    static void
    setup_gtk (state_t *self)
    {
    - self->window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
    + GtkWindowType type = GTK_WINDOW_TOPLEVEL;
    + if (self->window_id)
    + type = GTK_WINDOW_POPUP;
    + self->window = GTK_WINDOW (gtk_window_new (type));
    gtk_window_set_title(self->window, "Camview");
    gtk_window_set_resizable(self->window, TRUE);
    gtk_window_set_default_size(self->window, 1000, 540);
    @@ -316,6 +322,19 @@ setup_gtk (state_t *self)

    gtk_widget_show_all (GTK_WIDGET (self->window));

    + if (self->window_id) {
    + Window xid = GDK_WINDOW_XID (GTK_WIDGET(self->window)->window);
    + long info[2] = { 0, 1 << 0 /*XEMBED_MAPPED*/ };
    + Display * dpy = GDK_WINDOW_XDISPLAY(GTK_WIDGET(self->window)->window);
    + Atom atom = XInternAtom(dpy, "_XEMBED_INFO", 1);
    + printf("Reparent %d (%p)\n", xid, dpy);
    + XChangeProperty(dpy, xid, atom, atom, 32, PropModeReplace, (unsigned char *)&info, 2);
    + XReparentWindow(dpy, xid, self->window_id, 0, 0);
    + XSync(dpy, 0);
    + XMapWindow(dpy, xid);
    + XSync(dpy, 0);
    + }
    +
    g_timeout_add(250, decay_fps, self);
    }

    @@ -390,6 +409,7 @@ usage()
    "chains. It uses GTK+ 2.0, OpenGL, and libcamunits.\n"
    "\n"
    "Options:\n"
    + " -w, --window WID Embed in window with id WID\n"
    " -c, --chain NAME Load chain from file NAME\n"
    " --no-gui Run without a GUI. If --no-gui is specified,\n"
    " then -c is required.\n"
    @@ -405,11 +425,12 @@ int main (int argc, char **argv)
    state_t * self = (state_t*) calloc (1, sizeof (state_t));
    self->use_gui = 1;

    - char *optstring = "hc:";
    + char *optstring = "hc:w:";
    int c;
    struct option long_opts[] = {
    { "help", no_argument, 0, 'h' },
    { "chain", required_argument, 0, 'c' },
    + { "window", required_argument, 0, 'w' },
    { "plugin-path", required_argument, 0, 'p' },
    { "no-gui", no_argument, 0, 'u' },
    { 0, 0, 0, 0 }
    @@ -418,6 +439,9 @@ int main (int argc, char **argv)
    while ((c = getopt_long (argc, argv, optstring, long_opts, 0)) >= 0)
    {
    switch (c) {
    + case 'w':
    + self->window_id = atoi (optarg);
    + break;
    case 'c':
    self->xml_fname = strdup (optarg);
    break;
    --
    1.7.1


  • Page 1 of 2 12 LastLast

    Similar Threads

    1. Webcam centre / edge / hole finder
      By alan T in forum Quickstep
      Replies: 22
      Last Post: 10-31-2012, 12:05 AM
    2. My DIY Edge Finder
      By multiplex in forum DIY CNC Router Table Machines
      Replies: 40
      Last Post: 05-25-2010, 12:46 PM
    3. Edge Finder
      By Ashish B in forum CNC Machining Centers
      Replies: 14
      Last Post: 09-13-2009, 04:51 AM
    4. Edge finder
      By eggo in forum Australia, New Zealand Club house
      Replies: 3
      Last Post: 08-04-2008, 11:57 AM
    5. Has anyone used this edge finder?
      By l u k e in forum General Metalwork Discussion
      Replies: 34
      Last Post: 03-19-2008, 02:52 PM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.