Delphi 中有没有像C++中的图像细化的方法?

解决方案 »

  1.   

    void CimageCAMView::OnImageThin() 
    {
    CimageCAMDoc* pDoc = GetDocument();
    CString s1=" 请确定是二值图象!二值图象请按YES,不是请按NO退出加工";
    if(AfxMessageBox(s1,MB_YESNO,0 )==IDYES)

    //调用封装在CDib的Thining函数
    if (!m_pDib->Thining(m_pDib->m_hDib))
    AfxMessageBox(" 细化失败!!");
    m_pDib->UpdateInternal();
    pDoc->SetModifiedFlag(TRUE);
    OnRealizePal((WPARAM)m_hWnd,0);  // realize the new palette
    pDoc->UpdateAllViews(NULL);
    }
    }
    就是像这样的方法
      

  2.   

    因为我有C++的算法,我觉得在Delphi中应该有,免得改了,与屁有没有关系,不是很了解...
      

  3.   

    那把c的算法编译成dll或者类库,在d里调用不就得了。
      

  4.   

    《Delphi数字图像处理及高级应用》细化代码,必须在二值化基础上使用function TMyPicture.Xihua(Bitmap: TBitmap): Boolean;
    var
       bmp: TBitmap;
       X, Y: integer;
       O, T, C, B: pRGBArray;
       nb: array[1..3, 1..3] of integer;
       c1, c2, c3, c4: boolean;
       ncount: integer;
    begin
       bmp := TBitmap.Create;
       // Create bmp
       bmp.Assign(bitmap);
       //  获取bitmap 赋给bmp
       for Y := 1 to bmp.Height - 2 do
       begin
          O := bmp.ScanLine[Y];
          T := bitmap.ScanLine[Y - 1];
          C := bitmap.ScanLine[Y];
          B := bitmap.ScanLine[Y + 1];
          for X := 1 to bmp.Width - 2 do
          begin
             c1 := false;
             c2 := false;
             c3 := false;
             c4 := false;
             // 设立四个条件的初始值
             nb[1, 1] := T[X - 1].rgbtRed div 255;
             nb[1, 2] := T[X].rgbtRed div 255;
             nb[1, 3] := T[X + 1].rgbtRed div 255;
             nb[2, 1] := C[X - 1].rgbtRed div 255;
             nb[2, 2] := C[X].rgbtRed div 255;
             nb[2, 3] := C[X + 1].rgbtRed div 255;
             nb[3, 1] := B[X - 1].rgbtRed div 255;
             nb[3, 2] := B[X].rgbtRed div 255;
             nb[3, 3] := B[X + 1].rgbtRed div 255;
             //将[x,y]周围的八个象素点和它自己0-1化
             nCount := nb[1, 1] + nb[1, 2] + nb[1, 3]
                + nb[2, 1] + nb[2, 3]
                + nb[3, 1] + nb[3, 2] + nb[3, 3];
             // 获得ncount的值
             if (ncount >= 2) and (ncount <= 6) then
                c1 := True;
             //condition1
             ncount := 0;
             if (nb[1, 1] = 0) and (nb[1, 2] = 1) then
                inc(ncount);
             if (nb[1, 2] = 0) and (nb[1, 3] = 1) then
                inc(ncount);
             if (nb[1, 3] = 0) and (nb[2, 3] = 1) then
                inc(ncount);
             if (nb[2, 3] = 0) and (nb[3, 3] = 1) then
                inc(ncount);
             if (nb[3, 3] = 0) and (nb[3, 2] = 1) then
                inc(ncount);
             if (nb[3, 2] = 0) and (nb[3, 1] = 1) then
                inc(ncount);
             if (nb[3, 1] = 0) and (nb[2, 1] = 1) then
                inc(ncount);
             if (nb[2, 1] = 0) and (nb[1, 1] = 1) then
                inc(ncount);
             if ncount = 1 then
                c2 := true;
             //condition2
             if (nb[1, 2] * nb[3, 2] * nb[2, 3] = 0) then
                c3 := true;
             // condition3
             if (nb[2, 1] * nb[2, 3] * nb[3, 2] = 0) then
                c4 := true;
             //condition4
             if (c1 and c2 and c3 and c4) then
             begin
                O[X].rgbtRed := 255;
                O[X].rgbtGreen := 255;
                O[X].rgbtBlue := 255;
                //设置O[X]为白色
             end;
          end;
       end;
       bitmap.Assign(bmp);
       bmp.Free;
       //释放bmp
       Result := True;
       // 返回值为boolean,True表示细化成功
    end;procedure TMyPicture.Button8Click(Sender: TObject);
    begin
       if (XIhua(self.image1.Picture.Bitmap)) then
       begin
          image1.Picture.Bitmap.Assign(image1.Picture.Bitmap);
       end
       else
          showmessage('细化出错,请调试程序');
    end;
      

  5.   

    Visual Graph是一套强大的交互图形开发平台,她能非常方便地建造基于图形的界面、制作各种图形元件、实现图形管理、图形建模、制作监控系统、表单系统、绘图系统、流程设计、CAD软件等。她提供功能非常强大的ActiveX控件,和其他流行的编程语言共同工作,极大地弥补了这些语言在图形处理方面的不足。也可以嵌入IE浏览器中,实现网上图形编辑和控制等。http://www.visual-graph.com