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: 205
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

its possible use connected component with area range ?

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: its possible use connected component with area range ?

Post 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.
diegomage
Posts: 205
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: its possible use connected component with area range ?

Post 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
Last edited by diegomage on 2017-09-25T21:26:38-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: its possible use connected component with area range ?

Post 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.
diegomage
Posts: 205
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: its possible use connected component with area range ?

Post by diegomage »

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

linux ubuntu 14.04
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: its possible use connected component with area range ?

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: its possible use connected component with area range ?

Post 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.
diegomage
Posts: 205
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: its possible use connected component with area range ?

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: its possible use connected component with area range ?

Post by fmw42 »

There is no easier way.
Post Reply