-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object deblending overflow #51
Comments
Have you subtracted the background from the image? I've run into this issue before when the background level is higher than the detection threshold. If that isn't the issue, can you share the image so that we can take a look? |
@kboone thank you for your immediate feedback!
Yes, but I simply followed the instructions in the tutorial using the default settings for background estimation: import cv2
import sep
sep.set_extract_pixstack(10**7)
filename = ''
threshold = 3
img = cv2.imread(filename, cv2.IMREAD_UNCHANGED).as_type('float')
bkg = sep.Background(img)
img_sub = img - bkg
out, blobs_img = sep.extract(
img_sub, threshold, err=bkg.globalrms, segmentation_map=True
)
The error doesn't occur when I use
Please find a small region of the image attached (500x500, full image: 2160x2560). I've started to play with the size of the background boxes and filter kernels and start to get satisfactory results. Will need to have a closer look at the SEXtractor manual. Suggestions for improving background estimation would also be very welcome. |
I couldn't reproduce the error: In [3]: img = cv2.imread("desktop/db9a1a28-ff73-11e6-8bb6-e68874500515.png", cv2.IMREAD_UNCHANGED).astype('float')
In [7]: bkg = sep.Background(img)
In [11]: img_sub = img - bkg
In [12]: out, blobs_img = sep.extract(img_sub, 3, err=bkg.globalrms, segmentation_map=True)
In [14]: len(out)
Out[14]: 498 Can you reproduce the error on this sub-image, or do you need the full image for the error to occur? |
Seems likely. This would probably cause a very big blobby object when using |
What is this image of?? ;) Zoom in:I think the detection threshold is too low. SEP / SExtractor can still work on this image, but the defaults (and assumptions in the code) are set for wide-field optical/IR imaging. Those defaults and assumptions don't make sense for this image, so you'll need to be more careful and tweak a few things. For example, the background estimation algorithm in SEP / SExtractor basically assumes that the majority of pixels in any region are background. That doesn't seem to be the case here, so you may need a custom background estimation (or to be careful about what you define as "background" anyway). |
It's a microscopic image showing gene transcripts in human cells visualized via fluorescent dyes. |
Using small bkg = sep.Background(img, bw=3, bh=3, fw=2, fh=2)
img_sub = img - bkg
out, blobs_img = sep.extract(img_sub, 5, err=bkg.globalrms, minarea=3, segmentation_map=True) Thanks for your support! |
👍 Glad you got it to work for you! |
For some images, I get the following error message when running
sep.extract()
:I've tried decreasing
deblend_nthresh
, but keep getting the error until I decrease it todeplend_nthresh=1
.Is there another way to increase the limit without having to increase the detection threshold?
The text was updated successfully, but these errors were encountered: