image denoise after edge detection

I’m using a sobel filter to detect the edges of an image.

ImgOriginal

I’m using a sobel filter to detect the edges of an image.
In the resulting image there is much noise that causes problems in further processing

imgEdge

I’m using a wavelet denoise filter that does not remove these artifacts. Is there a better denoise filter or edge detection algorithm to ensure proper edge detection without artifacts?

Not sure if these artifacts should be called noise.
They may be caused by image compression.
enhanced
Please note that using JPG-compressed images isn’t a good idea.

Would this
result_sigma=1
be acceptable?

In general, better image acquisition would be advisable.

Hi @Nico1978
Welcome to the forum.

the ‘disturbing’ structures are produced by the edge filter. You will never get complete rid of them.

Here are some ideas, packed in ImageJ macro code.

  1. You can smooth your image before applying the edge filter, like this:
run("8-bit");

run("Gaussian Blur...");
run("Find Edges");

grafik

or you can

  1. threshold the edge filtered image, fill the holes in this thresholded image and use it as a mask:
rename("orig");
run("8-bit");

run("Find Edges");
run("Duplicate...", "title=dub");

setAutoThreshold("Default dark");
setOption("BlackBackground", true);
run("Convert to Mask");

run("Close-");
run("Dilate");
run("Dilate");
run("Erode");
run("Erode");
run("Divide...", "value=255");

imageCalculator("Multiply create", "orig","dub");
selectWindow("Result of orig");

selectWindow("dub");
close();

grafik

Maybe this will help you to get started.

Thanks a lot for your response. In ImageJ the combination of blur and edge detection is working perfectly.
My implementation in Java is still causing the artifacts.

int[] filter = {1, 2, 1, 2, 4, 2, 1, 2, 1};
int filterWidth = 3;
imgBlured = blur(imgSrc, filter, filterWidth);
EdgeDetection edgeDetection=new EdgeDetection();
imgEdge=edgeDetection.detectEdges(imgBlured,EdgeDetection.SOBEL_FILTER_VERTICAL);

Do you know which edge detection method ImageJ is using?

The ImageJ-API docs tells us:

findEdges()
Finds edges in the image or ROI using a Sobel operator.

I now changed my program to use the Conny Edge detection.

conny

Locks as in ImageJ
May be internal algorithm implementation of ImageJ changed?

The relevant Java-code is here:
ByteProcessor.java.zip (10.0 KB)
(Look for the comment “3x3 Sobel filter”.)