Intel丨EleksMaker Intel Edison automatic passes, converted high speed laser engraving machine


  • ElekMaker Develop Department

    0_1493020458477_upload-92955cb5-a41d-4bec-8f75-e03782b8ac36

    Author: EleksMaker z, add time:November 17, 2015

    This is the translation version of the original content. Provided for information purposes only and should not be considered or used as a complete or accurate information.

    Chris Anderson wrote in the guest book, there are four basic tools, CNC,3D scanners, 3D printer and laser-engraving machine, the first three have been popular, but desktop laser engraver is always at an early stage.

    This once, we innovation has past of user experience, will traditional of computer end generated knife road, into carved machine carved of process completely simplified, joined this end photo, he end automatically began carved of black technology, used Intel Edison platform +OpenCV Visual operation to achieved TP, and OpenCV automatically processing, and automatic generated knife road and conveying to we of carved machine completed corresponding of automatically focusing carved work.

    0_1493020516341_upload-83a6042d-2c2c-46db-80ef-d8b89504aa43

    0_1493020536928_upload-dbf547ff-06e9-4be0-ab61-4f1314d067c8

    We by precompiling Ubuntu systems on the Edison as a platform to OpenCV, using a script call to complete our intended target.

    Enter a beautiful picture, tap carve can enjoy one-click conversion brings comfortable user experience.

    And now, brought us a brand new high speed laser engraving machine, using Delta rapid parallel arm architecture, autofocus, equipped with automatic tool path generation program, engraving speed compared to other same-level schema upgrade 10-20 times, complicated laser engraving preparation to become comfortable in the past, fly buttons awesome, made it possible for desktop laser engraver.

    0_1493020572477_upload-80cd057c-84aa-4b3b-8a09-2e217756cbae

    0_1493020584730_upload-ed663396-dd29-4ac1-a2d9-1c9c3a028e96

    0_1493020596666_upload-e0b02223-bddf-4d37-a815-e98d9453636e

    We team had participation variety domestic top desktop level laser carved programme development, in past development of precision schema CoreXY,H-Bot, drive programme based Shang be innovation, take the Sino-US Maker creative explosion for opportunity, development has this paragraph to speed convenient for core direction of machine, and match has general Delta and other 3D printer of transformation programme, everyone are can in himself of 3D printer based Shang added loaded we of equipment programme makes its into high-speed desktop level laser carved machine, Was instantiated by creativity in the hands of the Maker, and ease.

    0_1493020661803_6.png
    0_1493020666061_7.png
    0_1493020671562_8.png
    0_1493020681603_9.png
    0_1493020687671_10.png

    How to make your Edison to develop advanced applications? Here has been case study overview of the technical details of the project.

    First, Intel Edison is a function quite powerful of Development Board, its integrated performance far super market Shang of Development Board, so very for used to do into order development and graphics processing, regardless of is storage performance also is X86 schema are performance than tree berry sent like of Development Board excellent, and now most put Edison as Arduino to using, is so-called of Edison as Arduino, this is very waste of things. So I recommend Liunx Edsion development boards to use.

    Edison brings up their own improved Unix system, of course, and sometimes may not be compatible with other system problems, so we loaded the Ubuntu Edison system, which is compatible with most applications and can be installed by X-Windows and connect USB Monitor to implement graphical operations of CSK substantially Edison, as shown in the following figure, is that Ubuntu is installed and connect the RoboPeak USB Display shows.

    0_1493020724607_11.png

    First of all requires a larger than 16GB TF card, computers using LINUX or LINUX virtual machine on a host, then in the Terminal SU permission to view mount and TF card format EXT4 formatting.

    sudo fdisk -lu
    sudo fdisk /dev/sdb
    sudo mkfs -t ext4 /dev/sdb

    Writing the pre-built system images to TF card and into the Edison terminal settings start from the TF card to complete the configuration of the system.

    fw_setenv myrootfs_emmc 'PARTUUID=012b3303-34ac-284d-99b4-34e03a2335f4'
    fw_setenv myrootfs '/dev/mmcblk1p1'
    fw_setenv do_boot_emmc 'setenv myrootfs ${myrootfs_emmc}; run do_boot'
    fw_setenv do_boot_sdcard 'setenv myrootfs ${myrootfs_sdcard}; run do_boot'

    Then installed Ubuntu OpenCV basic required package installed on the platform, of course, also need to be installed the runtime, as follows:

    sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev

    Then you can and other common Linux device development, decentralization of some of our early graphics processing algorithms, as routine for reference only:

    
    #include<opencv2/opencv.hpp>
    #include<opencv2/highgui/highgui_c.h>
    #include<opencv2/imgproc/imgproc.hpp>
    #include<iostream>
    #include<fstream>
    
    using namespace std;
    using namespace cv;
    int main(int argc,char *argv[])
    {
    int camera_id = 0;
    ofstream outfile;
    outfile.open("Gcode.txt");
    
    if(argc>1)
      {
    camera_id = atoi(argv[1]);
      }
    
    cv::VideoCapture cap(camera_id);
    if(!cap.isOpened())
      {
    printf("failed to open the camera with id %d.\n",camera_id);
    return -1;
      }
    cv::Mat frame;
    cap>>frame;
    imwrite("camera_captured.png",frame);
    
    Mat img = imread(argv[1],CV_LOAD_IMAGE_GRAYSCALE);
    Mat edges;
    cvtColor(frame, edges, CV_BGR2GRAY); 
    blur(edges,edges,Size(3,3));
    Canny(edges,edges,50,100,3);
    
      
    /* MatIterator_<uchar> grayit, grayend;
    for(grayit = edges.begin<uchar>(),grayend = edges.end<uchar>(); grayit != grayend; ++grayit) 
      {
    if(*grayit==255) 
              {
    *grayit = 0; 
              }
    else
              {
    *grayit = 255; 
              }
    outfile<<(int)((uchar)(*grayit))<<endl; 
      }*/
    
    Mat roi(edges, Rect(10,10,100,100));
    
    /*
    640*480
    */
    
    Mat roi(edges,Rect(0,0,640,480)); 
     
    /*
    255:
    G1 X10 Y10 (move to start position)
    M106 (open laser)
    G1 X10 Y30 (engraving from the 10-30 path between the)
    M107 (turn off the laser)
    G1 X10 Y40 (move to next position)
    M106
    G1 X10 Y50
    M107
    
    */
    /*******************************************************/
    
    #Define GrayScale 255//frame grayscale
    int width = roi.cols;
    int height = roi.rows;
    int pixelCount[GrayScale]={0};
    float pixelPro[GrayScale]={0};
    int pixelSum = width * height, threshold = 0;
    uchar* data = (uchar*)roi.ptr<uchar>();
    
    Count the number of each pixel in the grayscale
    for(int i = 0; i < height; i++)
            {
    for(int j = 0;j < width;j++)
                    {
    pixelCount[(int)data[i * width + j]]++;
                    }
            }
    
    Each gray level of the entire image's pixels
    for(int i = 0; i < GrayScale; i++)
            {
    pixelPro[i] = (float)pixelCount[i] / pixelSum;
            }
    
    Traversing the grayscale [0,255], finding the right threshold
    float w0, w1, u0tmp, u1tmp, u0, u1, deltaTmp, deltaMax = 0;
    for(int i = 0; i < GrayScale; i++)
            {
    w0 = w1 = u0tmp = u1tmp = u0 = u1 = deltaTmp = 0;
    for(int j = 0; j < GrayScale; j++)
                    {
    If (j <= I)//the background section
                            {
    w0 += pixelPro[j];
    u0tmp += j * pixelPro[j];
                            }
    Else//foreground parts
                            {
    w1 += pixelPro[j];
    u1tmp += j * pixelPro[j];
                            }
                    }
    u0 = u0tmp / w0;
    u1 = u1tmp / w1;
    deltaTmp = (float)(w0 *w1* pow((u0 - u1), 2)) ;
    if(deltaTmp > deltaMax)
                    {
    deltaMax = deltaTmp;
    threshold = i;
                    }
            }
    
    /***********************************************/
    
    MatIterator_<uchar> grayit, grayend;
    for(grayit = roi.begin<uchar>(),grayend = roi.end<uchar>(); grayit != grayend; ++grayit) 
      {
    if(*grayit<threshold) 
              {
    *grayit = 0; 
              }
    else
              {
    *grayit = 255; 
              }
    outfile<<(int)((uchar)(*grayit))<<endl; 
      }
    
    bool data_flag = false;
    int x = 0,y = 0;
    
    for(int i=0;i<roi.rows;++i)
     {
    uchar * p = roi.ptr<uchar>(i); 
    for(int j=0;j<roi.cols;++j)
        {    
    y = -i+240;
    x = j-320;
    
    if(p[j]==0 && data_flag==false)
          {
    data_flag=true;
    outfile<<"G"<<1<<" ";
    outfile<<"X"<<x<<" ";
    outfile<<"Y"<<y<<endl;
    
    outfile<<"M"<<106<<endl;
          }
    else if(p[j]==0 && data_flag==true)
          {
             
          }
    else if(p[j]==255 && data_flag==true)
          { 
    
    data_flag=false;
    x=x-1;
    outfile<<"G"<<1<<" ";
    outfile<<"X"<<x<<" ";
    x=x+1;
    outfile<<"Y"<<y<<endl;
    outfile<<"M"<<107<<endl;
          }
    outfile<<(int)(p[j]); 
    /* outfile<<"{";
    outfile<<i;
    outfile<<",";
    outfile<<j;
    outfile<<":";
    if(p[j]==255)
    outfile<<0;
    else
    outfile<<"#";
    outfile<<"}"<<endl;*/
        }
    data_flag=false;
     }
      
    outfile.close();
    imwrite("converted.png",roi);
    return 0;
    }
    
    

    Script development is complete, then write your own the slave interface control program, to complete the development, achieve their brilliant Edison wisdom.


Log in to reply
 

Looks like your connection to Offical Forum was lost, please wait while we try to reconnect.