Page 1 of 1

its possible use connected component with area range ?

Posted: 2017-09-25T20:39:35-07:00
by diegomage
I use this command

-define connected-components:area-threshold=200 -define connected-components:mean-color=true -connected-components 8


But I need to know if is possible assign a range between 100 and 150

Please help me

Re: its possible use connected component with area range ?

Posted: 2017-09-25T21:16:59-07:00
by fmw42
No, there is no option to tell it to only process colors in a given range. Perhaps you can explain further what you are trying to do. I may misunderstand your question.

Please always provide full command lines and again please identify your IM version and platform.

Re: its possible use connected component with area range ?

Posted: 2017-09-25T21:20:29-07:00
by diegomage
I refer the area threshold a range between values 100 and 150

I think that not exist option ?



Version: ImageMagick 7.0.6-0 Q16 x86_64 2017-07-12

Code: Select all

convert image.png -define connected-components:area-threshold=200 -define connected-components:mean-color=true -connected-components 8  out.png

this filter area less than 200 (values area btween 0 and 200)

I need filter in range 100 and 150


and linux ubuntu 14.04

Re: its possible use connected component with area range ?

Posted: 2017-09-25T21:25:47-07:00
by fmw42
diegomage wrote: 2017-09-25T21:20:29-07:00 I refer the area threshold a range between values 100 and 150

I think that not exist option ?



Version: ImageMagick 7.0.6-0 Q16 x86_64 2017-07-12
No, there is no option for range that I know.

Re: its possible use connected component with area range ?

Posted: 2017-09-25T21:27:14-07:00
by diegomage
Version: ImageMagick 7.0.6-0 Q16 x86_64 2017-07-12

linux ubuntu 14.04

Re: its possible use connected component with area range ?

Posted: 2017-09-25T21:27:34-07:00
by fmw42
You can collect the output list and find the ID values you want to keep according to the area range and run it again using -define connected-components:keep=list-of-ids

Re: its possible use connected component with area range ?

Posted: 2017-09-25T21:42:43-07:00
by fmw42
Can you provide and example image? You might be able to create a mask by running the command twice making the output the id values, once with 100 and again with 200 and get the difference and threshold them. Then use the mask to eliminate the unwanted gray level values from your original.

Re: its possible use connected component with area range ?

Posted: 2017-09-25T21:49:14-07:00
by diegomage
Image

I know how filter by range but Im trying to learn is exist a way for doing this "more easy" (less code)

for example I use a command like this for range filter

Code: Select all

convert image.png -define connected-components:area-threshold=15 -define connected-components:mean-color=true -connected-components 8  out1.png

Code: Select all

convert image.png -define connected-components:area-threshold=10 -define connected-components:mean-color=true -connected-components 8  out2.png

Code: Select all

convert out1.png    out2.png            -compose ChangeMask  -composite  out3.png

Re: its possible use connected component with area range ?

Posted: 2017-09-25T23:03:23-07:00
by fmw42
There is no easier way.