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
 Watershed
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Arash

USA
10 Posts

Posted - Jun 14 2021 :  12:11:47  Show Profile  Reply
I'm trying to use watershed with polyline instead of drawing ellipse(like demo project)
after drawing two polyline layers, they will merge with each other and convert to "TIEImageLayer" and then everything is the same as the watershed demo
but it selects something like this
anybody knows why?!

xequte

38182 Posts

Posted - Jun 15 2021 :  00:19:49  Show Profile  Reply
Hi

Try adding a button to output the watershed bitmap to a file:

ImageEnView1.Layers[1].Bitmap.write('d:\out.png');

Ensure that it looks like this:



Note the black background.

You'd need to show me your code for more detail.

Nigel
Xequte Software
www.imageen.com

Go to Top of Page

Arash

USA
10 Posts

Posted - Jun 15 2021 :  05:36:36  Show Profile  Reply
this is a transparent image

Go to Top of Page

Arash

USA
10 Posts

Posted - Jun 15 2021 :  05:49:29  Show Profile  Reply
Watershed := IEVisionLib.createWatershed;
imageEnView1.LayersCurrent := 0;
Watershed.setInputImage(imageEnView1.Layers[0].Bitmap.GetIEVisionImage());
Watershed.setMarkers(0);
imageEnView1.MouseInteractGeneral :=[];
imageEnView1.MouseInteractLayers := [mlClickCreatePolylineLayers, mlEditLayerPoints];



---- After creating two polyline layers, they will merge with each other:



imageEnView1.LayersDeselectAll;
if imageEnView1.LayersCount = 3 then imageEnView1.LayersMerge([1, 2]);
imageEnView1.LayersCurrent := 0;
imageEnView1.Layers[1].Bitmap.Write('D:\a.png');
Watershed.setMarkers(0);
Watershed.setMarkers(imageEnView1.Layers[1].Bitmap.GetIEVisionImage());
imageEnView1.Layers[1].Bitmap.Origin := ieboBOTTOMLEFT;
Watershed.run;
imageEnView1.Deselect;
Watershed.getSelectionMask(imageEnView1.SelectionMask, integer(clRed));
imageEnView1.SelectCustom;
Go to Top of Page

xequte

38182 Posts

Posted - Jun 15 2021 :  18:25:29  Show Profile  Reply
Hmm. I created a demo to allow polyline selection:

attach/xequte/2021615182231_WatershedSelection.zip
1601.62 KB

(importantly setting the polyline AntiAlias to false).

But I had the same difficutly as you. I will pass the demo onto my partner who does the IEVision development.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Arash

USA
10 Posts

Posted - Jun 17 2021 :  04:26:54  Show Profile  Reply
Also, I think there is another problem
After:

ImageEnView1.Deselect;
Watershed.getSelectionMask(ImageEnView1.SelectionMask, integer(clRed));
ImageEnView1.SelectCustom;

there is a border around the image that is not selected:


Go to Top of Page

xequte

38182 Posts

Posted - Jun 17 2021 :  17:50:08  Show Profile  Reply
Thank you. We're investigating this...

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Arash

USA
10 Posts

Posted - Jun 24 2021 :  10:00:26  Show Profile  Reply
Hi dear Nigel

Watershed := IEVisionLib.createWatershed;
Watershed.setInputImage(ImageEnView1.Layers[0].Bitmap.GetIEVisionImage());
Watershed.setMarkers(0);

I'm trying to remove the background of an image and these three lines use about 300MB of memory for a special image
how can I free up the memory after finishing my work?
Go to Top of Page

xequte

38182 Posts

Posted - Jun 24 2021 :  23:57:54  Show Profile  Reply
Hi Arash

We'll have a fix for the selection issue in the upcoming release of ImageEn and IEVision (July).

You can free the memory held by the watershed object with:
Watershed := nil;

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

xequte

38182 Posts

Posted - Jun 25 2021 :  22:24:21  Show Profile  Reply
Hi Arash

Here is the completed polyline Watershed demo:

attach/xequte/202162522239_WatershedSelection_Polyline.zip
837.94 KB

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