its possible use connected component with area range ?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

its possible use connected component with area range ?

Post by diegomage » 2017-09-25T20:39:35-07:00

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

User avatar
fmw42
Posts: 22091
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: its possible use connected component with area range ?

Post by fmw42 » 2017-09-25T21:16:59-07:00

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.

diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: its possible use connected component with area range ?

Post by diegomage » 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

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
Last edited by diegomage on 2017-09-25T21:26:38-07:00, edited 1 time in total.

User avatar
fmw42
Posts: 22091
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: its possible use connected component with area range ?

Post by fmw42 » 2017-09-25T21:25:47-07:00

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.

diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: its possible use connected component with area range ?

Post by diegomage » 2017-09-25T21:27:14-07:00

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

linux ubuntu 14.04

User avatar
fmw42
Posts: 22091
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: its possible use connected component with area range ?

Post by fmw42 » 2017-09-25T21:27:34-07:00

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

User avatar
fmw42
Posts: 22091
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: its possible use connected component with area range ?

Post by fmw42 » 2017-09-25T21:42:43-07:00

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.

diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: its possible use connected component with area range ?

Post by diegomage » 2017-09-25T21:49:14-07:00

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

User avatar
fmw42
Posts: 22091
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: its possible use connected component with area range ?

Post by fmw42 » 2017-09-25T23:03:23-07:00

There is no easier way.

Post Reply