ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Find Object/Rectangular in Image
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

tulusbp

Indonesia
1 Posts

Posted - Feb 28 2017 :  23:41:29  Show Profile  Reply
Sorry for Bad English

I have image ( checque scan image ) i need only get coordinat of rectangular area




how to do that using ImageEn ....

thank's

w2m

USA
1990 Posts

Posted - Mar 01 2017 :  13:32:38  Show Profile  Reply
There is a demo for this: Demos\ImageAnalysis\SeparateObjects\:
// Separate
procedure TMainForm.Button2Click(Sender: TObject);
var
  rects:TList;
  i:integer;
  d:double;
  quality:integer;
begin
  Screen.Cursor := crHourGlass;
  try

  // leave only the first image
  for i:=1 to ImageEnMView1.ImageCount-1 do
    ImageEnMView1.DeleteImage(1);

  ImageEnView1.DeSelect;

  if CheckBox2.Checked then
    quality := 1  // quick process
  else
    quality := 4; // quality process

  rects := ImageEnView1.Proc.SeparateObjects(quality,CheckBox3.Checked);

  for i:=0 to rects.Count-1 do
  begin
    with PRect(rects[i])^ do
    begin
      if (Right-Left>10) and (Bottom-Top>10) then // removes little objects
      begin
        // draw boxes
        if CheckBox1.Checked then
          with ImageEnView1.IEBitmap.Canvas do
          begin
            Pen.Color:=clRed;
            Brush.Style:=bsClear;
            Rectangle(Left,Top,Right+1,Bottom+1);
          end
        else
          ImageEnMView1.SetImageRect( ImageEnMView1.AppendImage, ImageEnView1.IEBitmap, Left,Top,Right,Bottom );
      end;
    end;
    dispose(PRect(rects[i]));
  end;
  rects.free;
  ImageEnView1.Update;

  if CheckBox1.Checked then
    exit;

  // Deskew
  if Checkbox4.Checked then
    for i:=1 to ImageEnMView1.ImageCount-1 do
    begin
      ImageEnMView1.CopyToIEBitmap(i, ImageEnView1.IEBitmap);
      ImageEnView1.Update;
      application.processmessages;
      d:=ImageEnView1.Proc.SkewDetection;
      ImageEnView1.Proc.RotateAndCrop(d);
      ImageEnMView1.SetIEBitmap(i,ImageEnView1.IEBitmap);
      ImageEnView1.Update;
      application.processmessages;
    end;

  finally
    Screen.Cursor:=crDefault;
  end;
end;

The coordinates of each "object" is in the line Rectangle(Left,Top,Right+1,Bottom+1);
Left, Top, Right, Bottom.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

chunhua

China
5 Posts

Posted - Sep 02 2017 :  23:00:08  Show Profile  Reply
hi,Bill Miller

1.I am use SeparateObjects function . But circle and rectangle are in image, how can canvas circle line with circle's edge.

2.How to know the shape is circular or rectangular.

thanks

xxx
Go to Top of Page

xequte

39052 Posts

Posted - Sep 03 2017 :  18:42:11  Show Profile  Reply
Hi

I'm not sure what you are asking for is possible with ImageEn, can you post an example of the kind of image you are talking about.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

chunhua

China
5 Posts

Posted - Sep 25 2017 :  07:45:16  Show Profile  Reply
I am hope to develop this function: dection shape and draw edge.

Example: Aforge.Net Demo





demo link

http://www.aforgenet.com/articles/shape_checker/

xxx
Go to Top of Page

xequte

39052 Posts

Posted - Sep 26 2017 :  16:05:38  Show Profile  Reply
Hi

To find the contours of regular shapes (not circles) you should be able to use:

https://www.imageen.com/help/TIEVisionImage.findContours.html

(Requires the IEVision add-in).


We do not have an example, but the process would be something like:

1. Reduce the colors of the analysis image, ideally to monochrome
2. Use findContours to get a list of all contours of image
3. Analyze the results, e.g. a triangle will have three contours, four contours would be rectangle, or trapezium if one side is much longer than others, or diamond...

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: