m_nans_small_remaining = np.isnan(inpainted) & m_nans_small Even two-pixel regions completely surrounded by valid pixels fail to inpaint. This suggests that inpainting does not fail from a lack of paint. Interestingly, if I try to inpaint recursively - inpaint the image above masked with the nans from that image intersected with the original mask - there is no noticeable improvement, even with the smallest radius. ![]() A radius of 1 is also too small compared to the area of the regions I want to inpaint. Then I tried the smallest radius possible (1) with m_nans_small and while that inpaints more regions, it fails to fully inpaint the region of interest. The result was identical for the regions I was actually interested in inpainting, m_nans_small. Thinking higher radius caused only nans to be inpainted, I tried again with all nans masked ( m_nans). Then I tried dilating the mask, which led to nans being inpainted. Then I tried increasing the radius to 10 which resulted in nothing being inpainted. inpainted = cv2.inpaint(input, m_nans_small, 3, cv2.INPAINT_NS) Now I would like to inpaint the regions above, lets start with radius 3. ![]() M_nans_small = np.isin(nans_labelled, labels).astype(np.uint8) Here I select connected regions of nans with areas below an arbitrary threshold: n,nans_labelled,stats,centroids = cv2.connectedComponentsWithStats(m_nans) Here are the nans (white): m_nans = np.isnan(input).astype(np.uint8) ![]() I would like to inpaint the smaller connected regions of nan. I have a 100x100 numpy array which is about 47% nans.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |