Dear friends
i need some help and maybe idea about my job.
in fact i want to do these:
1- doing edge detection on grayscale images
2-export just detected edges
3-save it in *.png format
now i have a problem. you can see it in picture that i linked it.
pic 1 is base , pic 2 is edge detected image , and pic 3 is png format. but ther is a problem in pic3. in fact after this line (c# code).
btmimg.MakeTransparent(Color.Empty);
Image img = (Image)btmimg;
img.Save("1" + ".Png", ImageFormat.Png);
i see noises around the detected edges .
so anybody have any idea about this ? how can i reduce these noises ?
is there other way that export detected edges and make new image?
Image link:
http://www.imageupload.co.uk/images/201 ... ed_-_1.jpg
please help me
thanks, Saba
question about how to reduce noise in image
-
- Posts: 4
- Joined: 2014-10-04T09:29:33-07:00
- Authentication code: 6789
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: question about how to reduce noise in image
PNG formats are loss-less, and do not introduce noise beyond rounding differences, eg when converting from floating point to integer. The input image may already have noise which is "enhanced" (made worse) by edge detection.
Can you put up an original input image?
Can you put up an original input image?
snibgo's IM pages: im.snibgo.com
-
- Posts: 4
- Joined: 2014-10-04T09:29:33-07:00
- Authentication code: 6789
question about how to reduce noise in image
the first link is original input image :
http://www.imageupload.co.uk/images/2014/10/05/1.jpg
and second one is edge detected image
http://www.imageupload.co.uk/images/201 ... 2CtzlM.jpg
Thanks
saba
http://www.imageupload.co.uk/images/2014/10/05/1.jpg
and second one is edge detected image
http://www.imageupload.co.uk/images/201 ... 2CtzlM.jpg
Thanks
saba
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: question about how to reduce noise in image
The input is 8-bit JPG, which uses lossy compression so contains noise. In this image, the dark areas are very noisy. We can remove this noise with an initial "-level 10%,100%".
I then use a Sobel edge-detector, followed by another "-level 10%,100%" to remove low-amplitude noise.
This shows some detail in both soft-tissue and bone. Adjust the parameters to vary the noise-reduction, depending on the required use. A final "-auto-gamma" helps visibility, or a different gamma could be used.
Removing more noise would also remove more detail.
Windows BAT syntax.
I then use a Sobel edge-detector, followed by another "-level 10%,100%" to remove low-amplitude noise.
This shows some detail in both soft-tissue and bone. Adjust the parameters to vary the noise-reduction, depending on the required use. A final "-auto-gamma" helps visibility, or a different gamma could be used.
Removing more noise would also remove more detail.
Windows BAT syntax.
Code: Select all
convert ^
skull.jpg ^
-alpha off ^
-level 10%%,100%% ^
-define convolve:scale="50%%^!" -bias 50%% ^
( -clone 0 -morphology Convolve Sobel:0 ) ^
( -clone 0 -morphology Convolve Sobel:90 ) ^
-delete 0 -solarize 50%% -level 50,0%% ^
+level 0,70.7%% ^
-evaluate Pow 2 ^
-compose plus -composite ^
-evaluate Pow 0.5 ^
-separate -evaluate-sequence Max ^
-auto-level ^
-level 10%%,100%% ^
-depth 16 ^
-write skull_sm2.jpg ^
-auto-gamma ^
skull_sm3.jpg
snibgo's IM pages: im.snibgo.com
-
- Posts: 4
- Joined: 2014-10-04T09:29:33-07:00
- Authentication code: 6789
Re: question about how to reduce noise in image
Thanks for your attention
What is your opinion about another solution?
do you have any solution for me ? or not , is my solution best ?
Thanks
Saba
What is your opinion about another solution?
do you have any solution for me ? or not , is my solution best ?
Thanks
Saba
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: question about how to reduce noise in image
Don't create your images in JPG, since it is lossy. If you must start with a JPG, then do not save the edge results as JPG. Go directly to PNG.
Also please always provide your IM version and platform. Perhaps you have an old version of IM or an old version of the jpg and png delegate libraries that need updating.
The works fine for me in IM 6.8.9.8 Q16 Mac OSX
You can adjust the white point in the contrast-stretch to bring out more detail.
Also please always provide your IM version and platform. Perhaps you have an old version of IM or an old version of the jpg and png delegate libraries that need updating.
The works fine for me in IM 6.8.9.8 Q16 Mac OSX
Code: Select all
convert 1.jpg -auto-level -define convolve:scale='!' \
-define morphology:compose=Lighten \
-morphology Convolve 'Sobel:>' -contrast-stretch 0x1% 1_sobel.png
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: question about how to reduce noise in image
Get a better input than 8-bit JPEG. This is a medical image, so a better image (with less noise) should be available.saeed_saba wrote:What is your opinion about another solution?
Other solutions are possible. What is the output for? It might be to identify bone fractures. Or voids in soft tissue. Or to make a pretty picture. If you only want to identify major edges, then more noise can be removed.
Many other techniques can be used for finding edges. See http://www.imagemagick.org/Usage/convolve/#edgedet and my "Details, details" page: http://im.snibgo.com/detail.htm
snibgo's IM pages: im.snibgo.com
-
- Posts: 4
- Joined: 2014-10-04T09:29:33-07:00
- Authentication code: 6789
question about how to reduce noise in image
Thanks
Thanks
saba
the out put is combination of two image (image3 on image1). almost the formats file is not important (only important things is that combine two image without noise).What is the output for?
identify bone will be enough .It might be to identify bone fractures
Thanks
saba