Page 1 of 2
Questions mean shift noise removal and color reduction
Posted: 2017-08-03T09:42:01-07:00
by fmw42
aigo wrote: ↑2017-08-03T03:22:39-07:00
Hi again,
I understand what the windows size does now, sorry about that.
But, is it possible to specify the number of colors it can replace originals with (the number of colors in this case can be viewed as the number of clusters).
Say, for example I select 5 colors then when computing the mean of each window size, it selects the colour nearest to the mean (color) from my pre-specified color range (5 colors)?
If there is a function, that does this already. Kindly point me there.
Best,
Aigo!
No, you cannot specify numbers of color for mean-shift. But see my bash unix shell script, kmeans, at my link below. It can do that.
Re: New: mean shift noise removal and color reduction
Posted: 2017-08-03T11:27:14-07:00
by aigo
Hi Fred, I tried using the script but I keep on getting a white image.. I only used -n in the process.
Kindly help.
Thanks.
Aigo!
Re: New: mean shift noise removal and color reduction
Posted: 2017-08-03T11:42:55-07:00
by fmw42
aigo wrote: ↑2017-08-03T11:27:14-07:00
Hi Fred, I tried using the script but I keep on getting a white image.. I only used -n in the process.
Kindly help.
Thanks.
Aigo!
What is your IM version and platform? What was the command line you used? Did you follow the Pointers for use on my home page?
Re: New: mean shift noise removal and color reduction
Posted: 2017-08-04T03:37:16-07:00
by aigo
fmw42 wrote: ↑2017-08-03T11:42:55-07:00
aigo wrote: ↑2017-08-03T11:27:14-07:00
Hi Fred, I tried using the script but I keep on getting a white image.. I only used -n in the process.
Kindly help.
Thanks.
Aigo!
What is your IM version and platform? What was the command line you used? Did you follow the Pointers for use on my home page?
7.0.6-0 macOS Sierra
this is the command I used !sh kmeans.sh -n 20 faces.png faces_k10.png
Re: Questions mean shift noise removal and color reduction
Posted: 2017-08-04T09:11:54-07:00
by fmw42
It should be
bash kmeans.sh -n 20 faces.png faces_k10.png
Perhaps you can post your faces.png image to some free hosting service and put the URL here so I can test your image.
Re: Questions mean shift noise removal and color reduction
Posted: 2017-08-04T09:22:30-07:00
by fmw42
OK. I found your image on your other question. This is what I get.
Code: Select all
kmeans -n 10 -m 10 faces.png faces_kmeans_n10_m10.png
final colors:
count,hexcolor
94425,#ECF6FDFF
37772,#CDDEF3FF
34831,#D69D7BFF
23775,#B8C9DEFF
22432,#AE7658FF
19588,#744E3EFF
17833,#EAC1A7FF
16491,#312020FF
13564,#B3B6BDFF
7589,#8B98A1FF
Re: Questions mean shift noise removal and color reduction
Posted: 2017-08-04T10:37:34-07:00
by fmw42
Here is the mean-shift result
Code: Select all
convert faces.png -mean-shift 51x51+10% faces_mean_shift.png
And then the mean shift result processed by kmeans.
Code: Select all
kmeans -n 10 -m 10 faces_mean_shift.png faces_mean_shift_kmeans_n10_m10.png
final colors:
count,hexcolor
91585,#EBF7FEFF
42985,#D89F7DFF
37150,#CDDFF5FF
26843,#B5CAE2FF
20687,#AB7356FF
19686,#704C3CFF
15108,#C4BBBBFF
14849,#2D1E1FFF
12282,#F2CCB0FF
7125,#899EAAFF
Re: Questions mean shift noise removal and color reduction
Posted: 2017-08-05T01:17:47-07:00
by aigo
fmw42 wrote: ↑2017-08-04T09:11:54-07:00
It should be
bash kmeans.sh -n 20 faces.png faces_k10.png
Perhaps you can post your faces.png image to some free hosting service and put the URL here so I can test your image.
Thanks so much for this and the other examples.
But I still get the white image.
Could this be a platform problem?
Thanks!
Aigo.
Re: Questions mean shift noise removal and color reduction
Posted: 2017-08-05T01:19:37-07:00
by aigo
aigo wrote: ↑2017-08-05T01:17:47-07:00
fmw42 wrote: ↑2017-08-04T09:11:54-07:00
It should be
bash kmeans.sh -n 20 faces.png faces_k10.png
Perhaps you can post your faces.png image to some free hosting service and put the URL here so I can test your image.
Thanks so much for this and the other examples.
But I still get the white image.
Could this be a platform problem?
Thanks!
Aigo.
Re: Questions mean shift noise removal and color reduction
Posted: 2017-08-05T10:40:37-07:00
by fmw42
The error message you get is because you did not put the path to my script(s) in your PATH environment variable. However, that does not cause the script to fail. But I find there is a problem running the script with IM 7. I am trying to track that down now.
Re: Questions mean shift noise removal and color reduction
Posted: 2017-08-05T11:29:44-07:00
by fmw42
I have fixed one issue. But there is a bug in IM 7 with one function when the temp images are miff, that is causing the main problem of the white image. I will have to report it to the IM developers. In the mean time, if you want to run the script, download the newest version and globally replace .miff with .png, which seems to work for me on IM 7.0.6.5 Q16 Mac OSX Sierra
Re: Questions mean shift noise removal and color reduction
Posted: 2017-08-05T11:55:45-07:00
by aigo
Yeah..I have done that and it works perfectly.
Thanks!
Re: Questions mean shift noise removal and color reduction
Posted: 2017-08-05T12:08:55-07:00
by fmw42
I have found a workaround for the IM 7 issue. So you can download the latest version and will not have to replace .miff with .png
Re: Questions mean shift noise removal and color reduction
Posted: 2017-08-05T12:16:48-07:00
by aigo
Aah Nice..Thanks..
Re: Questions mean shift noise removal and color reduction
Posted: 2017-08-06T15:47:55-07:00
by snibgo
I get these results with an unpublished process module, based on
http://people.csail.mit.edu/tieu/notebo ... amerly.pdf
k-means, without SD normalisation:
k-means, with SD normalisation*:
fuzzy k-means, without SDN:
k-harmonic, without SDN:
* SD normalisation is: before the process, multiply channels by ratio of standard deviations, to make SDs roughly equal in each channel. After the process, divide by the same numbers.