I am trying to search for the black areas along a line (the horizontal line shown below). Though it is straight in this picture, it could be of irregular shape in other cases. It seems that the ImageTake function can only take rectangle areas. Can anyone tell me how to limit the processing within the line neighborhood area, and mark the black area in the left part?

Update: Several raw images without red marks:

Update2: Other cases with bigger black area somewhere else

