10-24-2024, 06:10 PM
Hi,
Thanks for your reply. Maybe I could clarify my objective, since you answered my specific question but I would still like some help with what I am doing, if possible.
I have two binary images, A and B, with white blobs on black backgrounds. I want to create an image that contains all the blobs in A that overlap (partially or completely) with blobs in B. So if a blob in B touches a blob in A, the A blob is kept in the final image. My first step so far has been to change the opacity of the top layer to create a new layer with 4 different colors (white, light gray, dark gray, and black), corresponding to the overlap states. From here, I can simply use the fuzzy select tool with the sample threshold set to a certain tolerance to select the white areas (the overlap), and that will select all the white and light gray areas, which corresponds to what I want. However, I am looking to automate this process, and if possible I'd like to avoid scripting a scenario where we have to click every white area (or a pixel in it) with the fuzzy select tool. I was looking for some sort of "local flooding" tool that could flood white areas locally into adjacent regions with a threshold. Or if there's some other approach that would work better I'm all ears. Ideally I would like it to be scriptable and not terribly computationally expensive, since I plan on doing this with a much larger image with many blobs. If you have any advice or ideas on how I can achieve my goal, I would be most grateful.
Image A:
Image B:
Resulting selection I want:
Thanks for your reply. Maybe I could clarify my objective, since you answered my specific question but I would still like some help with what I am doing, if possible.
I have two binary images, A and B, with white blobs on black backgrounds. I want to create an image that contains all the blobs in A that overlap (partially or completely) with blobs in B. So if a blob in B touches a blob in A, the A blob is kept in the final image. My first step so far has been to change the opacity of the top layer to create a new layer with 4 different colors (white, light gray, dark gray, and black), corresponding to the overlap states. From here, I can simply use the fuzzy select tool with the sample threshold set to a certain tolerance to select the white areas (the overlap), and that will select all the white and light gray areas, which corresponds to what I want. However, I am looking to automate this process, and if possible I'd like to avoid scripting a scenario where we have to click every white area (or a pixel in it) with the fuzzy select tool. I was looking for some sort of "local flooding" tool that could flood white areas locally into adjacent regions with a threshold. Or if there's some other approach that would work better I'm all ears. Ideally I would like it to be scriptable and not terribly computationally expensive, since I plan on doing this with a much larger image with many blobs. If you have any advice or ideas on how I can achieve my goal, I would be most grateful.
Image A:
Image B:
Resulting selection I want: