You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I solved this with a workaround which checks first if the image is entirely black:
public static boolean isSolidBlack(ImageUInt8 img){
for(byte b : img.data){
if(b != 0){
return false;
}
}
return true;
}
The text was updated successfully, but these errors were encountered:
That's a bug and it's fixed. Canny can't handle the situation when the threshold is zero and the image has no intensity. The adaptive canny now takes that in account and handles it correctly. Updated unit tests and a few other changes. Let me know if this works for you.
Actually use this commit instead. It fixes the real bug and provides more consistent behavior. In this situation the entire image will be one massive edge because the threshold (computed using the relative threshold) is set to zero.
Hi Peter
When I feed an Image into the canny edge detector which is solid black, the process method does not seem to ever return.
example:
BufferedImage solidBlack = ImageIO.read(new File("black.png"); //loads solid black image
ImageUInt8 gray = ConvertBufferedImage.convertFrom(solidBlack , (ImageUInt8) null);
CannyEdge<ImageUInt8, ImageSInt16> canny = FactoryEdgeDetectors.canny(2, false, true, ImageUInt8.class, ImageSInt16.class);
float THRESHOLD_LOW = 0.075f, THRESHOLD_HIGH = 0.3f;
canny.process(gray, THRESHOLD_LOW, THRESHOLD_HIGH, gray); //<-- never returns
I solved this with a workaround which checks first if the image is entirely black:
public static boolean isSolidBlack(ImageUInt8 img){
for(byte b : img.data){
if(b != 0){
return false;
}
}
return true;
}
The text was updated successfully, but these errors were encountered: